code stringlengths 3 1.05M | repo_name stringlengths 4 116 | path stringlengths 4 991 | language stringclasses 9 values | license stringclasses 15 values | size int32 3 1.05M |
|---|---|---|---|---|---|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Cornelius.IO
{
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
sealed class TableAttribute : Attribute
{
public string Name { get; set; }
}
}
| palotasb/cornelius | Cornelius/IO/TableAttribute.cs | C# | mit | 314 |
#include <stdio.h>
#include "tools.h"
#include "global.h"
#include "extern.h"
#include "functions.h"
//#include <gsl/gsl_rng.h>
#include <gsl/gsl_matrix.h>
#include <gsl/gsl_linalg.h>
#include <gsl/gsl_blas.h>
//#include <mkl.h>
void inclusiveValue
(
struct INCV &incv,
double *deltaIn,
struct PAR &par,
struct VAR &var,
double *nu
//=======================================================
)
{
int j, k, n, s, t;
double
det,
expInclusiveValue, // exponentiated logit inclusive value
max_w = -DBL_MAX,
min_w = DBL_MAX;
// Compute logit inclusive values w[t] for consumer i
for (t=1; t<=n_period; t++){
expInclusiveValue = 0;
for (j=1; j<=n_product; j++){
var.util[j] = deltaIn[idx[t][j]];
for (k=1; k<=n_theta2; k++){
var.util[j] += par.theta2[k] * nu[k] * var.X[idx[t][j]][rcID[k]];
}
var.num[t][j] = exp(var.util[j]);
expInclusiveValue += var.num[t][j];
}
incv.w[t] = log(expInclusiveValue);
max_w = fmax(max_w, incv.w[t]);
min_w = fmin(min_w, incv.w[t]);
}
for (t=1; t<=n_period-1; t++){
incv.y[t] = incv.w[t+1];
incv.w_lag[t][1] = 1;
incv.w_lag[t][2] = incv.w[t];
}
// Estimate lambda in transition process of inclusive values
transpose(incv.w_lag, incv.w_lag_t, n_period-1, 2);
matmul(incv.w_lag_t, incv.w_lag, incv.ww, 2, n_period-1, 2);
matvecmul(incv.w_lag_t, incv.y, incv.wy, 2, n_period-1);
det = fabs(incv.ww[1][1]*incv.ww[2][2] - incv.ww[1][2]*incv.ww[2][1]);
incv.ww_inv[1][1] = incv.ww[2][2] / det;
incv.ww_inv[2][2] = incv.ww[1][1] / det;
incv.ww_inv[1][2] = incv.ww_inv[2][1] = -incv.ww[1][2] / det;
matvecmul(incv.ww_inv, incv.wy, incv.lambda, 2, 2); // make sure lambda works
matvecmul(incv.w_lag, incv.lambda, incv.wlambda, n_period-1, 2);
// Estimate variance of psi
incv.varPsi = 0;
for (n=1; n<=n_period-1; n++){
incv.varPsi += (incv.y[n] - incv.wlambda[n]) * (incv.y[n] - incv.wlambda[n]);
}
incv.varPsi /= n_period - 2;
// Set up grid space
max_w = max_w + 2.575829*sqrt(incv.varPsi);
min_w = min_w - 2.575829*sqrt(incv.varPsi);
for (s=1; s<=n_grid; s++){
incv.wGrid[s] = min_w + (s-1) * (max_w - min_w)/(n_grid-1);
}
}
void inclusiveValue
(
//=======================================================
struct INCV &incv,
double *expDeltaIn,
double **expMu,
struct VAR &var
//=======================================================
)
{
int j, n, s, t;
double
det,
expInclusiveValue, // exponentiated logit inclusive value
max_w = -DBL_MAX,
min_w = DBL_MAX;
// Compute logit inclusive values w[t] for consumer i
for (t=1; t<=n_period; t++){
expInclusiveValue = 0;
for (j=1; j<=n_product; j++){
var.num[t][j] = expDeltaIn[idx[t][j]] * expMu[t][j];
expInclusiveValue += var.num[t][j];
}
incv.w[t] = log(expInclusiveValue);
max_w = fmax(max_w, incv.w[t]);
min_w = fmin(min_w, incv.w[t]);
}
for (t=1; t<=n_period-1; t++){
incv.y[t] = incv.w[t+1];
incv.w_lag[t][1] = 1;
incv.w_lag[t][2] = incv.w[t];
}
// Estimate lambda in transition process of inclusive values
transpose(incv.w_lag, incv.w_lag_t, n_period-1, 2);
matmul(incv.w_lag_t, incv.w_lag, incv.ww, 2, n_period-1, 2);
matvecmul(incv.w_lag_t, incv.y, incv.wy, 2, n_period-1);
det = fabs(incv.ww[1][1]*incv.ww[2][2] - incv.ww[1][2]*incv.ww[2][1]);
incv.ww_inv[1][1] = incv.ww[2][2] / det;
incv.ww_inv[2][2] = incv.ww[1][1] / det;
incv.ww_inv[1][2] = incv.ww_inv[2][1] = -incv.ww[1][2] / det;
matvecmul(incv.ww_inv, incv.wy, incv.lambda, 2, 2); // make sure lambda works
matvecmul(incv.w_lag, incv.lambda, incv.wlambda, n_period-1, 2);
// Estimate variance of psi
incv.varPsi = 0;
for (n=1; n<=n_period-1; n++){
incv.varPsi += (incv.y[n] - incv.wlambda[n]) * (incv.y[n] - incv.wlambda[n]);
}
incv.varPsi /= n_period - 2;
// Set up grid space
max_w = max_w + 2.575829*sqrt(incv.varPsi);
min_w = min_w - 2.575829*sqrt(incv.varPsi);
for (s=1; s<=n_grid; s++){
incv.wGrid[s] = min_w + (s-1) * (max_w - min_w)/(n_grid-1);
}
}
void choicePath
(
//=======================================================
struct PRED &predOut,
struct VAR &var,
struct DIAG &diag
//=======================================================
)
{
int j, t;
double den;
// Initialize survivalRateard (var.survivalRate) at t=1 for all i
predOut.survivalRate[1] = 1;
// Compute predicted market share given deltaIn
for (t=1; t<=n_period; t++){
var.num[t][0] = exp(beta * var.value0[t]);
den = 0;
for (j=0; j<=n_product; j++){
den += var.num[t][j];
}
// Add choice prob * (1-survivalRateard) to predicted market share
if (isnan(den) || isinf(den)){
//printf("NaN den\n");
//printf("Num %d %.8f %.8f\n", 0, var.num[t][0], var.value0[t]);
//printf("beta: %.8f expValfun: %.8f\n", beta, var.value0[t]);
diag.exit = -1;
return;
}
for (j=1; j<=n_product; j++){
predOut.ms[t][j] += var.num[t][j] / den * predOut.survivalRate[t];
}
// Update the next-period survivalRateard
if (t < n_period){
predOut.survivalRate[t+1] = var.num[t][0] / den * predOut.survivalRate[t];
}
} // t loop
}
void initializeMu
(
//=======================================================
double ***expMuOut,
struct PAR &par,
struct RND &rnd,
struct VAR &var
//=======================================================
)
{
int i, j, k, t, id;
double mu;
for (i=1; i<=n_person; i++){
for (t=1; t<=n_period; t++){
for (j=1; j<=n_product; j++){
id = idx[t][j];
mu = 0;
for (k=1; k<=n_theta2; k++)
mu += par.theta2[k] * rnd.nu[i][k] * var.X[id][rcID[k]];
expMuOut[i][t][j] = exp(mu);
}
}
}
}
void initializeMui
(
//=======================================================
double **expMu,
double *nu,
struct PAR &par,
struct VAR &var
//=======================================================
)
{
int j, k, t, id;
double mu;
for (t=1; t<=n_period; t++){
for (j=1; j<=n_product; j++){
id = idx[t][j];
mu = 0;
for (k=1; k<=n_theta2; k++)
mu += par.theta2[k] * nu[k] * var.X[id][rcID[k]];
expMu[t][j] = exp(mu);
}
}
}
void transProb
(
//=======================================================
struct VAR &var,
struct INCV &incv
//=======================================================
)
{
int s0, s1;
double condMean, sumWeight;
for (s0=1; s0<=n_grid; s0++){
condMean = incv.lambda[1] + incv.lambda[2] * incv.wGrid[s0];
sumWeight = 0;
for (s1=1; s1<=n_grid; s1++){
var.weight[s1] = exp(-0.5*(incv.wGrid[s1]-condMean)*(incv.wGrid[s1]-condMean)/incv.varPsi);
sumWeight += var.weight[s1];
}
for (s1=1; s1<=n_grid; s1++){
var.weightMat[s0][s1] = var.weight[s1]/sumWeight;
}
}
}
void expectedValuefun
(
//=======================================================
double *expectValuefun,
double *valuefunIn,
double *weight,
struct INCV &incv
//=======================================================
)
{
int s1, t;
double
condMean, // conditional mean of next-period state given observed states
value0, // unweighted expected value function given observed states
sumWeight; // sum of transition prob weight
for (t=1; t<=n_period; t++){
// Compute conditional prob of state wGrid[s1] given state w_i[m][t]
condMean = incv.lambda[1] + incv.lambda[2] * incv.w[t];
sumWeight = 0;
for (s1=1; s1<=n_grid; s1++){
weight[s1] = exp(-0.5*(incv.wGrid[s1]-condMean)*(incv.wGrid[s1]-condMean)/incv.varPsi);
sumWeight += weight[s1];
}
// Compute expected value function
value0 = 0;
for (s1=1; s1<=n_grid; s1++){
value0 += weight[s1] * valuefunIn[s1];
}
expectValuefun[t] = value0 / sumWeight;
} // t loop
}
void bellmanOperator
(//=======================================================
double *valuefunOut,
double *valuefunIn,
struct VAR &var,
struct INCV &incv
//=======================================================
)
{
int s0, s1;
double value0;
for (s0=1; s0<=n_grid; s0++){
// value0: expected continuation value
value0 = 0;
for (s1=1; s1<=n_grid; s1++){
value0 += valuefunIn[s1] * var.weightMat[s0][s1];
}
value0 *= beta;
valuefunOut[s0] = log(1 + exp(incv.wGrid[s0] - value0)) + value0;
} // end of s0 loop
}
void nfpBellman
(//=======================================================
double *valuefunOut,
double *valuefunIn,
struct VAR &var,
struct DIAG &diag,
struct INCV &incv
//=======================================================
)
{
int s0, iter = 0;
double dist = DBL_MAX;
// Solve for exact value function
while (dist > var.tol_bellman && iter <= 5000){
bellmanOperator(valuefunOut, valuefunIn, var, incv);
dist = 0;
for (s0=1; s0<=n_grid; s0++){
dist = fmax(dist, fabs(valuefunIn[s0] - valuefunOut[s0]));
valuefunIn[s0] = valuefunOut[s0];
}
iter++;
diag.bellmanIter++;
}
}
int findNeighbor
(
//=======================================================
int &n_neighbor,
double **paramHistIn,
struct PAR &par
//=======================================================
)
{
int it, k, whichMin;
double diffAbs, dist, min_dist;
min_dist = DBL_MAX;
whichMin = 1;
// Find the nearest neighbor of par.theta2
for (it=1; it<=n_neighbor; it++){
dist = 0;
for (k=1; k<=n_theta2; k++){
diffAbs = par.theta2[k] - paramHistIn[it][k];
dist += diffAbs*diffAbs;
}
if (dist < min_dist){
whichMin = it;
min_dist = dist;
}
} // end of (it) loop
return whichMin;
}
void moveHistory
(
//=======================================================
int &imh,
int &vmh,
int &n_neighbor,
int &n_adjust
//=======================================================
)
{
int upperBound = 9 + imin(floor(pow(imh-n_adjust, power)), n_history-9);
vmh++;
if (vmh>n_neighbor){
(vmh<=upperBound) ? (n_neighbor=vmh):(vmh=1);
}
}
void moveHistory2
(
int &vmh,
int &n_neighbor
)
{
vmh++;
if (vmh > n_neighbor){
n_neighbor = imin(n_neighbor+1, n_history);
vmh = 1;
}
}
void computeMatrices
(
//=======================================================
double **invPHI,
double **XZPHIZXZ,
double **X,
double **Z,
double **Z_t
//=======================================================
)
{
int i, j;
double
**X_t,
**PHI,
**XZ,
**ZX,
**XZPHI,
**XZPHIZ,
**XZPHIZX,
**XZPHIZXinv;
X_t = dmatrix(1, n_theta1, 1, n_obs);
PHI = dmatrix(1, n_inst, 1, n_inst);
XZ = dmatrix(1, n_theta1, 1, n_inst);
ZX = dmatrix(1, n_inst, 1, n_theta1);
XZPHI = dmatrix(1, n_theta1, 1, n_inst);
XZPHIZ = dmatrix(1, n_theta1, 1, n_obs);
XZPHIZX = dmatrix(1, n_theta1, 1, n_theta1);
XZPHIZXinv = dmatrix(1, n_theta1, 1, n_theta1);
gsl_matrix
*gsl_invPHI = gsl_matrix_alloc(n_inst, n_inst),
*gsl_XZPHIZXinv = gsl_matrix_alloc(n_theta1, n_theta1);
// Compute 1st-stage GMM weight matrix
transpose(Z, Z_t, n_obs, n_inst);
matmul(Z_t, Z, PHI, n_inst, n_obs, n_inst); // PHI = Z'Z
for (i=1; i<=n_inst; i++){
for (j=1; j<=n_inst; j++){
gsl_matrix_set (gsl_invPHI, i-1, j-1, PHI[i][j]);
}
}
gsl_linalg_cholesky_decomp(gsl_invPHI);
gsl_linalg_cholesky_invert(gsl_invPHI);
for (i=1; i<=n_inst; i++){
for (j=1; j<=n_inst; j++){
invPHI[i][j] = gsl_matrix_get (gsl_invPHI, i-1, j-1);
}
}
transpose(X, X_t, n_obs, n_theta1);
matmul(X_t, Z, XZ, n_theta1, n_obs, n_inst); // XZ = X_t*Z = X'Z
transpose(XZ, ZX, n_theta1, n_inst); // ZX = (XZ)' = Z'X
matmul(XZ, invPHI, XZPHI, n_theta1, n_inst, n_inst); // XZPHI = (X'Z)inv(Z'Z)
matmul(XZPHI, ZX, XZPHIZX, n_theta1, n_inst, n_theta1); // XZPHIZX = (X'Z)inv(Z'Z)(Z'X)
for (i=1; i<=n_theta1; i++){
for (j=1; j<=n_theta1; j++){
gsl_matrix_set (gsl_XZPHIZXinv, i-1, j-1, XZPHIZX[i][j]);
}
}
gsl_linalg_cholesky_decomp(gsl_XZPHIZXinv);
gsl_linalg_cholesky_invert(gsl_XZPHIZXinv);
for (i=1; i<=n_theta1; i++){
for (j=1; j<=n_theta1; j++){
XZPHIZXinv[i][j] = gsl_matrix_get (gsl_XZPHIZXinv, i-1, j-1);
}
}
matmul(XZPHI, Z_t, XZPHIZ, n_theta1, n_inst, n_obs); // XZPHIZ = (X'Z)inv(Z'Z)Z'
// XZPHIZXZ = inv((X'Z)inv(Z'Z)(Z'X))(X'Z)inv(Z'Z)Z'
matmul(XZPHIZXinv, XZPHIZ, XZPHIZXZ, n_theta1, n_theta1, n_obs);
gsl_matrix_free (gsl_invPHI);
gsl_matrix_free (gsl_XZPHIZXinv);
free_dmatrix(X_t , 1, n_theta1, 1, n_obs);
free_dmatrix(PHI , 1, n_inst, 1, n_inst);
free_dmatrix(XZ , 1, n_theta1, 1, n_inst);
free_dmatrix(ZX , 1, n_inst, 1, n_theta1);
free_dmatrix(XZPHI , 1, n_theta1, 1, n_inst);
free_dmatrix(XZPHIZ , 1, n_theta1, 1, n_obs);
free_dmatrix(XZPHIZX , 1, n_theta1, 1, n_theta1);
free_dmatrix(XZPHIZXinv , 1, n_theta1, 1, n_theta1);
}
void printMCMC
(
//=======================================================
int &mc_id,
int &vmh,
int &imh,
int &seed,
int &accept,
int &neighborNew,
int &n_neighbor,
double &llh,
double &pllh,
struct PAR &par_a,
struct DIAG &diag,
FILE *fileout
//=======================================================
)
{
int k;
double llhAccept, llhReject;
llhAccept = (accept==1) ? llh:pllh;
llhReject = (accept==1) ? pllh:llh;
diag.toc = gettimeofday_sec();
fprintf(fileout, "%4d %7d %5d ", mc_id, imh+diag.nIterPrev,seed);
for (k=1; k<=n_theta2; k++)
fprintf(fileout, "%20.14f ", par_a.theta2[k]);
for (k=1; k<=n_theta1; k++)
fprintf(fileout, "%20.14f ", par_a.theta1[k]);
fprintf(fileout,"%16.8f %16.8f %4d %4d %4d %4d %8.3f ",
llhAccept,llhReject,diag.numReject,
vmh,neighborNew,n_neighbor,float(diag.cumulAccept)/imh);
fprintf(fileout,"%14.4f\n", diag.toc-diag.tic);
}
void mcmcDiag
(
char *filenameEstim,
int &imh,
int &mcID,
int &seed,
struct DIAG &diag,
struct POST &post,
RInside &R
)
{
int Jmax;
printf("\nMCID: %2d, Seed: %2d. MCMC diagnostics at mcmc: %6d\n",mcID,seed,imh);
R["mcmcDraws"] = createMatrix(post.theta, imh, n_theta);
R["thin"] = n_thin;
Rcpp::NumericVector M((SEXP) R.parseEval("h<- heidelberger(mcmcDraws,thin)"));
if (M[1]>=0){ // Zero indexing for matrix M!!!
diag.exit = 0;
diag.n_burnin = (M[0]-1)*n_thin;
}
else if (M[1]==-300){
diag.exit = -1;
printf("Exiting MCMC simulation due to no movement.");
}
else{
Jmax = fmin(heidel*diag.Jmax, n_mh);
diag.Jmax = (Jmax%10>0) ? imin(Jmax+(10-Jmax%10),n_mh) : Jmax;
}
}
void printOutput
(
char *filenameEstim,
int &imh,
int &mcID,
int &seed,
struct DIAG &diag,
struct POST &post
)
{
int k;
FILE * outp_stat;
posteriorMean(imh, diag, post);
outp_stat = fopen(filenameEstim, "a");
fprintf(outp_stat, "%4d %4d %4d %6d ", mcID,seed,diag.exit,imh+diag.nIterPrev);
for (k=1; k<=n_theta; k++)
fprintf(outp_stat, "%12.6f %12.6f ", post.mean[k], post.stderr[k]);
fprintf(outp_stat, "%12lld %14.4f\n", diag.bellmanIter, diag.toc-diag.tic);
fclose(outp_stat);
}
Rcpp::NumericMatrix createMatrix
(
double **param,
const int m,
const int n
)
{
Rcpp::NumericMatrix M(m,n);
for (int i=0; i<m; i++) {
for (int j=0; j<n; j++) {
M(i,j) = param[i+1][j+1];
}
}
return(M);
}
Rcpp::NumericMatrix createMatrix
(
double **param,
const int m1,
const int m2,
const int n
)
{
Rcpp::NumericMatrix M(m2-m1,n);
for (int i=0; i<m2-m1; i++) {
for (int j=0; j<n; j++) {
M(i,j) = param[i+1][j+1];
}
}
return(M);
}
void posteriorMean
(
int &imh,
struct DIAG &diag,
struct POST &post
)
{
int i, k;
if (diag.exit>=0){
for (k=1; k<=n_theta; k++){
post.mean[k] = 0;
i = diag.n_burnin + 1;
//for (i=diag.n_burnin+1; i<=imh; i++){
while (i<=imh){
post.mean[k] += post.theta[i][k];
i += n_thin;
}
post.mean[k] /= (imh-diag.n_burnin)/n_thin;
//post.mean[k] /= (double) (imh-diag.n_burnin);
post.stderr[k] = 0;
i = diag.n_burnin + 1;
while (i<=imh){
post.stderr[k] += (post.theta[i][k]-post.mean[k]) * (post.theta[i][k]-post.mean[k]);
i += n_thin;
}
post.stderr[k] = sqrt(post.stderr[k] / ((imh-diag.n_burnin)/n_thin-1));
//post.stderr[k] = sqrt(post.stderr[k] / (imh - diag.n_burnin - 1));
}
}
else if (diag.exit<0){
for (k=1; k<=n_theta; k++){
post.mean[k] = 0;
post.stderr[k] = 0;
}
}
}
void readData
(
int &mcID,
FILE* inpData,
struct VAR &var,
struct DATA &data
)
{
int j, k, t, id, imc, itime, iproduct, f=0;
for (t=1; t<=n_period; t++){
for (j=1; j<=n_product; j++){
id = idx[t][j];
f = fscanf(inpData, "%d %d %d", &imc, &itime, &iproduct);
f = fscanf(inpData, "%lf %lf %lf ", &data.ms[t][j], &data.ms[t][0], &data.xi[t][j]);
for (k=1; k<=n_theta1; k++)
f = fscanf(inpData, "%lf ", &var.X[id][k]);
for (k=1; k<=n_inst; k++)
f = fscanf(inpData, "%lf ", &var.Z[id][k]);
if (imc > mc_last || itime > n_period || iproduct > n_product || f==EOF){
error("Dimensions of data and estimation model do not match.");
}
}
}
}
void readRand
(
int &mcID,
FILE* inpRand,
struct RND rnd
)
{
int i, k, f=0;
for (i=1; i<=n_person; i++){
for (k=1; k<=n_theta2; k++)
f = fscanf(inpRand, "%lf ", &rnd.nu[i][k]);
}
if (f==EOF)
error("EOF error in readRand.");
}
void readSeed
(
double ***paramSeed,
char* filenameSeed
)
{
int i, k, s, f=0;
FILE* inpSeed;
inpSeed = fopen(filenameSeed,"r");
for (i=1; i<=n_mc; i++){
for (s=1; s<=n_seed; s++){
for (k=1; k<=n_theta2; k++){
f = fscanf(inpSeed, "%lf ", ¶mSeed[i][s][k]);
}
}
}
if (f==EOF)
error("EOF error in readSeed.");
fclose(inpSeed);
}
void initialize
(
int &mcID,
int &seed,
int &imh,
int &vmh,
int &n_neighbor,
int &neighborPast,
int &ptAccpt,
struct FXP &fxp,
struct PAR &par_a,
struct PAR &par_c,
struct VAR &var,
struct DATA &data,
struct DIAG &diag,
struct HIST &hist,
gsl_rng *rng
)
{
int i, j, k, t, s0;
computeMatrices(var.invPHI, var.XZPHIZXZ, var.X, var.Z, var.Z_t);
for (k=1; k<=n_theta2; k++){
hist.param[1][k] = par_c.theta2[k] = par_a.theta2[k] = hist.paramSeed[mcID][seed][k];
}
imh = 1;
vmh = 1;
n_neighbor = 10; // max until mcmc iteration reaches n_history
neighborPast = 1;
// Reset history
resetHistory(2, hist);
// Initialize BLP & Bellman fixed points
fxp.expDeltaIn = hist.expDelta[1]; // Assign pointers
fxp.valuefunIn = hist.valuefun[1]; // Assign pointers
for (i=1; i<=n_person; i++){
for (s0=1; s0<=n_grid; s0++){
fxp.valuefunIn[i][s0] = 0;
}
}
for (t=1; t<=n_period; t++){
for (j=1; j<=n_product; j++){
// fxp.expDeltaIn[idx[t][j]] = exp(data.delta[idx[t][j]]);
fxp.expDeltaIn[idx[t][j]] = data.ms[t][j] / data.ms[t][0];
}
}
diag.lipschitz = 0;
diag.lipschitzIter = 1;
diag.blpIter = 0;
diag.bellmanIter = 0;
diag.cumulAccept = 0;
hist.reset = 0;
hist.accept[vmh] = 1;
diag.maxReject = 10;
diag.numReject = 0;
diag.numRejectTotal = 0;
ptAccpt = 0;
diag.exit = 1;
diag.Jmax = 0.1*n_mh;
diag.nIterPrev = 0;
gsl_rng_set(rng, n_obs*1000+n_person*n_grid*100+mcID*10+seed);
}
void reinitialize
(
int &imh,
int &vmh,
int &n_neighbor,
int &neighborPast,
int &ptAccpt,
struct FXP &fxp,
struct PAR &par_a,
struct DIAG &diag,
struct HIST &hist
)
{
int k;
for (k=1; k<=n_theta2; k++){
hist.param[1][k] = par_a.theta2[k];
}
copyVector(hist.expDelta[neighborPast], hist.expDelta[1], n_obs);
copyMatrix(hist.valuefun[neighborPast], hist.valuefun[1], n_person,n_grid);
fxp.expDeltaIn = hist.expDelta[1]; // Assign pointers
fxp.valuefunIn = hist.valuefun[1]; // Assign pointers
diag.nIterPrev = imh;
imh = 0;
vmh = 1;
n_neighbor = 10; // max until mcmc iteration reaches n_history
neighborPast = 1;
// Reset history
resetHistory(2, hist);
diag.lipschitz = 0;
diag.lipschitzIter = 1;
diag.blpIter = 0;
diag.bellmanIter = 0;
diag.cumulAccept = 0;
hist.reset = 0;
hist.accept[vmh] = 1;
diag.maxReject = 10;
diag.numReject = 0;
diag.numRejectTotal = 0;
ptAccpt = 0;
diag.exit = 1;
diag.Jmax = 0.1*n_mh;
}
void resetHistory
(
int indx,
struct HIST &hist
)
{
int i, k, n, it, s0;
for (it=indx; it<=n_history; it++){
for (k=1; k<=n_theta2; k++)
hist.param[it][k] = DBL_MAX;
for (n=1; n<=n_obs; n++)
hist.expDelta[it][n] = 0;
for (i=1; i<=n_person; i++){
for (s0=1; s0<=n_grid; s0++)
hist.valuefun[it][i][s0] = 0;
}
}
}
void resetHistParam
(
int idFirst,
int idLast,
struct HIST &hist
)
{
int k, it;
for (it=idFirst; it<=idLast; it++){
for (k=1; k<=n_theta2; k++)
hist.param[it][k] = DBL_MAX;
}
}
void memoryAllocate
(
double **jump,
struct FXP &fxp,
struct PAR &par_c,
struct PAR &par_a,
struct RND &rnd,
struct VAR &var,
struct DATA &data,
struct HIST &hist,
struct INCV &incv,
struct POST &post,
struct PRED &pred
)
{
idx = imatrix(1, n_period, 1, n_product);
*jump = dvector(1, n_theta2);
hist.accept = ivector(1, n_history);
hist.paramIn = dvector(1, n_param);
hist.paramSeed = darray3d(1, n_mc, 1, n_seed, 1, n_theta2);
hist.param = dmatrix(1, n_history, 1, n_theta2);
hist.expDelta = dmatrix(1, n_history, 1, n_obs);
hist.valuefun = darray3d(1, n_history, 1, n_person, 1, n_grid);
fxp.expDeltaOut = dvector(1, n_obs);
fxp.valuefunOut = dmatrix(1, n_person, 1, n_grid);
par_c.theta1 = dvector(1, n_theta1);
par_c.theta2 = dvector(1, n_theta2);
par_a.theta1 = dvector(1, n_theta1);
par_a.theta2 = dvector(1, n_theta2);
rnd.nu = dmatrix(1, n_person, 1, n_theta2);
var.util = dvector(1, n_product);
var.num = dmatrix(1, n_period, 0, n_product);
var.expMu0 = darray3d(1, n_person, 1, n_period, 1, n_product);
var.expMu1 = darray3d(1, n_person, 1, n_period, 1, n_product);
var.value0 = dvector (1, n_period);
var.X = dmatrix(1, n_obs, 1, n_theta1);
var.Z = dmatrix(1, n_obs, 1, n_inst);
var.Z_t = dmatrix(1, n_inst, 1, n_obs);
var.invPHI = dmatrix(1, n_inst, 1, n_inst);
var.XZPHIZXZ = dmatrix(1, n_theta1, 1, n_obs);
var.Xtheta1 = dvector(1, n_obs);
var.delta = dvector(1, n_obs);
var.e = dvector(1, n_obs);
var.Ze = dvector(1, n_inst);
var.PHIZe = dvector(1, n_inst);
var.weight = dvector(1, n_grid);
var.weightMat = dmatrix(1, n_grid, 1, n_grid);
data.ms = dmatrix(1, n_period, 0, n_product);
data.xi = dmatrix(1, n_period, 1, n_product);
data.delta = dvector(1, n_obs);
incv.w = dvector(1, n_period),
incv.wGrid = dvector(1, n_grid),
incv.lambda = dvector(1, 2);
incv.y = dvector(1, n_period - 1);
incv.wy = dvector(1, 2);
incv.wlambda = dvector(1, n_period - 1);
incv.w_lag = dmatrix(1, n_period - 1, 1, 2);
incv.w_lag_t = dmatrix(1, 2, 1, n_period - 1);
incv.ww = dmatrix(1, 2, 1, 2);
incv.ww_inv = dmatrix(1, 2, 1, 2);
post.mean = dvector(1, n_theta);
post.stderr = dvector(1, n_theta);
post.theta = dmatrix(1, n_mh, 1, n_theta);
pred.ms = dmatrix(1, n_period, 1, n_product);
pred.survivalRate = dvector(1, n_period);
}
void memoryDeallocate
(
double **jump,
struct FXP &fxp,
struct PAR &par_c,
struct PAR &par_a,
struct RND &rnd,
struct VAR &var,
struct DATA &data,
struct HIST &hist,
struct INCV &incv,
struct POST &post,
struct PRED &pred
)
{
free_imatrix(idx, 1, n_period, 1, n_product);
free_dvector(*jump, 1, n_theta2);
free_dvector(fxp.expDeltaOut, 1, n_obs);
free_dmatrix(fxp.valuefunOut, 1, n_person, 1, n_grid);
free_dvector(par_c.theta1, 1, n_theta1);
free_dvector(par_c.theta2, 1, n_theta2);
free_dvector(par_a.theta1, 1, n_theta1);
free_dvector(par_a.theta2, 1, n_theta2);
free_dmatrix(rnd.nu, 1, n_person, 1, n_theta2);
free_dvector(var.util, 1, n_product);
free_dmatrix(var.num, 1, n_period, 0, n_product);
free_darray3d(var.expMu0, 1, n_person, 1, n_period, 1, n_product);
free_darray3d(var.expMu1, 1, n_person, 1, n_period, 1, n_product);
free_dvector(var.value0, 1, n_period);
free_dmatrix(var.X, 1, n_obs, 1, n_theta1);
free_dmatrix(var.Z, 1, n_obs, 1, n_inst);
free_dmatrix(var.Z_t, 1, n_inst, 1, n_obs);
free_dmatrix(var.invPHI, 1, n_inst, 1, n_inst);
free_dmatrix(var.XZPHIZXZ, 1, n_theta1, 1, n_obs);
free_dvector(var.Xtheta1, 1, n_obs);
free_dvector(var.delta, 1, n_obs);
free_dvector(var.e, 1, n_obs);
free_dvector(var.Ze, 1, n_inst);
free_dvector(var.PHIZe, 1, n_inst);
free_dvector(var.weight, 1, n_grid);
free_dmatrix(var.weightMat, 1, n_grid, 1, n_grid);
free_dmatrix(data.ms, 1, n_period, 0, n_product);
free_dmatrix(data.xi, 1, n_period, 1, n_product);
free_dvector(data.delta, 1, n_obs);
free_ivector(hist.accept, 1, n_history);
free_dvector(hist.paramIn, 1, n_param);
free_darray3d(hist.paramSeed, 1, n_mc, 1, n_seed, 1, n_theta2);
free_dmatrix(hist.param, 1, n_history, 1, n_theta2);
free_dmatrix(hist.expDelta, 1, n_history, 1, n_obs);
free_darray3d(hist.valuefun, 1, n_history, 1, n_person, 1, n_grid);
free_dvector(incv.w, 1, n_period);
free_dvector(incv.wGrid, 1, n_grid);
free_dvector(incv.lambda, 1, 2);
free_dvector(incv.y, 1, n_period - 1);
free_dvector(incv.wy, 1, 2);
free_dvector(incv.wlambda, 1, n_period - 1);
free_dmatrix(incv.w_lag, 1, n_period - 1, 1, 2);
free_dmatrix(incv.w_lag_t, 1, 2, 1, n_period - 1);
free_dmatrix(incv.ww, 1, 2, 1, 2);
free_dmatrix(incv.ww_inv, 1, 2, 1, 2);
free_dvector(post.mean, 1, n_theta);
free_dvector(post.stderr, 1, n_theta);
free_dmatrix(post.theta, 1, n_mh, 1, n_theta);
free_dmatrix(pred.ms, 1, n_period, 1, n_product);
free_dvector(pred.survivalRate, 1, n_period);
}
| yutec/LTE | PFP/functions.cpp | C++ | mit | 26,427 |
class CreateSettings < ActiveRecord::Migration
def change
create_table :settings do |t|
t.string :type, :null => false
t.string :value
t.timestamps
end
add_index :settings, :type, :unique => true
end
end
| stuyspec/newspec | db/migrate/20141222183622_create_settings.rb | Ruby | mit | 240 |
#!/usr/bin/env python
import obd_io
import serial
import platform
import obd_sensors
from datetime import datetime
import time
from obd_utils import scanSerial
class OBD_Capture():
def __init__(self):
self.supportedSensorList = []
self.port = None
localtime = time.localtime(time.time())
def connect(self):
portnames = scanSerial()
print portnames
for port in portnames:
self.port = obd_io.OBDPort(port, None, 2, 2)
if(self.port.State == 0):
self.port.close()
self.port = None
else:
break
if(self.port):
print "Connected to "+self.port.port.name
def is_connected(self):
return self.port
def getSupportedSensorList(self):
return self.supportedSensorList
def capture_data(self):
text = ""
#Find supported sensors - by getting PIDs from OBD
# its a string of binary 01010101010101
# 1 means the sensor is supported
self.supp = self.port.sensor(0)[1]
self.supportedSensorList = []
self.unsupportedSensorList = []
# loop through PIDs binary
for i in range(0, len(self.supp)):
if self.supp[i] == "1":
# store index of sensor and sensor object
self.supportedSensorList.append([i+1, obd_sensors.SENSORS[i+1]])
else:
self.unsupportedSensorList.append([i+1, obd_sensors.SENSORS[i+1]])
for supportedSensor in self.supportedSensorList:
text += "supported sensor index = " + str(supportedSensor[0]) + " " + str(supportedSensor[1].shortname) + "\n"
time.sleep(3)
if(self.port is None):
return None
#Loop until Ctrl C is pressed
localtime = datetime.now()
current_time = str(localtime.hour)+":"+str(localtime.minute)+":"+str(localtime.second)+"."+str(localtime.microsecond)
#log_string = current_time + "\n"
text = current_time + "\n"
results = {}
for supportedSensor in self.supportedSensorList:
sensorIndex = supportedSensor[0]
(name, value, unit) = self.port.sensor(sensorIndex)
text += name + " = " + str(value) + " " + str(unit) + "\n"
results[obd_sensors.SENSORS[sensorIndex].shortname] = str(value)+" "+str(unit);
self.allSensorData = results
return text
if __name__ == "__main__":
o = OBD_Capture()
o.connect()
time.sleep(3)
if not o.is_connected():
print "Not connected"
else:
o.capture_data()
| iclwy524/asuradaProject | sensor/pyobd/obd_capture.py | Python | mit | 2,641 |
require File.dirname(__FILE__) + '/test_helper.rb'
require File.dirname(__FILE__) + '/../lib/app/helpers/rorext_helper.rb'
include RorextHelper
class RorextHelperTest < Test::Unit::TestCase
def test_tweet
assert_equal "Tweet! Hello", tweet("Hello")
end
end | ssassi/rorext | test/rorext_helper_test.rb | Ruby | mit | 265 |
<?php
namespace Tests\Controllers;
use App\User;
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Tests\TestCase;
class DosageControllerTest extends TestCase {
// use DatabaseTransactions;
public function testViewDosages() {
$user = User::first();
$this->actingAs($user)
->visit('drugs/dosages')
->see("Dosages")
->see("Dosage Frequencies")
->see("Dosage Periods");
}
public function testAddDosage() {
$user = User::first();
$this->actingAs($user)
->call('POST', 'drugs/addDosage', ['dosageDescription' => 'Some Description']);
$this->assertSessionHas('success', "Dosage added successfully !");
$this->actingAs($user)
->call('POST', 'drugs/addDosage', ['dosageDescription' => 'Some Description']);
$this->assertSessionHas('errors');
}
public function testAddFrequency() {
$user = User::first();
$this->actingAs($user)
->call('POST', 'drugs/addFrequency', ['frequencyDescription' => 'Some Description']);
$this->assertSessionHas('success', "Dosage Frequency added successfully !");
$this->actingAs($user)
->call('POST', 'drugs/addFrequency', ['frequencyDescription' => 'Some Description']);
$this->assertSessionHas('errors');
}
public function testAddPeriod() {
$user = User::first();
$this->actingAs($user)
->call('POST', 'drugs/addPeriod', ['description' => 'Some Description']);
$this->assertSessionHas('success', "Dosage Period added successfully !");
$this->actingAs($user)
->call('POST', 'drugs/addPeriod', ['description' => 'Some Description']);
$this->assertSessionHas('errors');
}
public function testDeleteDosage() {
$user = User::where('role_id', 1)->first();
$dosage = $user->clinic->dosages()->where('description', 'Some Description')->first();
$this->actingAs($user)
->call('GET', 'drugs/deleteDosage/' . $dosage->id);
$this->assertSessionHas('success', 'Entry deleted successfully');
}
public function testDeleteFrequency() {
$user = User::where('role_id', 1)->first();
$dosage = $user->clinic->dosageFrequencies()->where('description', 'Some Description')->first();
$this->actingAs($user)
->call('GET', 'drugs/deleteFrequency/' . $dosage->id);
$this->assertSessionHas('success', 'Entry deleted successfully');
}
public function testDeletePeriod() {
$user = User::where('role_id', 1)->first();
$dosage = $user->clinic->dosagePeriods()->where('description', 'Some Description')->first();
$this->actingAs($user)
->call('GET', 'drugs/deletePeriod/' . $dosage->id);
$this->assertSessionHas('success', 'Entry deleted successfully');
}
}
| chr24x7/chr247.com | tests/controllers/DosageControllerTest.php | PHP | mit | 3,029 |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("4MultiplicationSign")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Toshiba")]
[assembly: AssemblyProduct("4MultiplicationSign")]
[assembly: AssemblyCopyright("Copyright © Toshiba 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("30d061e9-44b5-4b05-bcce-b5e8aaff1395")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| GoranGit/CSharp-Part-I | Homework/Conditional-Statements/4MultiplicationSign/Properties/AssemblyInfo.cs | C# | mit | 1,428 |
Monologue::Engine.routes.draw do
root to: "posts#index"
get "/page/:page", to: "posts#index", as: "posts_page"
get "/feed" => "posts#feed", as: "feed", defaults: {format: :rss}
get "/tags/:tag" =>"tags#show", as: "tags_page"
namespace :admin, path: "monologue" do
get "/" => "posts#index", as: "" # responds to admin_url and admin_path
get "logout" => "sessions#destroy"
get "login" => "sessions#new"
resources :sessions
resources :posts do
collection do
get :suggest_slug
end
end
resources :categories
resources :users
get "comments" => "comments#show", as: "comments"
match "/post/preview"=>"posts#preview", :as=>"post_preview", :via => [:put, :post]
end
get "*post_url" => "posts#show", as: "post"
end
| tam-vo/monologue | config/routes.rb | Ruby | mit | 789 |
const renderWay = require('../renderWay');
const way = require('senseway');
module.exports = (model, dispatch) => {
// Trim context to history size
const context = way.last(model.history, model.contextDistance);
return renderWay(context, {
label: 'context',
numbers: true,
numbersBegin: model.history[0].length - model.contextDistance
});
};
| axelpale/lately | example/drummer/src/contextViewer/render.js | JavaScript | mit | 364 |
package org.vizzini.example.boardgame.reversi;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.vizzini.core.game.Action;
import org.vizzini.core.game.Adjudicator;
import org.vizzini.core.game.Agent;
import org.vizzini.core.game.Environment;
/**
* Provides a medium implementation of a computer agent for reversi.
*/
public final class MediumAgent implements Agent
{
/** Action generator. */
private final ReversiActionGenerator actionGenerator;
/** Name. */
private final String name;
/** Team. */
private final ReversiTeam team;
/**
* Construct this object.
*
* @param name Name.
* @param team Team.
* @param actionGenerator Action generator.
*/
@SuppressWarnings("hiding")
public MediumAgent(final String name, final ReversiTeam team, final ReversiActionGenerator actionGenerator)
{
if (StringUtils.isEmpty(name))
{
throw new IllegalArgumentException("name is null or empty");
}
if (team == null)
{
throw new IllegalArgumentException("team is null");
}
if (actionGenerator == null)
{
throw new IllegalArgumentException("actionGenerator is null");
}
this.name = name;
this.team = team;
this.actionGenerator = actionGenerator;
}
@Override
public boolean equals(final Object object)
{
boolean answer = false;
if (object == this)
{
answer = true;
}
else if (object == null)
{
answer = false;
}
else if (getClass() != object.getClass())
{
answer = false;
}
else
{
final MediumAgent another = (MediumAgent)object;
answer = name.equals(another.name);
if (answer)
{
answer = team.equals(another.team);
}
}
return answer;
}
@Override
public ReversiAction getAction(final Environment environment, final Adjudicator adjudicator)
{
ReversiAction answer = null;
final ReversiEnvironment rEnvironment = (ReversiEnvironment)environment;
final ReversiAdjudicator rAdjudicator = (ReversiAdjudicator)adjudicator;
final List<Action> actions = actionGenerator.generateActions(rEnvironment, rAdjudicator, this);
if (CollectionUtils.isNotEmpty(actions))
{
// First, look for a corner.
final List<Action> corners = filterCorners(actions);
answer = selectAction(corners);
if (answer == null)
{
// Next, look for a side.
final List<Action> sides = filterSides(actions);
answer = selectAction(sides);
}
if (answer == null)
{
// Randomly pick an action.
answer = selectAction(actions);
}
}
return answer;
}
@Override
public String getDescription()
{
return "This agent plays on a corner, a side, or a random open position.";
}
@Override
public String getName()
{
return name;
}
@Override
public ReversiTeam getTeam()
{
return team;
}
@Override
public int hashCode()
{
int answer = 0;
final int[] primes = { 2, 3, };
int i = 0;
answer += primes[i++] * name.hashCode();
answer += primes[i++] * team.hashCode();
return answer;
}
@Override
public void postProcessGame(final Agent winner)
{
// Nothing to do.
}
@Override
public String toString()
{
final ToStringBuilder builder = new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE);
builder.append("name", getName());
builder.append("team", getTeam());
return builder.toString();
}
/**
* @param actions Actions.
*
* @return a new list of corners.
*/
private List<Action> filterCorners(final List<Action> actions)
{
final List<Action> answer = new ArrayList<Action>();
for (final Action action : actions)
{
final ReversiAction rAction = (ReversiAction)action;
if (rAction.getPosition().isCorner())
{
answer.add(rAction);
}
}
return answer;
}
/**
* @param actions Actions.
*
* @return a new list of sides.
*/
private List<Action> filterSides(final List<Action> actions)
{
final List<Action> answer = new ArrayList<Action>();
for (final Action action : actions)
{
final ReversiAction rAction = (ReversiAction)action;
if (rAction.getPosition().isSide())
{
answer.add(rAction);
}
}
return answer;
}
/**
* @param actions Actions.
*
* @return a randomly selected action.
*/
private ReversiAction selectAction(final List<Action> actions)
{
ReversiAction answer = null;
if (CollectionUtils.isNotEmpty(actions))
{
if (actions.size() == 1)
{
answer = (ReversiAction)actions.get(0);
}
else
{
// Randomly pick an action.
final int size = actions.size();
final int index = (int)(size * Math.random());
answer = (ReversiAction)actions.get(index);
}
}
return answer;
}
}
| jmthompson2015/vizzini | example/src/main/java/org/vizzini/example/boardgame/reversi/MediumAgent.java | Java | mit | 5,887 |
export function backToTop() {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
} | dukeofharen/wolk | ui/src/utilities/windowHelper.ts | TypeScript | mit | 108 |
<?php
namespace spec\PhpGuard\Listen\Resource;
use PhpGuard\Listen\Resource\ResourceInterface;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
class TrackedObjectSpec extends ObjectBehavior
{
function it_is_initializable()
{
$this->shouldHaveType('PhpGuard\Listen\Resource\TrackedObject');
}
function its_id_should_be_mutable()
{
$this->setID('any')->shouldReturn($this);
$this->getID()->shouldReturn('any');
}
function its_resource_should_be_mutable(ResourceInterface $resource)
{
$this->setResource($resource);
$this->getResource()->shouldReturn($resource);
}
function its_checksum_should_be_mutable()
{
$this->setChecksum('any')->shouldReturn($this);
$this->getChecksum()->shouldReturn('any');
}
} | phpguard/listen | spec/PhpGuard/Listen/Resource/TrackedObjectSpec.php | PHP | mit | 813 |
'use strict';
const passport = require('passport');
const BearerStrategy = require('passport-http-bearer').Strategy;
const ClientPasswordStrategy = require('passport-oauth2-client-password').Strategy;
const moment = require('moment');
const OauthClient = require('../src/models/oauth-client');
const Token = require('../src/models/token');
const User = require('../src/models/user');
passport.use(new BearerStrategy(
(token, done) => {
Token.where({ token, type: 'access_token' })
.where('expires_in', '>', moment().toDate())
.fetch({ withRelated: ['user'] }).then((token, err) => {
if (err) return done(err);
if (!token) return done(null, false);
return done(null, token.toJSON().user, { scope: 'all' });
});
}
));
passport.use(new ClientPasswordStrategy(
(clientId, clientSecret, done) => {
OauthClient.where({ client_id: clientId }).fetch()
.then((oauthClient, err) => {
if (err) return done(err);
if (!oauthClient) { return done({ message: 'Wrong client.' }, false); }
if (oauthClient.get('client_secret') != clientSecret) { return done(null, false); }
return done(null, oauthClient);
});
}
));
| kvnbai/revtrial | expressbookshelftrial/lib/passport.js | JavaScript | mit | 1,181 |
package fr.estela.piframe.backend.route;
import java.util.Map;
import org.apache.camel.Properties;
import org.springframework.stereotype.Component;
@Component
public class PaginatedDownloadRouter {
public String route(@Properties Map<String, Object> properties) {
PaginatedDownloadConfig paginatedDownloadConfig = (PaginatedDownloadConfig) properties.get("paginatedDownloadConfig");
if (paginatedDownloadConfig != null && paginatedDownloadConfig.isLastPageDownloaded()) {
return null;
}
else {
String providerRouteId = (String) properties.get("providerRouteId");
return providerRouteId;
}
}
} | alex-estela/piframe | src/main/java/fr/estela/piframe/backend/route/PaginatedDownloadRouter.java | Java | mit | 645 |
/**
*
* User: lin
* Date: 13-11-28
* Time: 下午10:34
*
*/
var burnrate = window.burnrate = {
type_card: { employee: 'employee', skill:'skill'},
title: { Engineer: 'Engineer', Manager:'Manager', vp: 'Vice President',
Contractor: 'Contractor'},
skill_type: { department: 'department', title: 'title'},
department: { hr: 'human resource', sales:'sales', development: 'development',
finance: 'finance'},
target_type: {'self':'self', 'other one':'other one'},
ability: { _0: 0, _1: 1,_2: 2, _3: 3},
burn: { _1: 1, _2: 2, _3 : 3},
project_level:{ _1: 1, _2: 2, _3 : 3, _4 : 4},
money_funding:{ _5: 5, _10: 10, _15: 15, _20: 20},
vp_num: { _0: 0, _2: 2, _3: 3},
game: {},
init: function(){
initEmployees();
initPlayers();
initSkills();
}
};
/**
* support zh_cn
*/
(function lang_zh(burnrate){
_.extend(burnrate, {
title_ZH_CN: { Engineer: '工程师', Manager:'经理', vp: '副总裁', Contractor: '外包工程师'},
department_ZH_CN: { hr: '人力资源部', sales:'市场部', development: '研发部',finance: '融资部'},
getTitle_ZH_CN: function (title){
return burnrate.title_ZH_CN[getKey(burnrate.title, title)] || '';
},
getDepartment_ZH_CN: function (department){
return burnrate.department_ZH_CN[getKey(burnrate.department, department)] || '';
}
})
})(burnrate);
function Game(){
this.players = [];
this.employeeCards = [];
this.skillCards = [];
this.addPlayer = function(player){
this.players.push(player);
}
}
function Project(proejctId, project_level){
this.proejctId = proejctId;
this.project_level = project_level;
}
function Player(id, name, money){
this.id = id;
this.name = name;
this.money = money;
this.projects = [];
this.employees = [];
this.firing = false;//firing doubles cost
//Todo: should not count every time, change to add/min it when employee/fire
this.getDepartmentAbility = function (department){
//default ability = zero;
var ability = burnrate.ability._0;
_.each(this.employees, function(){
var employee = this;
if(employee.department == department){
//vp's ability = department's ability,ignore managers
if(employee.title == burnrate.title.vp){
ability = employee.ability;
}else{
ability = _.max(employee.ability, ability);
}
}
});
return ability;
}
this.getVPNum = function(){
var vp_num = 0;
_.each(this.employees, function(){
var employee = this;
if(employee.department == department){
if(employee.title == burnrate.title.vp){
vp_num++;
}
}
});
return vp_num;
}
this.employ = function(anEmployee){
this.employees.push(anEmployee);
}
this.fire = function(anEmployee){
this.employees = _.without(this.employees, anEmployee);
}
this.badIdea = function(project){
this.projects.push(project);
}
this.release = function(project){
this.projects = _.without(this.projects, project);
}
}
function initPlayers(){
}
function Employee(department, ability, title, burn){
this.department = department;
this.ability = ability;
this.title = title;
this.burn = burn;
this.toString = function (){
var string = [];
string.push('department' + ':' + this.department);
string.push('title' + ':' + this.title);
string.push('ability' + ':' + this.ability);
string.push('burn' + ':' + this.burn);
return '[An Employee:{' + string + '}]';
}
}
function initEmployees(){
var employees = burnrate.employees = {};
//(vp + manager) in every department
var abilities = [burnrate.ability._1, burnrate.ability._1, burnrate.ability._2];
var burns = [burnrate.burn._1, burnrate.burn._1, burnrate.burn._2];
for(var department in burnrate.department){
var c_e_d = employees[burnrate.department[department]] = [];
//vp br:2 + abi:3
c_e_d.push(new Employee(burnrate.department[department],
burnrate.ability._3, burnrate.title.vp,burnrate.burn._2));
//vp br:2 + abi:2
c_e_d.push(new Employee(burnrate.department[department],
burnrate.ability._2, burnrate.title.vp,burnrate.burn._2));
c_e_d.push(new Employee(burnrate.department[department],
burnrate.ability._2, burnrate.title.vp,burnrate.burn._2));
//vp br:2 + abi:0
c_e_d.push(new Employee(burnrate.department[department],
burnrate.ability._0, burnrate.title.vp,burnrate.burn._2));
_.times(10,function(){
//manager br:random[1, 2] + abi:random[1, 2]
c_e_d.push(new Employee(burnrate.department[department],
abilities[_.random(0,abilities.length)], burnrate.title.Manager,
burns[_.random(0,burns.length)]));
});
}
//Engineer * 15, br:1 + abi:''
_.times(15,function(){
employees[burnrate.department.development].push(new Employee(burnrate.department[department],
'', burnrate.title.Engineer, burnrate.burn._1));
});
//Contractor * 15, br:3 + abi:''
_.times(15,function(){
employees[burnrate.department.development].push(new Employee('',
'', burnrate.title.Contractor, burnrate.burn._3));
});
}
function Skill(name, department, ability, vp_num, skill_type, target_type, affect, note){
this.name = name;
this.department = department;
this.ability = ability;
this.vp_num = vp_num;
this.affect = affect;
this.note = note;
this.skill_type = skill_type;
this.target_type = target_type;
//Todo:should change to a vari [condition]
this.canAffect = function(self, target){
target = (this.target_type == burnrate.target_type.self) ? self : target;
if(target_type == burnrate.skill_type.department){
return target.getDepartmentAbility(department) >= this.ability;
}else{
return target.getVPNum() >= this.vp_num;
}
}
}
function initSkills(){
var skills = [];
var bad_idea = new BadIdea(burnrate.ability._2, burnrate.project_level._3);
}
function test(){
var bad_idea = new BadIdea(burnrate.ability._2, burnrate.project_level._3);
var player1 = new Player('player 1', 'me', 100);
var player2 = new Player('player 2', 'u', 100);
bad_idea.affect(player2)
var release = new Release(burnrate.ability._2);
log(a = new Release(2))
log(release.canAffect(player2, player2));
release.affect(player2, player2.projects[0]);
log(player2);
}
function BadIdea(ability, level){
burnrate.projectId = 100;
var affect = function(target){
var project = new Project(burnrate.projectId++, level);
target.badIdea(project);
};
BadIdea.prototype = new Skill('Bad Idea', burnrate.department.sales, ability,
burnrate.vp_num._0, burnrate.skill_type.department, burnrate.target_type.other_one,
affect,'');
}
function Release(ability){
var affect = function(target, project){
target.release(project);
};
Release.prototype = new Skill('Release', burnrate.department.development, ability,
burnrate.vp_num._0, burnrate.skill_type.department, burnrate.target_type.self,
affect,'');
}
//hr:网罗,雇错人,雇佣,解雇
//develop:终止
//finance: +5 +10 +15 +20
//market:馊主意
//other:大裁员,解甲归田
$(function(){
burnrate.init();
var $card_border = $(".card-border").remove();
var colors = {};
colors[burnrate.department.development] = 'color-develop';
colors[burnrate.department.hr] = 'color-hr';
colors[burnrate.department.finance] = 'color-finance';
colors[burnrate.department.sales] = 'color-sales';
colors['contractor'] = 'color-contractor';
var names = ['Bill Gates', 'Hans Weich', 'Brad Duke'];//Todo : more names
var employees = burnrate.employees;
_.each(employees, function(employees_dep, department){
var department_ZH_CN = burnrate.getDepartment_ZH_CN(department);
var color = colors[department];
var title_vp = burnrate.title.vp;
var title_engineer = burnrate.title.Engineer;
var title_outsource = burnrate.title.Contractor;
_.each(employees_dep,function(employee){
var ability = employee.ability;
var title = employee.title;
var title_ZH_CN = burnrate.getTitle_ZH_CN(title);
var sign_vp = (title == title_vp) ? 'vp' : '';
var burn_num = employee.burn;
var name_employee = names[_.random(names.length)];
var $employeeCard = $card_border.clone()
.find(".card").addClass(color).end()
.find(".circle").addClass(color + '-light')
.addClass('border-' + color).html(ability).end()
.find(".department-en").html(department).end() //.toLocaleUpperCase()
.find(".department-zh").html(department_ZH_CN).end()
.find(".vp").html(sign_vp).end()
.find(".title-en").html(title).end()
.find(".title-zh").html(title_ZH_CN).end()
//.find(".pic").end() TODO: change pic
.find(".name-employee").html(name_employee).end()
.find(".burn-num").html(burn_num).end();
if(title == title_engineer){
$employeeCard.find(".circle").hide();
}else if(title == title_outsource){
$employeeCard.find(".circle").hide();
$employeeCard.find(".card").removeClass(color).addClass(colors['contractor']);
}
$(document.body).append($employeeCard);
});
});
});
| codetilldie/burnrate | frontend/js/burnrate.js | JavaScript | mit | 10,116 |
<?php
/**
* This file is part of the Spryker Demoshop.
* For full license information, please view the LICENSE file that was distributed with this source code.
*/
namespace Orm\Zed\CustomerAccess\Persistence;
use Spryker\Zed\CustomerAccess\Persistence\Propel\AbstractSpyUnauthenticatedCustomerAccess;
/**
* Skeleton subclass for representing a row from the 'spy_unauthenticated_customer_access' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*/
class SpyUnauthenticatedCustomerAccess extends AbstractSpyUnauthenticatedCustomerAccess
{
}
| spryker/demoshop | src/Orm/Zed/CustomerAccess/Persistence/SpyUnauthenticatedCustomerAccess.php | PHP | mit | 706 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DevFramework.Core.CrossCuttingConcerns.Logging
{
public class LogParameter
{
public string Name { get; set; }
public string Type { get; set; }
public object Value { get; set; }
}
}
| canozaytekin1993/DevFramework | DevFramework.Core/CrossCuttingConcerns/Logging/LogParameter.cs | C# | mit | 347 |
import logger from "@/logger";
import { Howl } from "howler";
export default class BgmPlayer {
public static instance_: BgmPlayer;
public static get instance(): BgmPlayer {
if (!this.instance_) {
this.instance_ = new BgmPlayer();
}
return this.instance_;
}
constructor() {
document.addEventListener("pause", () => {
logger.log("[BgmPlayer] pause", this.audioPlaying.playing());
if (this.audioPlaying) {
this.audioPlaying.pause();
}
if (this.audioFading) {
this.audioFading.stop();
}
});
document.addEventListener("resume", () => {
logger.log("[BgmPlayer] resume", this.audioPlaying.playing());
if (this.audioPlaying && !this.audioPlaying.playing()) {
this.audioPlaying.play();
}
});
}
public volume = 0.8;
private audioPlaying: Howl;
private audioFading: Howl;
private static playAudio(src: Array<string>, volume = 1.0): Howl {
const audio = new Howl({
src,
loop: true,
autoplay: true,
volume: 0,
});
audio.fade(0.0, volume, 0);
return audio;
}
public play(src: Array<string>): void {
this.fadeOut();
this.audioPlaying = BgmPlayer.playAudio(src, this.volume);
}
private fadeOut(): void {
this.audioFading = this.audioPlaying;
this.audioPlaying = undefined;
if (this.audioFading && this.audioFading.playing()) {
this.audioFading.fade(this.audioFading.volume(), 0.0, 800);
this.audioFading.once("fade", () => {
this.audioFading.stop();
this.audioFading = undefined;
});
}
}
}
| fubira/cordova-phaser-typescript-template | src/utils/BgmPlayer.ts | TypeScript | mit | 1,614 |
require.ensure([], function(require) {
require("./91.async.js");
require("./183.async.js");
require("./367.async.js");
require("./733.async.js");
});
module.exports = 734; | skeiter9/javascript-para-todo_demo | webapp/node_modules/webpack/benchmark/fixtures/734.async.js | JavaScript | mit | 171 |
// https://leetcode-cn.com/problems/max-area-of-island/
/**
* @param {number[][]} grid
* @return {number}
*/
var maxAreaOfIsland = function(grid) {
let res = 0;
for(let i = 0; i < grid.length; i++) {
const row = grid[i];
for (let j = 0; j < row.length; j++) {
const visitedArr = initVisitedArr(grid);
const temp = dfs(i, j, visitedArr, grid, 0);
res = Math.max(res, temp);
}
}
return res;
};
console.log(maxAreaOfIsland([[1,1,0,0,0],[1,1,0,0,0],[0,0,0,1,1],[0,0,0,1,1]]));
function dfs(i, j, visitedArr, grid, length) {
if ((i >= 0 && j >=0 && i < grid.length && j < grid[0].length) && !visitedArr[i][j] && grid[i][j]) {
visitedArr[i][j] = 1;
length++;
length += dfs(i, j - 1, visitedArr, grid, 0);
length += dfs(i + 1, j, visitedArr, grid, 0);
length += dfs(i, j + 1, visitedArr, grid, 0);
length += dfs(i - 1, j, visitedArr, grid, 0);
}
return length;
}
function initVisitedArr(grid) {
let visitedArr = [];
for(let i = 0; i < grid.length; i++) {
const row = grid[i];
visitedArr[i] = [];
for (let j = 0; j < row.length; j++) {
visitedArr[i][j] = 0;
}
}
return visitedArr;
}
| bmxklYzj/LeetCode | 2017/695/1.js | JavaScript | mit | 1,182 |
<?php /* Smarty version Smarty-3.1.11, created on 2012-09-10 07:12:15
compiled from "F:\htdocs\glife-0.4\templates\header.tpl" */ ?>
<?php /*%%SmartyHeaderCode:16043504d92cf037ea6-49487568%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
'file_dependency' =>
array (
'843429f59f935f0cddd92f5d2d458e95439a32ce' =>
array (
0 => 'F:\\htdocs\\glife-0.4\\templates\\header.tpl',
1 => 1347260111,
2 => 'file',
),
),
'nocache_hash' => '16043504d92cf037ea6-49487568',
'function' =>
array (
),
'has_nocache_code' => false,
'version' => 'Smarty-3.1.11',
'unifunc' => 'content_504d92cf050ed9_52293099',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_504d92cf050ed9_52293099')) {function content_504d92cf050ed9_52293099($_smarty_tpl) {?><!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="format-detection" content="telephone=no" />
<title>校园G生活</title>
<link rel="stylesheet" href="plugins/jquery/jquery.mobile-1.1.1.min.css">
<link rel="stylesheet" href="plugins/jquery/jquery.mobile-1.1.1.structure.min.css">
<link rel="stylesheet" href="plugins/jquery/jquery.mobile-1.1.1.theme.min.css">
<script src="plugins/jquery/jquery-1.8.1.min.js"></script>
<script src="plugins/jquery/jquery.mobile-1.1.1.min.js"></script>
<script>
$(document).bind('pageinit', function(){
hideMessage();
var msg = getCookie('premsg');
if (msg) {
$(function(){
showMessage(msg);
});
delCookie('premsg');
}
// forms default behavior
var $forms = $('form');
$forms.bind('submit', function(e){
e.preventDefault();
showLoader();
var $form = $(this);
var url = $form.attr('action') || '#',
type = $form.attr('method') || 'GET',
data = $form.serialize(),
fn = $form.data('success');
myAjax(url, data, fn, type);
return false; // prevent changing page
});
// fieldsets default behavior
var $fsets = $forms.find('fieldset');
$fsets.each(function(i, t){
var $radios = $(t).find('input[type=radio]');
$radios.attr('checked', false).checkboxradio('refresh');
$first = $radios.first();
if ($first[0]) {
$first.attr('checked', true).checkboxradio('refresh');
}
});
var $btn_myajax = $('button.my-ajax');
$btn_myajax.bind('vclick', function(e){
e.preventDefault();
var url = $(this).data('href');
myAjax(url);
return false;
});
});
function myAjax(url, data, fn, type) {
showLoader();
$.ajax({
url: url,
data: data,
type: type || 'GET',
dataType: 'text',
success: function(data){
ajaxHandler(data);
fn && fn(data);
},
error: function(e){
showMessage('AJAX error!');
}
});
function ajaxHandler(data) {
hideLoader();
eval('data='+ data); // enable json
if (data.url) {
setCookie('premsg', data.msg);
jumpto(data.url);
} else {
showMessage(data.msg);
}
}
}
function showLoader() {
showMessage();
}
function hideLoader() {
hideMessage();
}
function showMessage(text, callback, duration) {
$.mobile.showPageLoadingMsg(null, text, text? true: false);
setTimeout(function(){
hideMessage();
callback && callback();
}, duration || 5000);
}
function hideMessage() {
$.mobile.hidePageLoadingMsg();
}
function jumpto(url) {
window.location = url;
}
function setCookie(key, val, path) {
var d = new Date();
d = new Date(d.getTime() + 30*24*60*60*1000); // 30 days
document.cookie = [key, '=', escape(val),
';expires=', d.toGMTString(),
';path=', path || ''].join('');
}
function getCookie(key) {
var val = false;
var segs = document.cookie.split(';');
$.each(segs, function(i, t){
var p = t.split('=');
if (p[0] === key) {
val = unescape(p[1]);
return false;
}
});
return val;
}
function delCookie(key) {
var d = new Date();
d = new Date(d.getTime() - 1);
document.cookie = [key, '=;expires=', d.toGMTString()].join('');
}
</script>
</head>
<body>
<div data-role="page">
<div data-role="header">
<h3>校园G生活</h3>
</div><!-- /header --><?php }} ?> | phrief/xydd | Smarty/templates_c/843429f59f935f0cddd92f5d2d458e95439a32ce.file.header.tpl.php | PHP | mit | 4,394 |
def mutate_string(string, position, character):
p=list(s)
p[int(position)]=c
p=''.join(p)
return p
if __name__ == '__main__':
s = input()
i, c = input().split()
s_new = mutate_string(s, int(i), c)
print(s_new)
| manishbisht/Competitive-Programming | Hackerrank/Practice/Python/3.string/17.Mutations.py | Python | mit | 268 |
#!/usr/bin/env python
import pywikibot
from pywikibot.data import api
site = pywikibot.Site()
reason = '[[WP:CSD#U2|U2]]: Userpage or subpage of a nonexistent user'
def user_does_not_exist(name):
req = api.Request(action='query', list='users', ususers=name)
data = req.submit()
return 'missing' in data['query']['users'][0]
countok = 0
countbad = 0
gen = site.newpages(showBot=True, namespaces=[3], returndict=True, user='EdwardsBot')
for page, pagedict in gen:
username = page.title(withNamespace=False)
if user_does_not_exist(username):
print page
page.delete(reason, prompt=False)
countbad += 1
else:
countok += 1
print 'BAD: {0}'.format(countbad)
print 'OK: {0}'.format(countok)
| legoktm/pywikipedia-scripts | clean_up_mess.py | Python | mit | 747 |
<?php
namespace BookFair\Bundle\BookshopBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Validation
*/
class Validation
{
/**
* @var string
*/
private $isValid;
/**
* @var string
*/
private $acctype;
/**
* @var string
*/
private $keyId;
/**
* Set isValid
*
* @param string $isValid
* @return Validation
*/
public function setIsValid($isValid)
{
$this->isValid = $isValid;
return $this;
}
/**
* Get isValid
*
* @return string
*/
public function getIsValid()
{
return $this->isValid;
}
/**
* Set acctype
*
* @param string $acctype
* @return Validation
*/
public function setAcctype($acctype)
{
$this->acctype = $acctype;
return $this;
}
/**
* Get acctype
*
* @return string
*/
public function getAcctype()
{
return $this->acctype;
}
/**
* Get keyId
*
* @return string
*/
public function getKeyId()
{
return $this->keyId;
}
}
| BhagyaGH/Book-Fair-Web-App | src/BookFair/Bundle/BookshopBundle/Entity/Validation.php | PHP | mit | 1,146 |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.ccc.bm.entity;
/**
*
* @author davidchang
*/
public class Room {
private int id;
private int roomId;
private String name;
private int class_id;
private String text;
private String uri;
private String color;
private String fontSize;
private int top;
private int left;
private int height;
private int width;
private String footpath;
public int getRoomId() {
return roomId;
}
public void setRoomId(int roomId) {
this.roomId = roomId;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public String getFontSize() {
return fontSize;
}
public void setFontSize(String fontSize) {
this.fontSize = fontSize;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getClass_id() {
return class_id;
}
public void setClass_id(int class_id) {
this.class_id = class_id;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public int getTop() {
return top;
}
public void setTop(int top) {
this.top = top;
}
public int getLeft() {
return left;
}
public void setLeft(int left) {
this.left = left;
}
public int getHeight() {
return height;
}
public void setHeight(int height) {
this.height = height;
}
public int getWidth() {
return width;
}
public void setWidth(int width) {
this.width = width;
}
public String getFootpath() {
return footpath;
}
public void setFootpath(String footpath) {
this.footpath = footpath;
}
}
| chechiachang/blue-villa | src/main/java/com/ccc/bm/entity/Room.java | Java | mit | 2,320 |
package zecuse.MCModTutorial.block;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import zecuse.MCModTutorial.creativetab.CreativeTabTutorial;
import zecuse.MCModTutorial.init.ModBlocks;
import zecuse.MCModTutorial.reference.Reference;
// This class is used as a wrapper for all other mod blocks.
// Default properties are setup here.
// Should a block require different values, they are defined in its class.
public abstract class GenericBlock extends Block
{
private final String GENERIC_NAME;
public GenericBlock(String name)
{
this(name, Material.ROCK);
}
public GenericBlock(String name, Material material)
{
super(material);
this.setRegistryName(name);
this.setUnlocalizedName(name);
this.setCreativeTab(CreativeTabTutorial.TUTORIAL_TAB);
GENERIC_NAME = name;
ModBlocks.register(this);
}
// Retrieves "item.(MOD ID):(NAME)" replace (...) with the appropriate value.
@Override
public String getUnlocalizedName()
{
return String.format("tile.%s:%s", Reference.MOD_ID, GENERIC_NAME);
}
// This method loads the block's model into the game.
@SideOnly(Side.CLIENT)
public void initBlockModels()
{
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), 0, new ModelResourceLocation(this.getRegistryName().toString()));
}
}
| zecuse/MCModTutorial | src/main/java/zecuse/MCModTutorial/block/GenericBlock.java | Java | mit | 1,573 |
version https://git-lfs.github.com/spec/v1
oid sha256:69a4d244efeaa1426b857449a59b971adabfbcf56d804be72cfd6aca1f3017d7
size 26909
| yogeshsaroya/new-cdnjs | ajax/libs/ace/1.1.9/mode-scala.js | JavaScript | mit | 130 |
<?php
namespace App\Http\Controllers;
use App\Commands\RegisterCommand;
use App\Commands\RoleCommand;
use App\Http\Requests\RegisterRequest;
use App\Http\Requests;
use Redirect;
use View;
class RegisterController extends Controller
{
/**
* @var RoleCommand
*/
private $roleCommand;
/**
* @var RegisterCommand
*/
private $registerCommand;
/**
* RegisterController constructor.
*
* @param RegisterCommand $registerCommand
* @param RoleCommand $roleCommand
*/
public function __construct(RegisterCommand $registerCommand, RoleCommand $roleCommand)
{
$this->roleCommand = $roleCommand;
$this->registerCommand = $registerCommand;
}
/**
* @return \Illuminate\Contracts\View\View
*/
public function create()
{
$roles = $this->roleCommand->listRoles();
return View::make('login.register', compact('roles'));
}
/**
* @param RegisterRequest $request
*
* @return mixed
*/
public function store(RegisterRequest $request)
{
$roleId = $request->get('user_type');
$this->registerCommand->store($request->all(), $roleId);
return Redirect::route('login.create');
}
}
| idirouhab/codeathon2016urv_groupmixer | app/Http/Controllers/RegisterController.php | PHP | mit | 1,171 |
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: chunk_server.proto
package com.github.horrorho.inflatabledonkey.protobuf;
public final class ChunkServer {
private ChunkServer() {}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) {
}
public interface ChunkInfoOrBuilder extends
// @@protoc_insertion_point(interface_extends:ChunkInfo)
com.google.protobuf.MessageOrBuilder {
/**
* <code>required bytes chunk_checksum = 1;</code>
*/
boolean hasChunkChecksum();
/**
* <code>required bytes chunk_checksum = 1;</code>
*/
com.google.protobuf.ByteString getChunkChecksum();
/**
* <code>optional bytes chunk_encryption_key = 2;</code>
*/
boolean hasChunkEncryptionKey();
/**
* <code>optional bytes chunk_encryption_key = 2;</code>
*/
com.google.protobuf.ByteString getChunkEncryptionKey();
/**
* <code>required uint32 chunk_length = 3;</code>
*/
boolean hasChunkLength();
/**
* <code>required uint32 chunk_length = 3;</code>
*/
int getChunkLength();
/**
* <code>optional uint32 chunk_offset = 4;</code>
*/
boolean hasChunkOffset();
/**
* <code>optional uint32 chunk_offset = 4;</code>
*/
int getChunkOffset();
}
/**
* Protobuf type {@code ChunkInfo}
*/
public static final class ChunkInfo extends
com.google.protobuf.GeneratedMessage implements
// @@protoc_insertion_point(message_implements:ChunkInfo)
ChunkInfoOrBuilder {
// Use ChunkInfo.newBuilder() to construct.
private ChunkInfo(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private ChunkInfo(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final ChunkInfo defaultInstance;
public static ChunkInfo getDefaultInstance() {
return defaultInstance;
}
public ChunkInfo getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private ChunkInfo(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
bitField0_ |= 0x00000001;
chunkChecksum_ = input.readBytes();
break;
}
case 18: {
bitField0_ |= 0x00000002;
chunkEncryptionKey_ = input.readBytes();
break;
}
case 24: {
bitField0_ |= 0x00000004;
chunkLength_ = input.readUInt32();
break;
}
case 32: {
bitField0_ |= 0x00000008;
chunkOffset_ = input.readUInt32();
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_ChunkInfo_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_ChunkInfo_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo.Builder.class);
}
public static com.google.protobuf.Parser<ChunkInfo> PARSER =
new com.google.protobuf.AbstractParser<ChunkInfo>() {
public ChunkInfo parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new ChunkInfo(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<ChunkInfo> getParserForType() {
return PARSER;
}
private int bitField0_;
public static final int CHUNK_CHECKSUM_FIELD_NUMBER = 1;
private com.google.protobuf.ByteString chunkChecksum_;
/**
* <code>required bytes chunk_checksum = 1;</code>
*/
public boolean hasChunkChecksum() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required bytes chunk_checksum = 1;</code>
*/
public com.google.protobuf.ByteString getChunkChecksum() {
return chunkChecksum_;
}
public static final int CHUNK_ENCRYPTION_KEY_FIELD_NUMBER = 2;
private com.google.protobuf.ByteString chunkEncryptionKey_;
/**
* <code>optional bytes chunk_encryption_key = 2;</code>
*/
public boolean hasChunkEncryptionKey() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>optional bytes chunk_encryption_key = 2;</code>
*/
public com.google.protobuf.ByteString getChunkEncryptionKey() {
return chunkEncryptionKey_;
}
public static final int CHUNK_LENGTH_FIELD_NUMBER = 3;
private int chunkLength_;
/**
* <code>required uint32 chunk_length = 3;</code>
*/
public boolean hasChunkLength() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>required uint32 chunk_length = 3;</code>
*/
public int getChunkLength() {
return chunkLength_;
}
public static final int CHUNK_OFFSET_FIELD_NUMBER = 4;
private int chunkOffset_;
/**
* <code>optional uint32 chunk_offset = 4;</code>
*/
public boolean hasChunkOffset() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>optional uint32 chunk_offset = 4;</code>
*/
public int getChunkOffset() {
return chunkOffset_;
}
private void initFields() {
chunkChecksum_ = com.google.protobuf.ByteString.EMPTY;
chunkEncryptionKey_ = com.google.protobuf.ByteString.EMPTY;
chunkLength_ = 0;
chunkOffset_ = 0;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
if (!hasChunkChecksum()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasChunkLength()) {
memoizedIsInitialized = 0;
return false;
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeBytes(1, chunkChecksum_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeBytes(2, chunkEncryptionKey_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
output.writeUInt32(3, chunkLength_);
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
output.writeUInt32(4, chunkOffset_);
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(1, chunkChecksum_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(2, chunkEncryptionKey_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
size += com.google.protobuf.CodedOutputStream
.computeUInt32Size(3, chunkLength_);
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
size += com.google.protobuf.CodedOutputStream
.computeUInt32Size(4, chunkOffset_);
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code ChunkInfo}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:ChunkInfo)
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfoOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_ChunkInfo_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_ChunkInfo_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo.Builder.class);
}
// Construct using com.github.horrorho.inflatabledonkey.protocol.ChunkServer.ChunkInfo.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
chunkChecksum_ = com.google.protobuf.ByteString.EMPTY;
bitField0_ = (bitField0_ & ~0x00000001);
chunkEncryptionKey_ = com.google.protobuf.ByteString.EMPTY;
bitField0_ = (bitField0_ & ~0x00000002);
chunkLength_ = 0;
bitField0_ = (bitField0_ & ~0x00000004);
chunkOffset_ = 0;
bitField0_ = (bitField0_ & ~0x00000008);
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_ChunkInfo_descriptor;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo getDefaultInstanceForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo.getDefaultInstance();
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo build() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo buildPartial() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo result = new com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
result.chunkChecksum_ = chunkChecksum_;
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002;
}
result.chunkEncryptionKey_ = chunkEncryptionKey_;
if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
to_bitField0_ |= 0x00000004;
}
result.chunkLength_ = chunkLength_;
if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
to_bitField0_ |= 0x00000008;
}
result.chunkOffset_ = chunkOffset_;
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo) {
return mergeFrom((com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo other) {
if (other == com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo.getDefaultInstance()) return this;
if (other.hasChunkChecksum()) {
setChunkChecksum(other.getChunkChecksum());
}
if (other.hasChunkEncryptionKey()) {
setChunkEncryptionKey(other.getChunkEncryptionKey());
}
if (other.hasChunkLength()) {
setChunkLength(other.getChunkLength());
}
if (other.hasChunkOffset()) {
setChunkOffset(other.getChunkOffset());
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
if (!hasChunkChecksum()) {
return false;
}
if (!hasChunkLength()) {
return false;
}
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private com.google.protobuf.ByteString chunkChecksum_ = com.google.protobuf.ByteString.EMPTY;
/**
* <code>required bytes chunk_checksum = 1;</code>
*/
public boolean hasChunkChecksum() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required bytes chunk_checksum = 1;</code>
*/
public com.google.protobuf.ByteString getChunkChecksum() {
return chunkChecksum_;
}
/**
* <code>required bytes chunk_checksum = 1;</code>
*/
public Builder setChunkChecksum(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
chunkChecksum_ = value;
onChanged();
return this;
}
/**
* <code>required bytes chunk_checksum = 1;</code>
*/
public Builder clearChunkChecksum() {
bitField0_ = (bitField0_ & ~0x00000001);
chunkChecksum_ = getDefaultInstance().getChunkChecksum();
onChanged();
return this;
}
private com.google.protobuf.ByteString chunkEncryptionKey_ = com.google.protobuf.ByteString.EMPTY;
/**
* <code>optional bytes chunk_encryption_key = 2;</code>
*/
public boolean hasChunkEncryptionKey() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>optional bytes chunk_encryption_key = 2;</code>
*/
public com.google.protobuf.ByteString getChunkEncryptionKey() {
return chunkEncryptionKey_;
}
/**
* <code>optional bytes chunk_encryption_key = 2;</code>
*/
public Builder setChunkEncryptionKey(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000002;
chunkEncryptionKey_ = value;
onChanged();
return this;
}
/**
* <code>optional bytes chunk_encryption_key = 2;</code>
*/
public Builder clearChunkEncryptionKey() {
bitField0_ = (bitField0_ & ~0x00000002);
chunkEncryptionKey_ = getDefaultInstance().getChunkEncryptionKey();
onChanged();
return this;
}
private int chunkLength_ ;
/**
* <code>required uint32 chunk_length = 3;</code>
*/
public boolean hasChunkLength() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>required uint32 chunk_length = 3;</code>
*/
public int getChunkLength() {
return chunkLength_;
}
/**
* <code>required uint32 chunk_length = 3;</code>
*/
public Builder setChunkLength(int value) {
bitField0_ |= 0x00000004;
chunkLength_ = value;
onChanged();
return this;
}
/**
* <code>required uint32 chunk_length = 3;</code>
*/
public Builder clearChunkLength() {
bitField0_ = (bitField0_ & ~0x00000004);
chunkLength_ = 0;
onChanged();
return this;
}
private int chunkOffset_ ;
/**
* <code>optional uint32 chunk_offset = 4;</code>
*/
public boolean hasChunkOffset() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>optional uint32 chunk_offset = 4;</code>
*/
public int getChunkOffset() {
return chunkOffset_;
}
/**
* <code>optional uint32 chunk_offset = 4;</code>
*/
public Builder setChunkOffset(int value) {
bitField0_ |= 0x00000008;
chunkOffset_ = value;
onChanged();
return this;
}
/**
* <code>optional uint32 chunk_offset = 4;</code>
*/
public Builder clearChunkOffset() {
bitField0_ = (bitField0_ & ~0x00000008);
chunkOffset_ = 0;
onChanged();
return this;
}
// @@protoc_insertion_point(builder_scope:ChunkInfo)
}
static {
defaultInstance = new ChunkInfo(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:ChunkInfo)
}
public interface NameValuePairOrBuilder extends
// @@protoc_insertion_point(interface_extends:NameValuePair)
com.google.protobuf.MessageOrBuilder {
/**
* <code>required string name = 1;</code>
*/
boolean hasName();
/**
* <code>required string name = 1;</code>
*/
java.lang.String getName();
/**
* <code>required string name = 1;</code>
*/
com.google.protobuf.ByteString
getNameBytes();
/**
* <code>required string value = 2;</code>
*/
boolean hasValue();
/**
* <code>required string value = 2;</code>
*/
java.lang.String getValue();
/**
* <code>required string value = 2;</code>
*/
com.google.protobuf.ByteString
getValueBytes();
}
/**
* Protobuf type {@code NameValuePair}
*/
public static final class NameValuePair extends
com.google.protobuf.GeneratedMessage implements
// @@protoc_insertion_point(message_implements:NameValuePair)
NameValuePairOrBuilder {
// Use NameValuePair.newBuilder() to construct.
private NameValuePair(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private NameValuePair(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final NameValuePair defaultInstance;
public static NameValuePair getDefaultInstance() {
return defaultInstance;
}
public NameValuePair getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private NameValuePair(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
com.google.protobuf.ByteString bs = input.readBytes();
bitField0_ |= 0x00000001;
name_ = bs;
break;
}
case 18: {
com.google.protobuf.ByteString bs = input.readBytes();
bitField0_ |= 0x00000002;
value_ = bs;
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_NameValuePair_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_NameValuePair_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder.class);
}
public static com.google.protobuf.Parser<NameValuePair> PARSER =
new com.google.protobuf.AbstractParser<NameValuePair>() {
public NameValuePair parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new NameValuePair(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<NameValuePair> getParserForType() {
return PARSER;
}
private int bitField0_;
public static final int NAME_FIELD_NUMBER = 1;
private java.lang.Object name_;
/**
* <code>required string name = 1;</code>
*/
public boolean hasName() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required string name = 1;</code>
*/
public java.lang.String getName() {
java.lang.Object ref = name_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
name_ = s;
}
return s;
}
}
/**
* <code>required string name = 1;</code>
*/
public com.google.protobuf.ByteString
getNameBytes() {
java.lang.Object ref = name_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
name_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int VALUE_FIELD_NUMBER = 2;
private java.lang.Object value_;
/**
* <code>required string value = 2;</code>
*/
public boolean hasValue() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required string value = 2;</code>
*/
public java.lang.String getValue() {
java.lang.Object ref = value_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
value_ = s;
}
return s;
}
}
/**
* <code>required string value = 2;</code>
*/
public com.google.protobuf.ByteString
getValueBytes() {
java.lang.Object ref = value_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
value_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
private void initFields() {
name_ = "";
value_ = "";
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
if (!hasName()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasValue()) {
memoizedIsInitialized = 0;
return false;
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeBytes(1, getNameBytes());
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeBytes(2, getValueBytes());
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(1, getNameBytes());
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(2, getValueBytes());
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code NameValuePair}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:NameValuePair)
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_NameValuePair_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_NameValuePair_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder.class);
}
// Construct using com.github.horrorho.inflatabledonkey.protocol.ChunkServer.NameValuePair.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
name_ = "";
bitField0_ = (bitField0_ & ~0x00000001);
value_ = "";
bitField0_ = (bitField0_ & ~0x00000002);
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_NameValuePair_descriptor;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair getDefaultInstanceForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.getDefaultInstance();
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair build() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair buildPartial() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair result = new com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
result.name_ = name_;
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002;
}
result.value_ = value_;
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair) {
return mergeFrom((com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair other) {
if (other == com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.getDefaultInstance()) return this;
if (other.hasName()) {
bitField0_ |= 0x00000001;
name_ = other.name_;
onChanged();
}
if (other.hasValue()) {
bitField0_ |= 0x00000002;
value_ = other.value_;
onChanged();
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
if (!hasName()) {
return false;
}
if (!hasValue()) {
return false;
}
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private java.lang.Object name_ = "";
/**
* <code>required string name = 1;</code>
*/
public boolean hasName() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required string name = 1;</code>
*/
public java.lang.String getName() {
java.lang.Object ref = name_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
name_ = s;
}
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>required string name = 1;</code>
*/
public com.google.protobuf.ByteString
getNameBytes() {
java.lang.Object ref = name_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
name_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>required string name = 1;</code>
*/
public Builder setName(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
name_ = value;
onChanged();
return this;
}
/**
* <code>required string name = 1;</code>
*/
public Builder clearName() {
bitField0_ = (bitField0_ & ~0x00000001);
name_ = getDefaultInstance().getName();
onChanged();
return this;
}
/**
* <code>required string name = 1;</code>
*/
public Builder setNameBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
name_ = value;
onChanged();
return this;
}
private java.lang.Object value_ = "";
/**
* <code>required string value = 2;</code>
*/
public boolean hasValue() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required string value = 2;</code>
*/
public java.lang.String getValue() {
java.lang.Object ref = value_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
value_ = s;
}
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>required string value = 2;</code>
*/
public com.google.protobuf.ByteString
getValueBytes() {
java.lang.Object ref = value_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
value_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>required string value = 2;</code>
*/
public Builder setValue(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000002;
value_ = value;
onChanged();
return this;
}
/**
* <code>required string value = 2;</code>
*/
public Builder clearValue() {
bitField0_ = (bitField0_ & ~0x00000002);
value_ = getDefaultInstance().getValue();
onChanged();
return this;
}
/**
* <code>required string value = 2;</code>
*/
public Builder setValueBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000002;
value_ = value;
onChanged();
return this;
}
// @@protoc_insertion_point(builder_scope:NameValuePair)
}
static {
defaultInstance = new NameValuePair(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:NameValuePair)
}
public interface HostInfoOrBuilder extends
// @@protoc_insertion_point(interface_extends:HostInfo)
com.google.protobuf.MessageOrBuilder {
/**
* <code>required string hostname = 1;</code>
*/
boolean hasHostname();
/**
* <code>required string hostname = 1;</code>
*/
java.lang.String getHostname();
/**
* <code>required string hostname = 1;</code>
*/
com.google.protobuf.ByteString
getHostnameBytes();
/**
* <code>required uint32 port = 2;</code>
*/
boolean hasPort();
/**
* <code>required uint32 port = 2;</code>
*/
int getPort();
/**
* <code>required string method = 3;</code>
*/
boolean hasMethod();
/**
* <code>required string method = 3;</code>
*/
java.lang.String getMethod();
/**
* <code>required string method = 3;</code>
*/
com.google.protobuf.ByteString
getMethodBytes();
/**
* <code>required string uri = 4;</code>
*/
boolean hasUri();
/**
* <code>required string uri = 4;</code>
*/
java.lang.String getUri();
/**
* <code>required string uri = 4;</code>
*/
com.google.protobuf.ByteString
getUriBytes();
/**
* <code>required string transport_protocol = 5;</code>
*/
boolean hasTransportProtocol();
/**
* <code>required string transport_protocol = 5;</code>
*/
java.lang.String getTransportProtocol();
/**
* <code>required string transport_protocol = 5;</code>
*/
com.google.protobuf.ByteString
getTransportProtocolBytes();
/**
* <code>required string transport_protocol_version = 6;</code>
*/
boolean hasTransportProtocolVersion();
/**
* <code>required string transport_protocol_version = 6;</code>
*/
java.lang.String getTransportProtocolVersion();
/**
* <code>required string transport_protocol_version = 6;</code>
*/
com.google.protobuf.ByteString
getTransportProtocolVersionBytes();
/**
* <code>required string scheme = 7;</code>
*/
boolean hasScheme();
/**
* <code>required string scheme = 7;</code>
*/
java.lang.String getScheme();
/**
* <code>required string scheme = 7;</code>
*/
com.google.protobuf.ByteString
getSchemeBytes();
/**
* <code>repeated .NameValuePair headers = 8;</code>
*/
java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair>
getHeadersList();
/**
* <code>repeated .NameValuePair headers = 8;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair getHeaders(int index);
/**
* <code>repeated .NameValuePair headers = 8;</code>
*/
int getHeadersCount();
/**
* <code>repeated .NameValuePair headers = 8;</code>
*/
java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder>
getHeadersOrBuilderList();
/**
* <code>repeated .NameValuePair headers = 8;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder getHeadersOrBuilder(
int index);
/**
* <code>optional string datacenter = 9;</code>
*/
boolean hasDatacenter();
/**
* <code>optional string datacenter = 9;</code>
*/
java.lang.String getDatacenter();
/**
* <code>optional string datacenter = 9;</code>
*/
com.google.protobuf.ByteString
getDatacenterBytes();
/**
* <code>optional uint64 expiry = 11;</code>
*/
boolean hasExpiry();
/**
* <code>optional uint64 expiry = 11;</code>
*/
long getExpiry();
}
/**
* Protobuf type {@code HostInfo}
*/
public static final class HostInfo extends
com.google.protobuf.GeneratedMessage implements
// @@protoc_insertion_point(message_implements:HostInfo)
HostInfoOrBuilder {
// Use HostInfo.newBuilder() to construct.
private HostInfo(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private HostInfo(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final HostInfo defaultInstance;
public static HostInfo getDefaultInstance() {
return defaultInstance;
}
public HostInfo getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private HostInfo(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
com.google.protobuf.ByteString bs = input.readBytes();
bitField0_ |= 0x00000001;
hostname_ = bs;
break;
}
case 16: {
bitField0_ |= 0x00000002;
port_ = input.readUInt32();
break;
}
case 26: {
com.google.protobuf.ByteString bs = input.readBytes();
bitField0_ |= 0x00000004;
method_ = bs;
break;
}
case 34: {
com.google.protobuf.ByteString bs = input.readBytes();
bitField0_ |= 0x00000008;
uri_ = bs;
break;
}
case 42: {
com.google.protobuf.ByteString bs = input.readBytes();
bitField0_ |= 0x00000010;
transportProtocol_ = bs;
break;
}
case 50: {
com.google.protobuf.ByteString bs = input.readBytes();
bitField0_ |= 0x00000020;
transportProtocolVersion_ = bs;
break;
}
case 58: {
com.google.protobuf.ByteString bs = input.readBytes();
bitField0_ |= 0x00000040;
scheme_ = bs;
break;
}
case 66: {
if (!((mutable_bitField0_ & 0x00000080) == 0x00000080)) {
headers_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair>();
mutable_bitField0_ |= 0x00000080;
}
headers_.add(input.readMessage(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.PARSER, extensionRegistry));
break;
}
case 74: {
com.google.protobuf.ByteString bs = input.readBytes();
bitField0_ |= 0x00000080;
datacenter_ = bs;
break;
}
case 88: {
bitField0_ |= 0x00000100;
expiry_ = input.readUInt64();
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000080) == 0x00000080)) {
headers_ = java.util.Collections.unmodifiableList(headers_);
}
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_HostInfo_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_HostInfo_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo.Builder.class);
}
public static com.google.protobuf.Parser<HostInfo> PARSER =
new com.google.protobuf.AbstractParser<HostInfo>() {
public HostInfo parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new HostInfo(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<HostInfo> getParserForType() {
return PARSER;
}
private int bitField0_;
public static final int HOSTNAME_FIELD_NUMBER = 1;
private java.lang.Object hostname_;
/**
* <code>required string hostname = 1;</code>
*/
public boolean hasHostname() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required string hostname = 1;</code>
*/
public java.lang.String getHostname() {
java.lang.Object ref = hostname_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
hostname_ = s;
}
return s;
}
}
/**
* <code>required string hostname = 1;</code>
*/
public com.google.protobuf.ByteString
getHostnameBytes() {
java.lang.Object ref = hostname_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
hostname_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int PORT_FIELD_NUMBER = 2;
private int port_;
/**
* <code>required uint32 port = 2;</code>
*/
public boolean hasPort() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required uint32 port = 2;</code>
*/
public int getPort() {
return port_;
}
public static final int METHOD_FIELD_NUMBER = 3;
private java.lang.Object method_;
/**
* <code>required string method = 3;</code>
*/
public boolean hasMethod() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>required string method = 3;</code>
*/
public java.lang.String getMethod() {
java.lang.Object ref = method_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
method_ = s;
}
return s;
}
}
/**
* <code>required string method = 3;</code>
*/
public com.google.protobuf.ByteString
getMethodBytes() {
java.lang.Object ref = method_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
method_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int URI_FIELD_NUMBER = 4;
private java.lang.Object uri_;
/**
* <code>required string uri = 4;</code>
*/
public boolean hasUri() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>required string uri = 4;</code>
*/
public java.lang.String getUri() {
java.lang.Object ref = uri_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
uri_ = s;
}
return s;
}
}
/**
* <code>required string uri = 4;</code>
*/
public com.google.protobuf.ByteString
getUriBytes() {
java.lang.Object ref = uri_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
uri_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int TRANSPORT_PROTOCOL_FIELD_NUMBER = 5;
private java.lang.Object transportProtocol_;
/**
* <code>required string transport_protocol = 5;</code>
*/
public boolean hasTransportProtocol() {
return ((bitField0_ & 0x00000010) == 0x00000010);
}
/**
* <code>required string transport_protocol = 5;</code>
*/
public java.lang.String getTransportProtocol() {
java.lang.Object ref = transportProtocol_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
transportProtocol_ = s;
}
return s;
}
}
/**
* <code>required string transport_protocol = 5;</code>
*/
public com.google.protobuf.ByteString
getTransportProtocolBytes() {
java.lang.Object ref = transportProtocol_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
transportProtocol_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int TRANSPORT_PROTOCOL_VERSION_FIELD_NUMBER = 6;
private java.lang.Object transportProtocolVersion_;
/**
* <code>required string transport_protocol_version = 6;</code>
*/
public boolean hasTransportProtocolVersion() {
return ((bitField0_ & 0x00000020) == 0x00000020);
}
/**
* <code>required string transport_protocol_version = 6;</code>
*/
public java.lang.String getTransportProtocolVersion() {
java.lang.Object ref = transportProtocolVersion_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
transportProtocolVersion_ = s;
}
return s;
}
}
/**
* <code>required string transport_protocol_version = 6;</code>
*/
public com.google.protobuf.ByteString
getTransportProtocolVersionBytes() {
java.lang.Object ref = transportProtocolVersion_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
transportProtocolVersion_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int SCHEME_FIELD_NUMBER = 7;
private java.lang.Object scheme_;
/**
* <code>required string scheme = 7;</code>
*/
public boolean hasScheme() {
return ((bitField0_ & 0x00000040) == 0x00000040);
}
/**
* <code>required string scheme = 7;</code>
*/
public java.lang.String getScheme() {
java.lang.Object ref = scheme_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
scheme_ = s;
}
return s;
}
}
/**
* <code>required string scheme = 7;</code>
*/
public com.google.protobuf.ByteString
getSchemeBytes() {
java.lang.Object ref = scheme_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
scheme_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int HEADERS_FIELD_NUMBER = 8;
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair> headers_;
/**
* <code>repeated .NameValuePair headers = 8;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair> getHeadersList() {
return headers_;
}
/**
* <code>repeated .NameValuePair headers = 8;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder>
getHeadersOrBuilderList() {
return headers_;
}
/**
* <code>repeated .NameValuePair headers = 8;</code>
*/
public int getHeadersCount() {
return headers_.size();
}
/**
* <code>repeated .NameValuePair headers = 8;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair getHeaders(int index) {
return headers_.get(index);
}
/**
* <code>repeated .NameValuePair headers = 8;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder getHeadersOrBuilder(
int index) {
return headers_.get(index);
}
public static final int DATACENTER_FIELD_NUMBER = 9;
private java.lang.Object datacenter_;
/**
* <code>optional string datacenter = 9;</code>
*/
public boolean hasDatacenter() {
return ((bitField0_ & 0x00000080) == 0x00000080);
}
/**
* <code>optional string datacenter = 9;</code>
*/
public java.lang.String getDatacenter() {
java.lang.Object ref = datacenter_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
datacenter_ = s;
}
return s;
}
}
/**
* <code>optional string datacenter = 9;</code>
*/
public com.google.protobuf.ByteString
getDatacenterBytes() {
java.lang.Object ref = datacenter_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
datacenter_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int EXPIRY_FIELD_NUMBER = 11;
private long expiry_;
/**
* <code>optional uint64 expiry = 11;</code>
*/
public boolean hasExpiry() {
return ((bitField0_ & 0x00000100) == 0x00000100);
}
/**
* <code>optional uint64 expiry = 11;</code>
*/
public long getExpiry() {
return expiry_;
}
private void initFields() {
hostname_ = "";
port_ = 0;
method_ = "";
uri_ = "";
transportProtocol_ = "";
transportProtocolVersion_ = "";
scheme_ = "";
headers_ = java.util.Collections.emptyList();
datacenter_ = "";
expiry_ = 0L;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
if (!hasHostname()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasPort()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasMethod()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasUri()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasTransportProtocol()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasTransportProtocolVersion()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasScheme()) {
memoizedIsInitialized = 0;
return false;
}
for (int i = 0; i < getHeadersCount(); i++) {
if (!getHeaders(i).isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeBytes(1, getHostnameBytes());
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeUInt32(2, port_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
output.writeBytes(3, getMethodBytes());
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
output.writeBytes(4, getUriBytes());
}
if (((bitField0_ & 0x00000010) == 0x00000010)) {
output.writeBytes(5, getTransportProtocolBytes());
}
if (((bitField0_ & 0x00000020) == 0x00000020)) {
output.writeBytes(6, getTransportProtocolVersionBytes());
}
if (((bitField0_ & 0x00000040) == 0x00000040)) {
output.writeBytes(7, getSchemeBytes());
}
for (int i = 0; i < headers_.size(); i++) {
output.writeMessage(8, headers_.get(i));
}
if (((bitField0_ & 0x00000080) == 0x00000080)) {
output.writeBytes(9, getDatacenterBytes());
}
if (((bitField0_ & 0x00000100) == 0x00000100)) {
output.writeUInt64(11, expiry_);
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(1, getHostnameBytes());
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += com.google.protobuf.CodedOutputStream
.computeUInt32Size(2, port_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(3, getMethodBytes());
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(4, getUriBytes());
}
if (((bitField0_ & 0x00000010) == 0x00000010)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(5, getTransportProtocolBytes());
}
if (((bitField0_ & 0x00000020) == 0x00000020)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(6, getTransportProtocolVersionBytes());
}
if (((bitField0_ & 0x00000040) == 0x00000040)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(7, getSchemeBytes());
}
for (int i = 0; i < headers_.size(); i++) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(8, headers_.get(i));
}
if (((bitField0_ & 0x00000080) == 0x00000080)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(9, getDatacenterBytes());
}
if (((bitField0_ & 0x00000100) == 0x00000100)) {
size += com.google.protobuf.CodedOutputStream
.computeUInt64Size(11, expiry_);
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code HostInfo}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:HostInfo)
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfoOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_HostInfo_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_HostInfo_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo.Builder.class);
}
// Construct using com.github.horrorho.inflatabledonkey.protocol.ChunkServer.HostInfo.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
getHeadersFieldBuilder();
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
hostname_ = "";
bitField0_ = (bitField0_ & ~0x00000001);
port_ = 0;
bitField0_ = (bitField0_ & ~0x00000002);
method_ = "";
bitField0_ = (bitField0_ & ~0x00000004);
uri_ = "";
bitField0_ = (bitField0_ & ~0x00000008);
transportProtocol_ = "";
bitField0_ = (bitField0_ & ~0x00000010);
transportProtocolVersion_ = "";
bitField0_ = (bitField0_ & ~0x00000020);
scheme_ = "";
bitField0_ = (bitField0_ & ~0x00000040);
if (headersBuilder_ == null) {
headers_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000080);
} else {
headersBuilder_.clear();
}
datacenter_ = "";
bitField0_ = (bitField0_ & ~0x00000100);
expiry_ = 0L;
bitField0_ = (bitField0_ & ~0x00000200);
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_HostInfo_descriptor;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo getDefaultInstanceForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo.getDefaultInstance();
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo build() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo buildPartial() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo result = new com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
result.hostname_ = hostname_;
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002;
}
result.port_ = port_;
if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
to_bitField0_ |= 0x00000004;
}
result.method_ = method_;
if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
to_bitField0_ |= 0x00000008;
}
result.uri_ = uri_;
if (((from_bitField0_ & 0x00000010) == 0x00000010)) {
to_bitField0_ |= 0x00000010;
}
result.transportProtocol_ = transportProtocol_;
if (((from_bitField0_ & 0x00000020) == 0x00000020)) {
to_bitField0_ |= 0x00000020;
}
result.transportProtocolVersion_ = transportProtocolVersion_;
if (((from_bitField0_ & 0x00000040) == 0x00000040)) {
to_bitField0_ |= 0x00000040;
}
result.scheme_ = scheme_;
if (headersBuilder_ == null) {
if (((bitField0_ & 0x00000080) == 0x00000080)) {
headers_ = java.util.Collections.unmodifiableList(headers_);
bitField0_ = (bitField0_ & ~0x00000080);
}
result.headers_ = headers_;
} else {
result.headers_ = headersBuilder_.build();
}
if (((from_bitField0_ & 0x00000100) == 0x00000100)) {
to_bitField0_ |= 0x00000080;
}
result.datacenter_ = datacenter_;
if (((from_bitField0_ & 0x00000200) == 0x00000200)) {
to_bitField0_ |= 0x00000100;
}
result.expiry_ = expiry_;
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo) {
return mergeFrom((com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo other) {
if (other == com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo.getDefaultInstance()) return this;
if (other.hasHostname()) {
bitField0_ |= 0x00000001;
hostname_ = other.hostname_;
onChanged();
}
if (other.hasPort()) {
setPort(other.getPort());
}
if (other.hasMethod()) {
bitField0_ |= 0x00000004;
method_ = other.method_;
onChanged();
}
if (other.hasUri()) {
bitField0_ |= 0x00000008;
uri_ = other.uri_;
onChanged();
}
if (other.hasTransportProtocol()) {
bitField0_ |= 0x00000010;
transportProtocol_ = other.transportProtocol_;
onChanged();
}
if (other.hasTransportProtocolVersion()) {
bitField0_ |= 0x00000020;
transportProtocolVersion_ = other.transportProtocolVersion_;
onChanged();
}
if (other.hasScheme()) {
bitField0_ |= 0x00000040;
scheme_ = other.scheme_;
onChanged();
}
if (headersBuilder_ == null) {
if (!other.headers_.isEmpty()) {
if (headers_.isEmpty()) {
headers_ = other.headers_;
bitField0_ = (bitField0_ & ~0x00000080);
} else {
ensureHeadersIsMutable();
headers_.addAll(other.headers_);
}
onChanged();
}
} else {
if (!other.headers_.isEmpty()) {
if (headersBuilder_.isEmpty()) {
headersBuilder_.dispose();
headersBuilder_ = null;
headers_ = other.headers_;
bitField0_ = (bitField0_ & ~0x00000080);
headersBuilder_ =
com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
getHeadersFieldBuilder() : null;
} else {
headersBuilder_.addAllMessages(other.headers_);
}
}
}
if (other.hasDatacenter()) {
bitField0_ |= 0x00000100;
datacenter_ = other.datacenter_;
onChanged();
}
if (other.hasExpiry()) {
setExpiry(other.getExpiry());
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
if (!hasHostname()) {
return false;
}
if (!hasPort()) {
return false;
}
if (!hasMethod()) {
return false;
}
if (!hasUri()) {
return false;
}
if (!hasTransportProtocol()) {
return false;
}
if (!hasTransportProtocolVersion()) {
return false;
}
if (!hasScheme()) {
return false;
}
for (int i = 0; i < getHeadersCount(); i++) {
if (!getHeaders(i).isInitialized()) {
return false;
}
}
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private java.lang.Object hostname_ = "";
/**
* <code>required string hostname = 1;</code>
*/
public boolean hasHostname() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required string hostname = 1;</code>
*/
public java.lang.String getHostname() {
java.lang.Object ref = hostname_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
hostname_ = s;
}
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>required string hostname = 1;</code>
*/
public com.google.protobuf.ByteString
getHostnameBytes() {
java.lang.Object ref = hostname_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
hostname_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>required string hostname = 1;</code>
*/
public Builder setHostname(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
hostname_ = value;
onChanged();
return this;
}
/**
* <code>required string hostname = 1;</code>
*/
public Builder clearHostname() {
bitField0_ = (bitField0_ & ~0x00000001);
hostname_ = getDefaultInstance().getHostname();
onChanged();
return this;
}
/**
* <code>required string hostname = 1;</code>
*/
public Builder setHostnameBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
hostname_ = value;
onChanged();
return this;
}
private int port_ ;
/**
* <code>required uint32 port = 2;</code>
*/
public boolean hasPort() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required uint32 port = 2;</code>
*/
public int getPort() {
return port_;
}
/**
* <code>required uint32 port = 2;</code>
*/
public Builder setPort(int value) {
bitField0_ |= 0x00000002;
port_ = value;
onChanged();
return this;
}
/**
* <code>required uint32 port = 2;</code>
*/
public Builder clearPort() {
bitField0_ = (bitField0_ & ~0x00000002);
port_ = 0;
onChanged();
return this;
}
private java.lang.Object method_ = "";
/**
* <code>required string method = 3;</code>
*/
public boolean hasMethod() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>required string method = 3;</code>
*/
public java.lang.String getMethod() {
java.lang.Object ref = method_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
method_ = s;
}
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>required string method = 3;</code>
*/
public com.google.protobuf.ByteString
getMethodBytes() {
java.lang.Object ref = method_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
method_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>required string method = 3;</code>
*/
public Builder setMethod(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000004;
method_ = value;
onChanged();
return this;
}
/**
* <code>required string method = 3;</code>
*/
public Builder clearMethod() {
bitField0_ = (bitField0_ & ~0x00000004);
method_ = getDefaultInstance().getMethod();
onChanged();
return this;
}
/**
* <code>required string method = 3;</code>
*/
public Builder setMethodBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000004;
method_ = value;
onChanged();
return this;
}
private java.lang.Object uri_ = "";
/**
* <code>required string uri = 4;</code>
*/
public boolean hasUri() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>required string uri = 4;</code>
*/
public java.lang.String getUri() {
java.lang.Object ref = uri_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
uri_ = s;
}
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>required string uri = 4;</code>
*/
public com.google.protobuf.ByteString
getUriBytes() {
java.lang.Object ref = uri_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
uri_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>required string uri = 4;</code>
*/
public Builder setUri(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000008;
uri_ = value;
onChanged();
return this;
}
/**
* <code>required string uri = 4;</code>
*/
public Builder clearUri() {
bitField0_ = (bitField0_ & ~0x00000008);
uri_ = getDefaultInstance().getUri();
onChanged();
return this;
}
/**
* <code>required string uri = 4;</code>
*/
public Builder setUriBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000008;
uri_ = value;
onChanged();
return this;
}
private java.lang.Object transportProtocol_ = "";
/**
* <code>required string transport_protocol = 5;</code>
*/
public boolean hasTransportProtocol() {
return ((bitField0_ & 0x00000010) == 0x00000010);
}
/**
* <code>required string transport_protocol = 5;</code>
*/
public java.lang.String getTransportProtocol() {
java.lang.Object ref = transportProtocol_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
transportProtocol_ = s;
}
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>required string transport_protocol = 5;</code>
*/
public com.google.protobuf.ByteString
getTransportProtocolBytes() {
java.lang.Object ref = transportProtocol_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
transportProtocol_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>required string transport_protocol = 5;</code>
*/
public Builder setTransportProtocol(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000010;
transportProtocol_ = value;
onChanged();
return this;
}
/**
* <code>required string transport_protocol = 5;</code>
*/
public Builder clearTransportProtocol() {
bitField0_ = (bitField0_ & ~0x00000010);
transportProtocol_ = getDefaultInstance().getTransportProtocol();
onChanged();
return this;
}
/**
* <code>required string transport_protocol = 5;</code>
*/
public Builder setTransportProtocolBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000010;
transportProtocol_ = value;
onChanged();
return this;
}
private java.lang.Object transportProtocolVersion_ = "";
/**
* <code>required string transport_protocol_version = 6;</code>
*/
public boolean hasTransportProtocolVersion() {
return ((bitField0_ & 0x00000020) == 0x00000020);
}
/**
* <code>required string transport_protocol_version = 6;</code>
*/
public java.lang.String getTransportProtocolVersion() {
java.lang.Object ref = transportProtocolVersion_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
transportProtocolVersion_ = s;
}
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>required string transport_protocol_version = 6;</code>
*/
public com.google.protobuf.ByteString
getTransportProtocolVersionBytes() {
java.lang.Object ref = transportProtocolVersion_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
transportProtocolVersion_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>required string transport_protocol_version = 6;</code>
*/
public Builder setTransportProtocolVersion(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000020;
transportProtocolVersion_ = value;
onChanged();
return this;
}
/**
* <code>required string transport_protocol_version = 6;</code>
*/
public Builder clearTransportProtocolVersion() {
bitField0_ = (bitField0_ & ~0x00000020);
transportProtocolVersion_ = getDefaultInstance().getTransportProtocolVersion();
onChanged();
return this;
}
/**
* <code>required string transport_protocol_version = 6;</code>
*/
public Builder setTransportProtocolVersionBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000020;
transportProtocolVersion_ = value;
onChanged();
return this;
}
private java.lang.Object scheme_ = "";
/**
* <code>required string scheme = 7;</code>
*/
public boolean hasScheme() {
return ((bitField0_ & 0x00000040) == 0x00000040);
}
/**
* <code>required string scheme = 7;</code>
*/
public java.lang.String getScheme() {
java.lang.Object ref = scheme_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
scheme_ = s;
}
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>required string scheme = 7;</code>
*/
public com.google.protobuf.ByteString
getSchemeBytes() {
java.lang.Object ref = scheme_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
scheme_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>required string scheme = 7;</code>
*/
public Builder setScheme(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000040;
scheme_ = value;
onChanged();
return this;
}
/**
* <code>required string scheme = 7;</code>
*/
public Builder clearScheme() {
bitField0_ = (bitField0_ & ~0x00000040);
scheme_ = getDefaultInstance().getScheme();
onChanged();
return this;
}
/**
* <code>required string scheme = 7;</code>
*/
public Builder setSchemeBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000040;
scheme_ = value;
onChanged();
return this;
}
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair> headers_ =
java.util.Collections.emptyList();
private void ensureHeadersIsMutable() {
if (!((bitField0_ & 0x00000080) == 0x00000080)) {
headers_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair>(headers_);
bitField0_ |= 0x00000080;
}
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder> headersBuilder_;
/**
* <code>repeated .NameValuePair headers = 8;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair> getHeadersList() {
if (headersBuilder_ == null) {
return java.util.Collections.unmodifiableList(headers_);
} else {
return headersBuilder_.getMessageList();
}
}
/**
* <code>repeated .NameValuePair headers = 8;</code>
*/
public int getHeadersCount() {
if (headersBuilder_ == null) {
return headers_.size();
} else {
return headersBuilder_.getCount();
}
}
/**
* <code>repeated .NameValuePair headers = 8;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair getHeaders(int index) {
if (headersBuilder_ == null) {
return headers_.get(index);
} else {
return headersBuilder_.getMessage(index);
}
}
/**
* <code>repeated .NameValuePair headers = 8;</code>
*/
public Builder setHeaders(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair value) {
if (headersBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureHeadersIsMutable();
headers_.set(index, value);
onChanged();
} else {
headersBuilder_.setMessage(index, value);
}
return this;
}
/**
* <code>repeated .NameValuePair headers = 8;</code>
*/
public Builder setHeaders(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder builderForValue) {
if (headersBuilder_ == null) {
ensureHeadersIsMutable();
headers_.set(index, builderForValue.build());
onChanged();
} else {
headersBuilder_.setMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .NameValuePair headers = 8;</code>
*/
public Builder addHeaders(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair value) {
if (headersBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureHeadersIsMutable();
headers_.add(value);
onChanged();
} else {
headersBuilder_.addMessage(value);
}
return this;
}
/**
* <code>repeated .NameValuePair headers = 8;</code>
*/
public Builder addHeaders(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair value) {
if (headersBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureHeadersIsMutable();
headers_.add(index, value);
onChanged();
} else {
headersBuilder_.addMessage(index, value);
}
return this;
}
/**
* <code>repeated .NameValuePair headers = 8;</code>
*/
public Builder addHeaders(
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder builderForValue) {
if (headersBuilder_ == null) {
ensureHeadersIsMutable();
headers_.add(builderForValue.build());
onChanged();
} else {
headersBuilder_.addMessage(builderForValue.build());
}
return this;
}
/**
* <code>repeated .NameValuePair headers = 8;</code>
*/
public Builder addHeaders(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder builderForValue) {
if (headersBuilder_ == null) {
ensureHeadersIsMutable();
headers_.add(index, builderForValue.build());
onChanged();
} else {
headersBuilder_.addMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .NameValuePair headers = 8;</code>
*/
public Builder addAllHeaders(
java.lang.Iterable<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair> values) {
if (headersBuilder_ == null) {
ensureHeadersIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, headers_);
onChanged();
} else {
headersBuilder_.addAllMessages(values);
}
return this;
}
/**
* <code>repeated .NameValuePair headers = 8;</code>
*/
public Builder clearHeaders() {
if (headersBuilder_ == null) {
headers_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000080);
onChanged();
} else {
headersBuilder_.clear();
}
return this;
}
/**
* <code>repeated .NameValuePair headers = 8;</code>
*/
public Builder removeHeaders(int index) {
if (headersBuilder_ == null) {
ensureHeadersIsMutable();
headers_.remove(index);
onChanged();
} else {
headersBuilder_.remove(index);
}
return this;
}
/**
* <code>repeated .NameValuePair headers = 8;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder getHeadersBuilder(
int index) {
return getHeadersFieldBuilder().getBuilder(index);
}
/**
* <code>repeated .NameValuePair headers = 8;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder getHeadersOrBuilder(
int index) {
if (headersBuilder_ == null) {
return headers_.get(index); } else {
return headersBuilder_.getMessageOrBuilder(index);
}
}
/**
* <code>repeated .NameValuePair headers = 8;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder>
getHeadersOrBuilderList() {
if (headersBuilder_ != null) {
return headersBuilder_.getMessageOrBuilderList();
} else {
return java.util.Collections.unmodifiableList(headers_);
}
}
/**
* <code>repeated .NameValuePair headers = 8;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder addHeadersBuilder() {
return getHeadersFieldBuilder().addBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.getDefaultInstance());
}
/**
* <code>repeated .NameValuePair headers = 8;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder addHeadersBuilder(
int index) {
return getHeadersFieldBuilder().addBuilder(index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.getDefaultInstance());
}
/**
* <code>repeated .NameValuePair headers = 8;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder>
getHeadersBuilderList() {
return getHeadersFieldBuilder().getBuilderList();
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder>
getHeadersFieldBuilder() {
if (headersBuilder_ == null) {
headersBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder>(
headers_,
((bitField0_ & 0x00000080) == 0x00000080),
getParentForChildren(),
isClean());
headers_ = null;
}
return headersBuilder_;
}
private java.lang.Object datacenter_ = "";
/**
* <code>optional string datacenter = 9;</code>
*/
public boolean hasDatacenter() {
return ((bitField0_ & 0x00000100) == 0x00000100);
}
/**
* <code>optional string datacenter = 9;</code>
*/
public java.lang.String getDatacenter() {
java.lang.Object ref = datacenter_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
datacenter_ = s;
}
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>optional string datacenter = 9;</code>
*/
public com.google.protobuf.ByteString
getDatacenterBytes() {
java.lang.Object ref = datacenter_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
datacenter_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>optional string datacenter = 9;</code>
*/
public Builder setDatacenter(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000100;
datacenter_ = value;
onChanged();
return this;
}
/**
* <code>optional string datacenter = 9;</code>
*/
public Builder clearDatacenter() {
bitField0_ = (bitField0_ & ~0x00000100);
datacenter_ = getDefaultInstance().getDatacenter();
onChanged();
return this;
}
/**
* <code>optional string datacenter = 9;</code>
*/
public Builder setDatacenterBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000100;
datacenter_ = value;
onChanged();
return this;
}
private long expiry_ ;
/**
* <code>optional uint64 expiry = 11;</code>
*/
public boolean hasExpiry() {
return ((bitField0_ & 0x00000200) == 0x00000200);
}
/**
* <code>optional uint64 expiry = 11;</code>
*/
public long getExpiry() {
return expiry_;
}
/**
* <code>optional uint64 expiry = 11;</code>
*/
public Builder setExpiry(long value) {
bitField0_ |= 0x00000200;
expiry_ = value;
onChanged();
return this;
}
/**
* <code>optional uint64 expiry = 11;</code>
*/
public Builder clearExpiry() {
bitField0_ = (bitField0_ & ~0x00000200);
expiry_ = 0L;
onChanged();
return this;
}
// @@protoc_insertion_point(builder_scope:HostInfo)
}
static {
defaultInstance = new HostInfo(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:HostInfo)
}
public interface ErrorResponseOrBuilder extends
// @@protoc_insertion_point(interface_extends:ErrorResponse)
com.google.protobuf.MessageOrBuilder {
/**
* <code>required string domain = 1;</code>
*/
boolean hasDomain();
/**
* <code>required string domain = 1;</code>
*/
java.lang.String getDomain();
/**
* <code>required string domain = 1;</code>
*/
com.google.protobuf.ByteString
getDomainBytes();
/**
* <code>required int32 error_code = 2;</code>
*/
boolean hasErrorCode();
/**
* <code>required int32 error_code = 2;</code>
*/
int getErrorCode();
/**
* <code>optional string error_description = 3;</code>
*/
boolean hasErrorDescription();
/**
* <code>optional string error_description = 3;</code>
*/
java.lang.String getErrorDescription();
/**
* <code>optional string error_description = 3;</code>
*/
com.google.protobuf.ByteString
getErrorDescriptionBytes();
/**
* <code>repeated .ErrorResponse underlying_errors = 4;</code>
*/
java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse>
getUnderlyingErrorsList();
/**
* <code>repeated .ErrorResponse underlying_errors = 4;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse getUnderlyingErrors(int index);
/**
* <code>repeated .ErrorResponse underlying_errors = 4;</code>
*/
int getUnderlyingErrorsCount();
/**
* <code>repeated .ErrorResponse underlying_errors = 4;</code>
*/
java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponseOrBuilder>
getUnderlyingErrorsOrBuilderList();
/**
* <code>repeated .ErrorResponse underlying_errors = 4;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponseOrBuilder getUnderlyingErrorsOrBuilder(
int index);
/**
* <code>repeated .NameValuePair name_value_pair = 5;</code>
*/
java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair>
getNameValuePairList();
/**
* <code>repeated .NameValuePair name_value_pair = 5;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair getNameValuePair(int index);
/**
* <code>repeated .NameValuePair name_value_pair = 5;</code>
*/
int getNameValuePairCount();
/**
* <code>repeated .NameValuePair name_value_pair = 5;</code>
*/
java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder>
getNameValuePairOrBuilderList();
/**
* <code>repeated .NameValuePair name_value_pair = 5;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder getNameValuePairOrBuilder(
int index);
}
/**
* Protobuf type {@code ErrorResponse}
*/
public static final class ErrorResponse extends
com.google.protobuf.GeneratedMessage implements
// @@protoc_insertion_point(message_implements:ErrorResponse)
ErrorResponseOrBuilder {
// Use ErrorResponse.newBuilder() to construct.
private ErrorResponse(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private ErrorResponse(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final ErrorResponse defaultInstance;
public static ErrorResponse getDefaultInstance() {
return defaultInstance;
}
public ErrorResponse getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private ErrorResponse(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
com.google.protobuf.ByteString bs = input.readBytes();
bitField0_ |= 0x00000001;
domain_ = bs;
break;
}
case 16: {
bitField0_ |= 0x00000002;
errorCode_ = input.readInt32();
break;
}
case 26: {
com.google.protobuf.ByteString bs = input.readBytes();
bitField0_ |= 0x00000004;
errorDescription_ = bs;
break;
}
case 34: {
if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
underlyingErrors_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse>();
mutable_bitField0_ |= 0x00000008;
}
underlyingErrors_.add(input.readMessage(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.PARSER, extensionRegistry));
break;
}
case 42: {
if (!((mutable_bitField0_ & 0x00000010) == 0x00000010)) {
nameValuePair_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair>();
mutable_bitField0_ |= 0x00000010;
}
nameValuePair_.add(input.readMessage(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.PARSER, extensionRegistry));
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
underlyingErrors_ = java.util.Collections.unmodifiableList(underlyingErrors_);
}
if (((mutable_bitField0_ & 0x00000010) == 0x00000010)) {
nameValuePair_ = java.util.Collections.unmodifiableList(nameValuePair_);
}
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_ErrorResponse_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_ErrorResponse_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder.class);
}
public static com.google.protobuf.Parser<ErrorResponse> PARSER =
new com.google.protobuf.AbstractParser<ErrorResponse>() {
public ErrorResponse parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new ErrorResponse(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<ErrorResponse> getParserForType() {
return PARSER;
}
private int bitField0_;
public static final int DOMAIN_FIELD_NUMBER = 1;
private java.lang.Object domain_;
/**
* <code>required string domain = 1;</code>
*/
public boolean hasDomain() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required string domain = 1;</code>
*/
public java.lang.String getDomain() {
java.lang.Object ref = domain_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
domain_ = s;
}
return s;
}
}
/**
* <code>required string domain = 1;</code>
*/
public com.google.protobuf.ByteString
getDomainBytes() {
java.lang.Object ref = domain_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
domain_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int ERROR_CODE_FIELD_NUMBER = 2;
private int errorCode_;
/**
* <code>required int32 error_code = 2;</code>
*/
public boolean hasErrorCode() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required int32 error_code = 2;</code>
*/
public int getErrorCode() {
return errorCode_;
}
public static final int ERROR_DESCRIPTION_FIELD_NUMBER = 3;
private java.lang.Object errorDescription_;
/**
* <code>optional string error_description = 3;</code>
*/
public boolean hasErrorDescription() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>optional string error_description = 3;</code>
*/
public java.lang.String getErrorDescription() {
java.lang.Object ref = errorDescription_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
errorDescription_ = s;
}
return s;
}
}
/**
* <code>optional string error_description = 3;</code>
*/
public com.google.protobuf.ByteString
getErrorDescriptionBytes() {
java.lang.Object ref = errorDescription_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
errorDescription_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int UNDERLYING_ERRORS_FIELD_NUMBER = 4;
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse> underlyingErrors_;
/**
* <code>repeated .ErrorResponse underlying_errors = 4;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse> getUnderlyingErrorsList() {
return underlyingErrors_;
}
/**
* <code>repeated .ErrorResponse underlying_errors = 4;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponseOrBuilder>
getUnderlyingErrorsOrBuilderList() {
return underlyingErrors_;
}
/**
* <code>repeated .ErrorResponse underlying_errors = 4;</code>
*/
public int getUnderlyingErrorsCount() {
return underlyingErrors_.size();
}
/**
* <code>repeated .ErrorResponse underlying_errors = 4;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse getUnderlyingErrors(int index) {
return underlyingErrors_.get(index);
}
/**
* <code>repeated .ErrorResponse underlying_errors = 4;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponseOrBuilder getUnderlyingErrorsOrBuilder(
int index) {
return underlyingErrors_.get(index);
}
public static final int NAME_VALUE_PAIR_FIELD_NUMBER = 5;
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair> nameValuePair_;
/**
* <code>repeated .NameValuePair name_value_pair = 5;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair> getNameValuePairList() {
return nameValuePair_;
}
/**
* <code>repeated .NameValuePair name_value_pair = 5;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder>
getNameValuePairOrBuilderList() {
return nameValuePair_;
}
/**
* <code>repeated .NameValuePair name_value_pair = 5;</code>
*/
public int getNameValuePairCount() {
return nameValuePair_.size();
}
/**
* <code>repeated .NameValuePair name_value_pair = 5;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair getNameValuePair(int index) {
return nameValuePair_.get(index);
}
/**
* <code>repeated .NameValuePair name_value_pair = 5;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder getNameValuePairOrBuilder(
int index) {
return nameValuePair_.get(index);
}
private void initFields() {
domain_ = "";
errorCode_ = 0;
errorDescription_ = "";
underlyingErrors_ = java.util.Collections.emptyList();
nameValuePair_ = java.util.Collections.emptyList();
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
if (!hasDomain()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasErrorCode()) {
memoizedIsInitialized = 0;
return false;
}
for (int i = 0; i < getUnderlyingErrorsCount(); i++) {
if (!getUnderlyingErrors(i).isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
for (int i = 0; i < getNameValuePairCount(); i++) {
if (!getNameValuePair(i).isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeBytes(1, getDomainBytes());
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeInt32(2, errorCode_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
output.writeBytes(3, getErrorDescriptionBytes());
}
for (int i = 0; i < underlyingErrors_.size(); i++) {
output.writeMessage(4, underlyingErrors_.get(i));
}
for (int i = 0; i < nameValuePair_.size(); i++) {
output.writeMessage(5, nameValuePair_.get(i));
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(1, getDomainBytes());
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(2, errorCode_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(3, getErrorDescriptionBytes());
}
for (int i = 0; i < underlyingErrors_.size(); i++) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(4, underlyingErrors_.get(i));
}
for (int i = 0; i < nameValuePair_.size(); i++) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(5, nameValuePair_.get(i));
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code ErrorResponse}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:ErrorResponse)
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponseOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_ErrorResponse_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_ErrorResponse_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder.class);
}
// Construct using com.github.horrorho.inflatabledonkey.protocol.ChunkServer.ErrorResponse.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
getUnderlyingErrorsFieldBuilder();
getNameValuePairFieldBuilder();
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
domain_ = "";
bitField0_ = (bitField0_ & ~0x00000001);
errorCode_ = 0;
bitField0_ = (bitField0_ & ~0x00000002);
errorDescription_ = "";
bitField0_ = (bitField0_ & ~0x00000004);
if (underlyingErrorsBuilder_ == null) {
underlyingErrors_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000008);
} else {
underlyingErrorsBuilder_.clear();
}
if (nameValuePairBuilder_ == null) {
nameValuePair_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000010);
} else {
nameValuePairBuilder_.clear();
}
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_ErrorResponse_descriptor;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse getDefaultInstanceForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.getDefaultInstance();
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse build() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse buildPartial() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse result = new com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
result.domain_ = domain_;
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002;
}
result.errorCode_ = errorCode_;
if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
to_bitField0_ |= 0x00000004;
}
result.errorDescription_ = errorDescription_;
if (underlyingErrorsBuilder_ == null) {
if (((bitField0_ & 0x00000008) == 0x00000008)) {
underlyingErrors_ = java.util.Collections.unmodifiableList(underlyingErrors_);
bitField0_ = (bitField0_ & ~0x00000008);
}
result.underlyingErrors_ = underlyingErrors_;
} else {
result.underlyingErrors_ = underlyingErrorsBuilder_.build();
}
if (nameValuePairBuilder_ == null) {
if (((bitField0_ & 0x00000010) == 0x00000010)) {
nameValuePair_ = java.util.Collections.unmodifiableList(nameValuePair_);
bitField0_ = (bitField0_ & ~0x00000010);
}
result.nameValuePair_ = nameValuePair_;
} else {
result.nameValuePair_ = nameValuePairBuilder_.build();
}
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse) {
return mergeFrom((com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse other) {
if (other == com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.getDefaultInstance()) return this;
if (other.hasDomain()) {
bitField0_ |= 0x00000001;
domain_ = other.domain_;
onChanged();
}
if (other.hasErrorCode()) {
setErrorCode(other.getErrorCode());
}
if (other.hasErrorDescription()) {
bitField0_ |= 0x00000004;
errorDescription_ = other.errorDescription_;
onChanged();
}
if (underlyingErrorsBuilder_ == null) {
if (!other.underlyingErrors_.isEmpty()) {
if (underlyingErrors_.isEmpty()) {
underlyingErrors_ = other.underlyingErrors_;
bitField0_ = (bitField0_ & ~0x00000008);
} else {
ensureUnderlyingErrorsIsMutable();
underlyingErrors_.addAll(other.underlyingErrors_);
}
onChanged();
}
} else {
if (!other.underlyingErrors_.isEmpty()) {
if (underlyingErrorsBuilder_.isEmpty()) {
underlyingErrorsBuilder_.dispose();
underlyingErrorsBuilder_ = null;
underlyingErrors_ = other.underlyingErrors_;
bitField0_ = (bitField0_ & ~0x00000008);
underlyingErrorsBuilder_ =
com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
getUnderlyingErrorsFieldBuilder() : null;
} else {
underlyingErrorsBuilder_.addAllMessages(other.underlyingErrors_);
}
}
}
if (nameValuePairBuilder_ == null) {
if (!other.nameValuePair_.isEmpty()) {
if (nameValuePair_.isEmpty()) {
nameValuePair_ = other.nameValuePair_;
bitField0_ = (bitField0_ & ~0x00000010);
} else {
ensureNameValuePairIsMutable();
nameValuePair_.addAll(other.nameValuePair_);
}
onChanged();
}
} else {
if (!other.nameValuePair_.isEmpty()) {
if (nameValuePairBuilder_.isEmpty()) {
nameValuePairBuilder_.dispose();
nameValuePairBuilder_ = null;
nameValuePair_ = other.nameValuePair_;
bitField0_ = (bitField0_ & ~0x00000010);
nameValuePairBuilder_ =
com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
getNameValuePairFieldBuilder() : null;
} else {
nameValuePairBuilder_.addAllMessages(other.nameValuePair_);
}
}
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
if (!hasDomain()) {
return false;
}
if (!hasErrorCode()) {
return false;
}
for (int i = 0; i < getUnderlyingErrorsCount(); i++) {
if (!getUnderlyingErrors(i).isInitialized()) {
return false;
}
}
for (int i = 0; i < getNameValuePairCount(); i++) {
if (!getNameValuePair(i).isInitialized()) {
return false;
}
}
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private java.lang.Object domain_ = "";
/**
* <code>required string domain = 1;</code>
*/
public boolean hasDomain() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required string domain = 1;</code>
*/
public java.lang.String getDomain() {
java.lang.Object ref = domain_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
domain_ = s;
}
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>required string domain = 1;</code>
*/
public com.google.protobuf.ByteString
getDomainBytes() {
java.lang.Object ref = domain_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
domain_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>required string domain = 1;</code>
*/
public Builder setDomain(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
domain_ = value;
onChanged();
return this;
}
/**
* <code>required string domain = 1;</code>
*/
public Builder clearDomain() {
bitField0_ = (bitField0_ & ~0x00000001);
domain_ = getDefaultInstance().getDomain();
onChanged();
return this;
}
/**
* <code>required string domain = 1;</code>
*/
public Builder setDomainBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
domain_ = value;
onChanged();
return this;
}
private int errorCode_ ;
/**
* <code>required int32 error_code = 2;</code>
*/
public boolean hasErrorCode() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required int32 error_code = 2;</code>
*/
public int getErrorCode() {
return errorCode_;
}
/**
* <code>required int32 error_code = 2;</code>
*/
public Builder setErrorCode(int value) {
bitField0_ |= 0x00000002;
errorCode_ = value;
onChanged();
return this;
}
/**
* <code>required int32 error_code = 2;</code>
*/
public Builder clearErrorCode() {
bitField0_ = (bitField0_ & ~0x00000002);
errorCode_ = 0;
onChanged();
return this;
}
private java.lang.Object errorDescription_ = "";
/**
* <code>optional string error_description = 3;</code>
*/
public boolean hasErrorDescription() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>optional string error_description = 3;</code>
*/
public java.lang.String getErrorDescription() {
java.lang.Object ref = errorDescription_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
errorDescription_ = s;
}
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>optional string error_description = 3;</code>
*/
public com.google.protobuf.ByteString
getErrorDescriptionBytes() {
java.lang.Object ref = errorDescription_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
errorDescription_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>optional string error_description = 3;</code>
*/
public Builder setErrorDescription(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000004;
errorDescription_ = value;
onChanged();
return this;
}
/**
* <code>optional string error_description = 3;</code>
*/
public Builder clearErrorDescription() {
bitField0_ = (bitField0_ & ~0x00000004);
errorDescription_ = getDefaultInstance().getErrorDescription();
onChanged();
return this;
}
/**
* <code>optional string error_description = 3;</code>
*/
public Builder setErrorDescriptionBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000004;
errorDescription_ = value;
onChanged();
return this;
}
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse> underlyingErrors_ =
java.util.Collections.emptyList();
private void ensureUnderlyingErrorsIsMutable() {
if (!((bitField0_ & 0x00000008) == 0x00000008)) {
underlyingErrors_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse>(underlyingErrors_);
bitField0_ |= 0x00000008;
}
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponseOrBuilder> underlyingErrorsBuilder_;
/**
* <code>repeated .ErrorResponse underlying_errors = 4;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse> getUnderlyingErrorsList() {
if (underlyingErrorsBuilder_ == null) {
return java.util.Collections.unmodifiableList(underlyingErrors_);
} else {
return underlyingErrorsBuilder_.getMessageList();
}
}
/**
* <code>repeated .ErrorResponse underlying_errors = 4;</code>
*/
public int getUnderlyingErrorsCount() {
if (underlyingErrorsBuilder_ == null) {
return underlyingErrors_.size();
} else {
return underlyingErrorsBuilder_.getCount();
}
}
/**
* <code>repeated .ErrorResponse underlying_errors = 4;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse getUnderlyingErrors(int index) {
if (underlyingErrorsBuilder_ == null) {
return underlyingErrors_.get(index);
} else {
return underlyingErrorsBuilder_.getMessage(index);
}
}
/**
* <code>repeated .ErrorResponse underlying_errors = 4;</code>
*/
public Builder setUnderlyingErrors(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse value) {
if (underlyingErrorsBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureUnderlyingErrorsIsMutable();
underlyingErrors_.set(index, value);
onChanged();
} else {
underlyingErrorsBuilder_.setMessage(index, value);
}
return this;
}
/**
* <code>repeated .ErrorResponse underlying_errors = 4;</code>
*/
public Builder setUnderlyingErrors(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder builderForValue) {
if (underlyingErrorsBuilder_ == null) {
ensureUnderlyingErrorsIsMutable();
underlyingErrors_.set(index, builderForValue.build());
onChanged();
} else {
underlyingErrorsBuilder_.setMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .ErrorResponse underlying_errors = 4;</code>
*/
public Builder addUnderlyingErrors(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse value) {
if (underlyingErrorsBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureUnderlyingErrorsIsMutable();
underlyingErrors_.add(value);
onChanged();
} else {
underlyingErrorsBuilder_.addMessage(value);
}
return this;
}
/**
* <code>repeated .ErrorResponse underlying_errors = 4;</code>
*/
public Builder addUnderlyingErrors(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse value) {
if (underlyingErrorsBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureUnderlyingErrorsIsMutable();
underlyingErrors_.add(index, value);
onChanged();
} else {
underlyingErrorsBuilder_.addMessage(index, value);
}
return this;
}
/**
* <code>repeated .ErrorResponse underlying_errors = 4;</code>
*/
public Builder addUnderlyingErrors(
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder builderForValue) {
if (underlyingErrorsBuilder_ == null) {
ensureUnderlyingErrorsIsMutable();
underlyingErrors_.add(builderForValue.build());
onChanged();
} else {
underlyingErrorsBuilder_.addMessage(builderForValue.build());
}
return this;
}
/**
* <code>repeated .ErrorResponse underlying_errors = 4;</code>
*/
public Builder addUnderlyingErrors(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder builderForValue) {
if (underlyingErrorsBuilder_ == null) {
ensureUnderlyingErrorsIsMutable();
underlyingErrors_.add(index, builderForValue.build());
onChanged();
} else {
underlyingErrorsBuilder_.addMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .ErrorResponse underlying_errors = 4;</code>
*/
public Builder addAllUnderlyingErrors(
java.lang.Iterable<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse> values) {
if (underlyingErrorsBuilder_ == null) {
ensureUnderlyingErrorsIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, underlyingErrors_);
onChanged();
} else {
underlyingErrorsBuilder_.addAllMessages(values);
}
return this;
}
/**
* <code>repeated .ErrorResponse underlying_errors = 4;</code>
*/
public Builder clearUnderlyingErrors() {
if (underlyingErrorsBuilder_ == null) {
underlyingErrors_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000008);
onChanged();
} else {
underlyingErrorsBuilder_.clear();
}
return this;
}
/**
* <code>repeated .ErrorResponse underlying_errors = 4;</code>
*/
public Builder removeUnderlyingErrors(int index) {
if (underlyingErrorsBuilder_ == null) {
ensureUnderlyingErrorsIsMutable();
underlyingErrors_.remove(index);
onChanged();
} else {
underlyingErrorsBuilder_.remove(index);
}
return this;
}
/**
* <code>repeated .ErrorResponse underlying_errors = 4;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder getUnderlyingErrorsBuilder(
int index) {
return getUnderlyingErrorsFieldBuilder().getBuilder(index);
}
/**
* <code>repeated .ErrorResponse underlying_errors = 4;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponseOrBuilder getUnderlyingErrorsOrBuilder(
int index) {
if (underlyingErrorsBuilder_ == null) {
return underlyingErrors_.get(index); } else {
return underlyingErrorsBuilder_.getMessageOrBuilder(index);
}
}
/**
* <code>repeated .ErrorResponse underlying_errors = 4;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponseOrBuilder>
getUnderlyingErrorsOrBuilderList() {
if (underlyingErrorsBuilder_ != null) {
return underlyingErrorsBuilder_.getMessageOrBuilderList();
} else {
return java.util.Collections.unmodifiableList(underlyingErrors_);
}
}
/**
* <code>repeated .ErrorResponse underlying_errors = 4;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder addUnderlyingErrorsBuilder() {
return getUnderlyingErrorsFieldBuilder().addBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.getDefaultInstance());
}
/**
* <code>repeated .ErrorResponse underlying_errors = 4;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder addUnderlyingErrorsBuilder(
int index) {
return getUnderlyingErrorsFieldBuilder().addBuilder(index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.getDefaultInstance());
}
/**
* <code>repeated .ErrorResponse underlying_errors = 4;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder>
getUnderlyingErrorsBuilderList() {
return getUnderlyingErrorsFieldBuilder().getBuilderList();
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponseOrBuilder>
getUnderlyingErrorsFieldBuilder() {
if (underlyingErrorsBuilder_ == null) {
underlyingErrorsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponseOrBuilder>(
underlyingErrors_,
((bitField0_ & 0x00000008) == 0x00000008),
getParentForChildren(),
isClean());
underlyingErrors_ = null;
}
return underlyingErrorsBuilder_;
}
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair> nameValuePair_ =
java.util.Collections.emptyList();
private void ensureNameValuePairIsMutable() {
if (!((bitField0_ & 0x00000010) == 0x00000010)) {
nameValuePair_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair>(nameValuePair_);
bitField0_ |= 0x00000010;
}
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder> nameValuePairBuilder_;
/**
* <code>repeated .NameValuePair name_value_pair = 5;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair> getNameValuePairList() {
if (nameValuePairBuilder_ == null) {
return java.util.Collections.unmodifiableList(nameValuePair_);
} else {
return nameValuePairBuilder_.getMessageList();
}
}
/**
* <code>repeated .NameValuePair name_value_pair = 5;</code>
*/
public int getNameValuePairCount() {
if (nameValuePairBuilder_ == null) {
return nameValuePair_.size();
} else {
return nameValuePairBuilder_.getCount();
}
}
/**
* <code>repeated .NameValuePair name_value_pair = 5;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair getNameValuePair(int index) {
if (nameValuePairBuilder_ == null) {
return nameValuePair_.get(index);
} else {
return nameValuePairBuilder_.getMessage(index);
}
}
/**
* <code>repeated .NameValuePair name_value_pair = 5;</code>
*/
public Builder setNameValuePair(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair value) {
if (nameValuePairBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureNameValuePairIsMutable();
nameValuePair_.set(index, value);
onChanged();
} else {
nameValuePairBuilder_.setMessage(index, value);
}
return this;
}
/**
* <code>repeated .NameValuePair name_value_pair = 5;</code>
*/
public Builder setNameValuePair(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder builderForValue) {
if (nameValuePairBuilder_ == null) {
ensureNameValuePairIsMutable();
nameValuePair_.set(index, builderForValue.build());
onChanged();
} else {
nameValuePairBuilder_.setMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .NameValuePair name_value_pair = 5;</code>
*/
public Builder addNameValuePair(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair value) {
if (nameValuePairBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureNameValuePairIsMutable();
nameValuePair_.add(value);
onChanged();
} else {
nameValuePairBuilder_.addMessage(value);
}
return this;
}
/**
* <code>repeated .NameValuePair name_value_pair = 5;</code>
*/
public Builder addNameValuePair(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair value) {
if (nameValuePairBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureNameValuePairIsMutable();
nameValuePair_.add(index, value);
onChanged();
} else {
nameValuePairBuilder_.addMessage(index, value);
}
return this;
}
/**
* <code>repeated .NameValuePair name_value_pair = 5;</code>
*/
public Builder addNameValuePair(
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder builderForValue) {
if (nameValuePairBuilder_ == null) {
ensureNameValuePairIsMutable();
nameValuePair_.add(builderForValue.build());
onChanged();
} else {
nameValuePairBuilder_.addMessage(builderForValue.build());
}
return this;
}
/**
* <code>repeated .NameValuePair name_value_pair = 5;</code>
*/
public Builder addNameValuePair(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder builderForValue) {
if (nameValuePairBuilder_ == null) {
ensureNameValuePairIsMutable();
nameValuePair_.add(index, builderForValue.build());
onChanged();
} else {
nameValuePairBuilder_.addMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .NameValuePair name_value_pair = 5;</code>
*/
public Builder addAllNameValuePair(
java.lang.Iterable<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair> values) {
if (nameValuePairBuilder_ == null) {
ensureNameValuePairIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, nameValuePair_);
onChanged();
} else {
nameValuePairBuilder_.addAllMessages(values);
}
return this;
}
/**
* <code>repeated .NameValuePair name_value_pair = 5;</code>
*/
public Builder clearNameValuePair() {
if (nameValuePairBuilder_ == null) {
nameValuePair_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000010);
onChanged();
} else {
nameValuePairBuilder_.clear();
}
return this;
}
/**
* <code>repeated .NameValuePair name_value_pair = 5;</code>
*/
public Builder removeNameValuePair(int index) {
if (nameValuePairBuilder_ == null) {
ensureNameValuePairIsMutable();
nameValuePair_.remove(index);
onChanged();
} else {
nameValuePairBuilder_.remove(index);
}
return this;
}
/**
* <code>repeated .NameValuePair name_value_pair = 5;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder getNameValuePairBuilder(
int index) {
return getNameValuePairFieldBuilder().getBuilder(index);
}
/**
* <code>repeated .NameValuePair name_value_pair = 5;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder getNameValuePairOrBuilder(
int index) {
if (nameValuePairBuilder_ == null) {
return nameValuePair_.get(index); } else {
return nameValuePairBuilder_.getMessageOrBuilder(index);
}
}
/**
* <code>repeated .NameValuePair name_value_pair = 5;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder>
getNameValuePairOrBuilderList() {
if (nameValuePairBuilder_ != null) {
return nameValuePairBuilder_.getMessageOrBuilderList();
} else {
return java.util.Collections.unmodifiableList(nameValuePair_);
}
}
/**
* <code>repeated .NameValuePair name_value_pair = 5;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder addNameValuePairBuilder() {
return getNameValuePairFieldBuilder().addBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.getDefaultInstance());
}
/**
* <code>repeated .NameValuePair name_value_pair = 5;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder addNameValuePairBuilder(
int index) {
return getNameValuePairFieldBuilder().addBuilder(index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.getDefaultInstance());
}
/**
* <code>repeated .NameValuePair name_value_pair = 5;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder>
getNameValuePairBuilderList() {
return getNameValuePairFieldBuilder().getBuilderList();
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder>
getNameValuePairFieldBuilder() {
if (nameValuePairBuilder_ == null) {
nameValuePairBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder>(
nameValuePair_,
((bitField0_ & 0x00000010) == 0x00000010),
getParentForChildren(),
isClean());
nameValuePair_ = null;
}
return nameValuePairBuilder_;
}
// @@protoc_insertion_point(builder_scope:ErrorResponse)
}
static {
defaultInstance = new ErrorResponse(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:ErrorResponse)
}
public interface FileErrorOrBuilder extends
// @@protoc_insertion_point(interface_extends:FileError)
com.google.protobuf.MessageOrBuilder {
/**
* <code>required bytes file_checksum = 1;</code>
*/
boolean hasFileChecksum();
/**
* <code>required bytes file_checksum = 1;</code>
*/
com.google.protobuf.ByteString getFileChecksum();
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
boolean hasErrorResponse();
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse getErrorResponse();
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponseOrBuilder getErrorResponseOrBuilder();
}
/**
* Protobuf type {@code FileError}
*/
public static final class FileError extends
com.google.protobuf.GeneratedMessage implements
// @@protoc_insertion_point(message_implements:FileError)
FileErrorOrBuilder {
// Use FileError.newBuilder() to construct.
private FileError(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private FileError(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final FileError defaultInstance;
public static FileError getDefaultInstance() {
return defaultInstance;
}
public FileError getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private FileError(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
bitField0_ |= 0x00000001;
fileChecksum_ = input.readBytes();
break;
}
case 18: {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder subBuilder = null;
if (((bitField0_ & 0x00000002) == 0x00000002)) {
subBuilder = errorResponse_.toBuilder();
}
errorResponse_ = input.readMessage(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(errorResponse_);
errorResponse_ = subBuilder.buildPartial();
}
bitField0_ |= 0x00000002;
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileError_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileError_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError.Builder.class);
}
public static com.google.protobuf.Parser<FileError> PARSER =
new com.google.protobuf.AbstractParser<FileError>() {
public FileError parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new FileError(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<FileError> getParserForType() {
return PARSER;
}
private int bitField0_;
public static final int FILE_CHECKSUM_FIELD_NUMBER = 1;
private com.google.protobuf.ByteString fileChecksum_;
/**
* <code>required bytes file_checksum = 1;</code>
*/
public boolean hasFileChecksum() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required bytes file_checksum = 1;</code>
*/
public com.google.protobuf.ByteString getFileChecksum() {
return fileChecksum_;
}
public static final int ERROR_RESPONSE_FIELD_NUMBER = 2;
private com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse errorResponse_;
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public boolean hasErrorResponse() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse getErrorResponse() {
return errorResponse_;
}
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponseOrBuilder getErrorResponseOrBuilder() {
return errorResponse_;
}
private void initFields() {
fileChecksum_ = com.google.protobuf.ByteString.EMPTY;
errorResponse_ = com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.getDefaultInstance();
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
if (!hasFileChecksum()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasErrorResponse()) {
memoizedIsInitialized = 0;
return false;
}
if (!getErrorResponse().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeBytes(1, fileChecksum_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeMessage(2, errorResponse_);
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(1, fileChecksum_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(2, errorResponse_);
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code FileError}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:FileError)
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileErrorOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileError_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileError_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError.Builder.class);
}
// Construct using com.github.horrorho.inflatabledonkey.protocol.ChunkServer.FileError.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
getErrorResponseFieldBuilder();
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
fileChecksum_ = com.google.protobuf.ByteString.EMPTY;
bitField0_ = (bitField0_ & ~0x00000001);
if (errorResponseBuilder_ == null) {
errorResponse_ = com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.getDefaultInstance();
} else {
errorResponseBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00000002);
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileError_descriptor;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError getDefaultInstanceForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError.getDefaultInstance();
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError build() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError buildPartial() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError result = new com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
result.fileChecksum_ = fileChecksum_;
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002;
}
if (errorResponseBuilder_ == null) {
result.errorResponse_ = errorResponse_;
} else {
result.errorResponse_ = errorResponseBuilder_.build();
}
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError) {
return mergeFrom((com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError other) {
if (other == com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError.getDefaultInstance()) return this;
if (other.hasFileChecksum()) {
setFileChecksum(other.getFileChecksum());
}
if (other.hasErrorResponse()) {
mergeErrorResponse(other.getErrorResponse());
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
if (!hasFileChecksum()) {
return false;
}
if (!hasErrorResponse()) {
return false;
}
if (!getErrorResponse().isInitialized()) {
return false;
}
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private com.google.protobuf.ByteString fileChecksum_ = com.google.protobuf.ByteString.EMPTY;
/**
* <code>required bytes file_checksum = 1;</code>
*/
public boolean hasFileChecksum() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required bytes file_checksum = 1;</code>
*/
public com.google.protobuf.ByteString getFileChecksum() {
return fileChecksum_;
}
/**
* <code>required bytes file_checksum = 1;</code>
*/
public Builder setFileChecksum(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
fileChecksum_ = value;
onChanged();
return this;
}
/**
* <code>required bytes file_checksum = 1;</code>
*/
public Builder clearFileChecksum() {
bitField0_ = (bitField0_ & ~0x00000001);
fileChecksum_ = getDefaultInstance().getFileChecksum();
onChanged();
return this;
}
private com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse errorResponse_ = com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.getDefaultInstance();
private com.google.protobuf.SingleFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponseOrBuilder> errorResponseBuilder_;
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public boolean hasErrorResponse() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse getErrorResponse() {
if (errorResponseBuilder_ == null) {
return errorResponse_;
} else {
return errorResponseBuilder_.getMessage();
}
}
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public Builder setErrorResponse(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse value) {
if (errorResponseBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
errorResponse_ = value;
onChanged();
} else {
errorResponseBuilder_.setMessage(value);
}
bitField0_ |= 0x00000002;
return this;
}
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public Builder setErrorResponse(
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder builderForValue) {
if (errorResponseBuilder_ == null) {
errorResponse_ = builderForValue.build();
onChanged();
} else {
errorResponseBuilder_.setMessage(builderForValue.build());
}
bitField0_ |= 0x00000002;
return this;
}
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public Builder mergeErrorResponse(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse value) {
if (errorResponseBuilder_ == null) {
if (((bitField0_ & 0x00000002) == 0x00000002) &&
errorResponse_ != com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.getDefaultInstance()) {
errorResponse_ =
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.newBuilder(errorResponse_).mergeFrom(value).buildPartial();
} else {
errorResponse_ = value;
}
onChanged();
} else {
errorResponseBuilder_.mergeFrom(value);
}
bitField0_ |= 0x00000002;
return this;
}
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public Builder clearErrorResponse() {
if (errorResponseBuilder_ == null) {
errorResponse_ = com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.getDefaultInstance();
onChanged();
} else {
errorResponseBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00000002);
return this;
}
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder getErrorResponseBuilder() {
bitField0_ |= 0x00000002;
onChanged();
return getErrorResponseFieldBuilder().getBuilder();
}
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponseOrBuilder getErrorResponseOrBuilder() {
if (errorResponseBuilder_ != null) {
return errorResponseBuilder_.getMessageOrBuilder();
} else {
return errorResponse_;
}
}
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
private com.google.protobuf.SingleFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponseOrBuilder>
getErrorResponseFieldBuilder() {
if (errorResponseBuilder_ == null) {
errorResponseBuilder_ = new com.google.protobuf.SingleFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponseOrBuilder>(
getErrorResponse(),
getParentForChildren(),
isClean());
errorResponse_ = null;
}
return errorResponseBuilder_;
}
// @@protoc_insertion_point(builder_scope:FileError)
}
static {
defaultInstance = new FileError(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:FileError)
}
public interface ChunkErrorOrBuilder extends
// @@protoc_insertion_point(interface_extends:ChunkError)
com.google.protobuf.MessageOrBuilder {
/**
* <code>required bytes chunk_checksum = 1;</code>
*/
boolean hasChunkChecksum();
/**
* <code>required bytes chunk_checksum = 1;</code>
*/
com.google.protobuf.ByteString getChunkChecksum();
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
boolean hasErrorResponse();
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse getErrorResponse();
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponseOrBuilder getErrorResponseOrBuilder();
}
/**
* Protobuf type {@code ChunkError}
*/
public static final class ChunkError extends
com.google.protobuf.GeneratedMessage implements
// @@protoc_insertion_point(message_implements:ChunkError)
ChunkErrorOrBuilder {
// Use ChunkError.newBuilder() to construct.
private ChunkError(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private ChunkError(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final ChunkError defaultInstance;
public static ChunkError getDefaultInstance() {
return defaultInstance;
}
public ChunkError getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private ChunkError(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
bitField0_ |= 0x00000001;
chunkChecksum_ = input.readBytes();
break;
}
case 18: {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder subBuilder = null;
if (((bitField0_ & 0x00000002) == 0x00000002)) {
subBuilder = errorResponse_.toBuilder();
}
errorResponse_ = input.readMessage(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(errorResponse_);
errorResponse_ = subBuilder.buildPartial();
}
bitField0_ |= 0x00000002;
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_ChunkError_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_ChunkError_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError.Builder.class);
}
public static com.google.protobuf.Parser<ChunkError> PARSER =
new com.google.protobuf.AbstractParser<ChunkError>() {
public ChunkError parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new ChunkError(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<ChunkError> getParserForType() {
return PARSER;
}
private int bitField0_;
public static final int CHUNK_CHECKSUM_FIELD_NUMBER = 1;
private com.google.protobuf.ByteString chunkChecksum_;
/**
* <code>required bytes chunk_checksum = 1;</code>
*/
public boolean hasChunkChecksum() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required bytes chunk_checksum = 1;</code>
*/
public com.google.protobuf.ByteString getChunkChecksum() {
return chunkChecksum_;
}
public static final int ERROR_RESPONSE_FIELD_NUMBER = 2;
private com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse errorResponse_;
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public boolean hasErrorResponse() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse getErrorResponse() {
return errorResponse_;
}
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponseOrBuilder getErrorResponseOrBuilder() {
return errorResponse_;
}
private void initFields() {
chunkChecksum_ = com.google.protobuf.ByteString.EMPTY;
errorResponse_ = com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.getDefaultInstance();
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
if (!hasChunkChecksum()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasErrorResponse()) {
memoizedIsInitialized = 0;
return false;
}
if (!getErrorResponse().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeBytes(1, chunkChecksum_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeMessage(2, errorResponse_);
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(1, chunkChecksum_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(2, errorResponse_);
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code ChunkError}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:ChunkError)
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_ChunkError_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_ChunkError_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError.Builder.class);
}
// Construct using com.github.horrorho.inflatabledonkey.protocol.ChunkServer.ChunkError.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
getErrorResponseFieldBuilder();
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
chunkChecksum_ = com.google.protobuf.ByteString.EMPTY;
bitField0_ = (bitField0_ & ~0x00000001);
if (errorResponseBuilder_ == null) {
errorResponse_ = com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.getDefaultInstance();
} else {
errorResponseBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00000002);
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_ChunkError_descriptor;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError getDefaultInstanceForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError.getDefaultInstance();
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError build() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError buildPartial() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError result = new com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
result.chunkChecksum_ = chunkChecksum_;
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002;
}
if (errorResponseBuilder_ == null) {
result.errorResponse_ = errorResponse_;
} else {
result.errorResponse_ = errorResponseBuilder_.build();
}
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError) {
return mergeFrom((com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError other) {
if (other == com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError.getDefaultInstance()) return this;
if (other.hasChunkChecksum()) {
setChunkChecksum(other.getChunkChecksum());
}
if (other.hasErrorResponse()) {
mergeErrorResponse(other.getErrorResponse());
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
if (!hasChunkChecksum()) {
return false;
}
if (!hasErrorResponse()) {
return false;
}
if (!getErrorResponse().isInitialized()) {
return false;
}
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private com.google.protobuf.ByteString chunkChecksum_ = com.google.protobuf.ByteString.EMPTY;
/**
* <code>required bytes chunk_checksum = 1;</code>
*/
public boolean hasChunkChecksum() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required bytes chunk_checksum = 1;</code>
*/
public com.google.protobuf.ByteString getChunkChecksum() {
return chunkChecksum_;
}
/**
* <code>required bytes chunk_checksum = 1;</code>
*/
public Builder setChunkChecksum(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
chunkChecksum_ = value;
onChanged();
return this;
}
/**
* <code>required bytes chunk_checksum = 1;</code>
*/
public Builder clearChunkChecksum() {
bitField0_ = (bitField0_ & ~0x00000001);
chunkChecksum_ = getDefaultInstance().getChunkChecksum();
onChanged();
return this;
}
private com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse errorResponse_ = com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.getDefaultInstance();
private com.google.protobuf.SingleFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponseOrBuilder> errorResponseBuilder_;
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public boolean hasErrorResponse() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse getErrorResponse() {
if (errorResponseBuilder_ == null) {
return errorResponse_;
} else {
return errorResponseBuilder_.getMessage();
}
}
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public Builder setErrorResponse(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse value) {
if (errorResponseBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
errorResponse_ = value;
onChanged();
} else {
errorResponseBuilder_.setMessage(value);
}
bitField0_ |= 0x00000002;
return this;
}
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public Builder setErrorResponse(
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder builderForValue) {
if (errorResponseBuilder_ == null) {
errorResponse_ = builderForValue.build();
onChanged();
} else {
errorResponseBuilder_.setMessage(builderForValue.build());
}
bitField0_ |= 0x00000002;
return this;
}
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public Builder mergeErrorResponse(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse value) {
if (errorResponseBuilder_ == null) {
if (((bitField0_ & 0x00000002) == 0x00000002) &&
errorResponse_ != com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.getDefaultInstance()) {
errorResponse_ =
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.newBuilder(errorResponse_).mergeFrom(value).buildPartial();
} else {
errorResponse_ = value;
}
onChanged();
} else {
errorResponseBuilder_.mergeFrom(value);
}
bitField0_ |= 0x00000002;
return this;
}
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public Builder clearErrorResponse() {
if (errorResponseBuilder_ == null) {
errorResponse_ = com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.getDefaultInstance();
onChanged();
} else {
errorResponseBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00000002);
return this;
}
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder getErrorResponseBuilder() {
bitField0_ |= 0x00000002;
onChanged();
return getErrorResponseFieldBuilder().getBuilder();
}
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponseOrBuilder getErrorResponseOrBuilder() {
if (errorResponseBuilder_ != null) {
return errorResponseBuilder_.getMessageOrBuilder();
} else {
return errorResponse_;
}
}
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
private com.google.protobuf.SingleFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponseOrBuilder>
getErrorResponseFieldBuilder() {
if (errorResponseBuilder_ == null) {
errorResponseBuilder_ = new com.google.protobuf.SingleFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponseOrBuilder>(
getErrorResponse(),
getParentForChildren(),
isClean());
errorResponse_ = null;
}
return errorResponseBuilder_;
}
// @@protoc_insertion_point(builder_scope:ChunkError)
}
static {
defaultInstance = new ChunkError(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:ChunkError)
}
public interface ChunkErrorIndexOrBuilder extends
// @@protoc_insertion_point(interface_extends:ChunkErrorIndex)
com.google.protobuf.MessageOrBuilder {
/**
* <code>required bytes chunk_checksum = 1;</code>
*/
boolean hasChunkChecksum();
/**
* <code>required bytes chunk_checksum = 1;</code>
*/
com.google.protobuf.ByteString getChunkChecksum();
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
boolean hasErrorResponse();
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse getErrorResponse();
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponseOrBuilder getErrorResponseOrBuilder();
/**
* <code>required uint32 chunk_index = 3;</code>
*/
boolean hasChunkIndex();
/**
* <code>required uint32 chunk_index = 3;</code>
*/
int getChunkIndex();
}
/**
* Protobuf type {@code ChunkErrorIndex}
*/
public static final class ChunkErrorIndex extends
com.google.protobuf.GeneratedMessage implements
// @@protoc_insertion_point(message_implements:ChunkErrorIndex)
ChunkErrorIndexOrBuilder {
// Use ChunkErrorIndex.newBuilder() to construct.
private ChunkErrorIndex(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private ChunkErrorIndex(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final ChunkErrorIndex defaultInstance;
public static ChunkErrorIndex getDefaultInstance() {
return defaultInstance;
}
public ChunkErrorIndex getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private ChunkErrorIndex(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
bitField0_ |= 0x00000001;
chunkChecksum_ = input.readBytes();
break;
}
case 18: {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder subBuilder = null;
if (((bitField0_ & 0x00000002) == 0x00000002)) {
subBuilder = errorResponse_.toBuilder();
}
errorResponse_ = input.readMessage(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(errorResponse_);
errorResponse_ = subBuilder.buildPartial();
}
bitField0_ |= 0x00000002;
break;
}
case 24: {
bitField0_ |= 0x00000004;
chunkIndex_ = input.readUInt32();
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_ChunkErrorIndex_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_ChunkErrorIndex_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex.Builder.class);
}
public static com.google.protobuf.Parser<ChunkErrorIndex> PARSER =
new com.google.protobuf.AbstractParser<ChunkErrorIndex>() {
public ChunkErrorIndex parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new ChunkErrorIndex(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<ChunkErrorIndex> getParserForType() {
return PARSER;
}
private int bitField0_;
public static final int CHUNK_CHECKSUM_FIELD_NUMBER = 1;
private com.google.protobuf.ByteString chunkChecksum_;
/**
* <code>required bytes chunk_checksum = 1;</code>
*/
public boolean hasChunkChecksum() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required bytes chunk_checksum = 1;</code>
*/
public com.google.protobuf.ByteString getChunkChecksum() {
return chunkChecksum_;
}
public static final int ERROR_RESPONSE_FIELD_NUMBER = 2;
private com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse errorResponse_;
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public boolean hasErrorResponse() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse getErrorResponse() {
return errorResponse_;
}
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponseOrBuilder getErrorResponseOrBuilder() {
return errorResponse_;
}
public static final int CHUNK_INDEX_FIELD_NUMBER = 3;
private int chunkIndex_;
/**
* <code>required uint32 chunk_index = 3;</code>
*/
public boolean hasChunkIndex() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>required uint32 chunk_index = 3;</code>
*/
public int getChunkIndex() {
return chunkIndex_;
}
private void initFields() {
chunkChecksum_ = com.google.protobuf.ByteString.EMPTY;
errorResponse_ = com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.getDefaultInstance();
chunkIndex_ = 0;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
if (!hasChunkChecksum()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasErrorResponse()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasChunkIndex()) {
memoizedIsInitialized = 0;
return false;
}
if (!getErrorResponse().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeBytes(1, chunkChecksum_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeMessage(2, errorResponse_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
output.writeUInt32(3, chunkIndex_);
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(1, chunkChecksum_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(2, errorResponse_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
size += com.google.protobuf.CodedOutputStream
.computeUInt32Size(3, chunkIndex_);
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code ChunkErrorIndex}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:ChunkErrorIndex)
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndexOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_ChunkErrorIndex_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_ChunkErrorIndex_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex.Builder.class);
}
// Construct using com.github.horrorho.inflatabledonkey.protocol.ChunkServer.ChunkErrorIndex.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
getErrorResponseFieldBuilder();
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
chunkChecksum_ = com.google.protobuf.ByteString.EMPTY;
bitField0_ = (bitField0_ & ~0x00000001);
if (errorResponseBuilder_ == null) {
errorResponse_ = com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.getDefaultInstance();
} else {
errorResponseBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00000002);
chunkIndex_ = 0;
bitField0_ = (bitField0_ & ~0x00000004);
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_ChunkErrorIndex_descriptor;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex getDefaultInstanceForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex.getDefaultInstance();
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex build() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex buildPartial() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex result = new com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
result.chunkChecksum_ = chunkChecksum_;
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002;
}
if (errorResponseBuilder_ == null) {
result.errorResponse_ = errorResponse_;
} else {
result.errorResponse_ = errorResponseBuilder_.build();
}
if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
to_bitField0_ |= 0x00000004;
}
result.chunkIndex_ = chunkIndex_;
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex) {
return mergeFrom((com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex other) {
if (other == com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex.getDefaultInstance()) return this;
if (other.hasChunkChecksum()) {
setChunkChecksum(other.getChunkChecksum());
}
if (other.hasErrorResponse()) {
mergeErrorResponse(other.getErrorResponse());
}
if (other.hasChunkIndex()) {
setChunkIndex(other.getChunkIndex());
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
if (!hasChunkChecksum()) {
return false;
}
if (!hasErrorResponse()) {
return false;
}
if (!hasChunkIndex()) {
return false;
}
if (!getErrorResponse().isInitialized()) {
return false;
}
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private com.google.protobuf.ByteString chunkChecksum_ = com.google.protobuf.ByteString.EMPTY;
/**
* <code>required bytes chunk_checksum = 1;</code>
*/
public boolean hasChunkChecksum() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required bytes chunk_checksum = 1;</code>
*/
public com.google.protobuf.ByteString getChunkChecksum() {
return chunkChecksum_;
}
/**
* <code>required bytes chunk_checksum = 1;</code>
*/
public Builder setChunkChecksum(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
chunkChecksum_ = value;
onChanged();
return this;
}
/**
* <code>required bytes chunk_checksum = 1;</code>
*/
public Builder clearChunkChecksum() {
bitField0_ = (bitField0_ & ~0x00000001);
chunkChecksum_ = getDefaultInstance().getChunkChecksum();
onChanged();
return this;
}
private com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse errorResponse_ = com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.getDefaultInstance();
private com.google.protobuf.SingleFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponseOrBuilder> errorResponseBuilder_;
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public boolean hasErrorResponse() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse getErrorResponse() {
if (errorResponseBuilder_ == null) {
return errorResponse_;
} else {
return errorResponseBuilder_.getMessage();
}
}
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public Builder setErrorResponse(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse value) {
if (errorResponseBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
errorResponse_ = value;
onChanged();
} else {
errorResponseBuilder_.setMessage(value);
}
bitField0_ |= 0x00000002;
return this;
}
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public Builder setErrorResponse(
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder builderForValue) {
if (errorResponseBuilder_ == null) {
errorResponse_ = builderForValue.build();
onChanged();
} else {
errorResponseBuilder_.setMessage(builderForValue.build());
}
bitField0_ |= 0x00000002;
return this;
}
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public Builder mergeErrorResponse(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse value) {
if (errorResponseBuilder_ == null) {
if (((bitField0_ & 0x00000002) == 0x00000002) &&
errorResponse_ != com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.getDefaultInstance()) {
errorResponse_ =
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.newBuilder(errorResponse_).mergeFrom(value).buildPartial();
} else {
errorResponse_ = value;
}
onChanged();
} else {
errorResponseBuilder_.mergeFrom(value);
}
bitField0_ |= 0x00000002;
return this;
}
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public Builder clearErrorResponse() {
if (errorResponseBuilder_ == null) {
errorResponse_ = com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.getDefaultInstance();
onChanged();
} else {
errorResponseBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00000002);
return this;
}
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder getErrorResponseBuilder() {
bitField0_ |= 0x00000002;
onChanged();
return getErrorResponseFieldBuilder().getBuilder();
}
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponseOrBuilder getErrorResponseOrBuilder() {
if (errorResponseBuilder_ != null) {
return errorResponseBuilder_.getMessageOrBuilder();
} else {
return errorResponse_;
}
}
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
private com.google.protobuf.SingleFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponseOrBuilder>
getErrorResponseFieldBuilder() {
if (errorResponseBuilder_ == null) {
errorResponseBuilder_ = new com.google.protobuf.SingleFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponseOrBuilder>(
getErrorResponse(),
getParentForChildren(),
isClean());
errorResponse_ = null;
}
return errorResponseBuilder_;
}
private int chunkIndex_ ;
/**
* <code>required uint32 chunk_index = 3;</code>
*/
public boolean hasChunkIndex() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>required uint32 chunk_index = 3;</code>
*/
public int getChunkIndex() {
return chunkIndex_;
}
/**
* <code>required uint32 chunk_index = 3;</code>
*/
public Builder setChunkIndex(int value) {
bitField0_ |= 0x00000004;
chunkIndex_ = value;
onChanged();
return this;
}
/**
* <code>required uint32 chunk_index = 3;</code>
*/
public Builder clearChunkIndex() {
bitField0_ = (bitField0_ & ~0x00000004);
chunkIndex_ = 0;
onChanged();
return this;
}
// @@protoc_insertion_point(builder_scope:ChunkErrorIndex)
}
static {
defaultInstance = new ChunkErrorIndex(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:ChunkErrorIndex)
}
public interface FileChunkErrorOrBuilder extends
// @@protoc_insertion_point(interface_extends:FileChunkError)
com.google.protobuf.MessageOrBuilder {
/**
* <code>required bytes file_checksum = 1;</code>
*/
boolean hasFileChecksum();
/**
* <code>required bytes file_checksum = 1;</code>
*/
com.google.protobuf.ByteString getFileChecksum();
/**
* <code>repeated .ChunkErrorIndex chunk_error = 2;</code>
*/
java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex>
getChunkErrorList();
/**
* <code>repeated .ChunkErrorIndex chunk_error = 2;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex getChunkError(int index);
/**
* <code>repeated .ChunkErrorIndex chunk_error = 2;</code>
*/
int getChunkErrorCount();
/**
* <code>repeated .ChunkErrorIndex chunk_error = 2;</code>
*/
java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndexOrBuilder>
getChunkErrorOrBuilderList();
/**
* <code>repeated .ChunkErrorIndex chunk_error = 2;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndexOrBuilder getChunkErrorOrBuilder(
int index);
}
/**
* Protobuf type {@code FileChunkError}
*/
public static final class FileChunkError extends
com.google.protobuf.GeneratedMessage implements
// @@protoc_insertion_point(message_implements:FileChunkError)
FileChunkErrorOrBuilder {
// Use FileChunkError.newBuilder() to construct.
private FileChunkError(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private FileChunkError(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final FileChunkError defaultInstance;
public static FileChunkError getDefaultInstance() {
return defaultInstance;
}
public FileChunkError getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private FileChunkError(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
bitField0_ |= 0x00000001;
fileChecksum_ = input.readBytes();
break;
}
case 18: {
if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
chunkError_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex>();
mutable_bitField0_ |= 0x00000002;
}
chunkError_.add(input.readMessage(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex.PARSER, extensionRegistry));
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
chunkError_ = java.util.Collections.unmodifiableList(chunkError_);
}
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileChunkError_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileChunkError_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError.Builder.class);
}
public static com.google.protobuf.Parser<FileChunkError> PARSER =
new com.google.protobuf.AbstractParser<FileChunkError>() {
public FileChunkError parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new FileChunkError(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<FileChunkError> getParserForType() {
return PARSER;
}
private int bitField0_;
public static final int FILE_CHECKSUM_FIELD_NUMBER = 1;
private com.google.protobuf.ByteString fileChecksum_;
/**
* <code>required bytes file_checksum = 1;</code>
*/
public boolean hasFileChecksum() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required bytes file_checksum = 1;</code>
*/
public com.google.protobuf.ByteString getFileChecksum() {
return fileChecksum_;
}
public static final int CHUNK_ERROR_FIELD_NUMBER = 2;
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex> chunkError_;
/**
* <code>repeated .ChunkErrorIndex chunk_error = 2;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex> getChunkErrorList() {
return chunkError_;
}
/**
* <code>repeated .ChunkErrorIndex chunk_error = 2;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndexOrBuilder>
getChunkErrorOrBuilderList() {
return chunkError_;
}
/**
* <code>repeated .ChunkErrorIndex chunk_error = 2;</code>
*/
public int getChunkErrorCount() {
return chunkError_.size();
}
/**
* <code>repeated .ChunkErrorIndex chunk_error = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex getChunkError(int index) {
return chunkError_.get(index);
}
/**
* <code>repeated .ChunkErrorIndex chunk_error = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndexOrBuilder getChunkErrorOrBuilder(
int index) {
return chunkError_.get(index);
}
private void initFields() {
fileChecksum_ = com.google.protobuf.ByteString.EMPTY;
chunkError_ = java.util.Collections.emptyList();
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
if (!hasFileChecksum()) {
memoizedIsInitialized = 0;
return false;
}
for (int i = 0; i < getChunkErrorCount(); i++) {
if (!getChunkError(i).isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeBytes(1, fileChecksum_);
}
for (int i = 0; i < chunkError_.size(); i++) {
output.writeMessage(2, chunkError_.get(i));
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(1, fileChecksum_);
}
for (int i = 0; i < chunkError_.size(); i++) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(2, chunkError_.get(i));
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code FileChunkError}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:FileChunkError)
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkErrorOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileChunkError_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileChunkError_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError.Builder.class);
}
// Construct using com.github.horrorho.inflatabledonkey.protocol.ChunkServer.FileChunkError.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
getChunkErrorFieldBuilder();
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
fileChecksum_ = com.google.protobuf.ByteString.EMPTY;
bitField0_ = (bitField0_ & ~0x00000001);
if (chunkErrorBuilder_ == null) {
chunkError_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000002);
} else {
chunkErrorBuilder_.clear();
}
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileChunkError_descriptor;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError getDefaultInstanceForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError.getDefaultInstance();
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError build() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError buildPartial() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError result = new com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
result.fileChecksum_ = fileChecksum_;
if (chunkErrorBuilder_ == null) {
if (((bitField0_ & 0x00000002) == 0x00000002)) {
chunkError_ = java.util.Collections.unmodifiableList(chunkError_);
bitField0_ = (bitField0_ & ~0x00000002);
}
result.chunkError_ = chunkError_;
} else {
result.chunkError_ = chunkErrorBuilder_.build();
}
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError) {
return mergeFrom((com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError other) {
if (other == com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError.getDefaultInstance()) return this;
if (other.hasFileChecksum()) {
setFileChecksum(other.getFileChecksum());
}
if (chunkErrorBuilder_ == null) {
if (!other.chunkError_.isEmpty()) {
if (chunkError_.isEmpty()) {
chunkError_ = other.chunkError_;
bitField0_ = (bitField0_ & ~0x00000002);
} else {
ensureChunkErrorIsMutable();
chunkError_.addAll(other.chunkError_);
}
onChanged();
}
} else {
if (!other.chunkError_.isEmpty()) {
if (chunkErrorBuilder_.isEmpty()) {
chunkErrorBuilder_.dispose();
chunkErrorBuilder_ = null;
chunkError_ = other.chunkError_;
bitField0_ = (bitField0_ & ~0x00000002);
chunkErrorBuilder_ =
com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
getChunkErrorFieldBuilder() : null;
} else {
chunkErrorBuilder_.addAllMessages(other.chunkError_);
}
}
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
if (!hasFileChecksum()) {
return false;
}
for (int i = 0; i < getChunkErrorCount(); i++) {
if (!getChunkError(i).isInitialized()) {
return false;
}
}
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private com.google.protobuf.ByteString fileChecksum_ = com.google.protobuf.ByteString.EMPTY;
/**
* <code>required bytes file_checksum = 1;</code>
*/
public boolean hasFileChecksum() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required bytes file_checksum = 1;</code>
*/
public com.google.protobuf.ByteString getFileChecksum() {
return fileChecksum_;
}
/**
* <code>required bytes file_checksum = 1;</code>
*/
public Builder setFileChecksum(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
fileChecksum_ = value;
onChanged();
return this;
}
/**
* <code>required bytes file_checksum = 1;</code>
*/
public Builder clearFileChecksum() {
bitField0_ = (bitField0_ & ~0x00000001);
fileChecksum_ = getDefaultInstance().getFileChecksum();
onChanged();
return this;
}
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex> chunkError_ =
java.util.Collections.emptyList();
private void ensureChunkErrorIsMutable() {
if (!((bitField0_ & 0x00000002) == 0x00000002)) {
chunkError_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex>(chunkError_);
bitField0_ |= 0x00000002;
}
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndexOrBuilder> chunkErrorBuilder_;
/**
* <code>repeated .ChunkErrorIndex chunk_error = 2;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex> getChunkErrorList() {
if (chunkErrorBuilder_ == null) {
return java.util.Collections.unmodifiableList(chunkError_);
} else {
return chunkErrorBuilder_.getMessageList();
}
}
/**
* <code>repeated .ChunkErrorIndex chunk_error = 2;</code>
*/
public int getChunkErrorCount() {
if (chunkErrorBuilder_ == null) {
return chunkError_.size();
} else {
return chunkErrorBuilder_.getCount();
}
}
/**
* <code>repeated .ChunkErrorIndex chunk_error = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex getChunkError(int index) {
if (chunkErrorBuilder_ == null) {
return chunkError_.get(index);
} else {
return chunkErrorBuilder_.getMessage(index);
}
}
/**
* <code>repeated .ChunkErrorIndex chunk_error = 2;</code>
*/
public Builder setChunkError(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex value) {
if (chunkErrorBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureChunkErrorIsMutable();
chunkError_.set(index, value);
onChanged();
} else {
chunkErrorBuilder_.setMessage(index, value);
}
return this;
}
/**
* <code>repeated .ChunkErrorIndex chunk_error = 2;</code>
*/
public Builder setChunkError(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex.Builder builderForValue) {
if (chunkErrorBuilder_ == null) {
ensureChunkErrorIsMutable();
chunkError_.set(index, builderForValue.build());
onChanged();
} else {
chunkErrorBuilder_.setMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .ChunkErrorIndex chunk_error = 2;</code>
*/
public Builder addChunkError(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex value) {
if (chunkErrorBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureChunkErrorIsMutable();
chunkError_.add(value);
onChanged();
} else {
chunkErrorBuilder_.addMessage(value);
}
return this;
}
/**
* <code>repeated .ChunkErrorIndex chunk_error = 2;</code>
*/
public Builder addChunkError(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex value) {
if (chunkErrorBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureChunkErrorIsMutable();
chunkError_.add(index, value);
onChanged();
} else {
chunkErrorBuilder_.addMessage(index, value);
}
return this;
}
/**
* <code>repeated .ChunkErrorIndex chunk_error = 2;</code>
*/
public Builder addChunkError(
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex.Builder builderForValue) {
if (chunkErrorBuilder_ == null) {
ensureChunkErrorIsMutable();
chunkError_.add(builderForValue.build());
onChanged();
} else {
chunkErrorBuilder_.addMessage(builderForValue.build());
}
return this;
}
/**
* <code>repeated .ChunkErrorIndex chunk_error = 2;</code>
*/
public Builder addChunkError(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex.Builder builderForValue) {
if (chunkErrorBuilder_ == null) {
ensureChunkErrorIsMutable();
chunkError_.add(index, builderForValue.build());
onChanged();
} else {
chunkErrorBuilder_.addMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .ChunkErrorIndex chunk_error = 2;</code>
*/
public Builder addAllChunkError(
java.lang.Iterable<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex> values) {
if (chunkErrorBuilder_ == null) {
ensureChunkErrorIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, chunkError_);
onChanged();
} else {
chunkErrorBuilder_.addAllMessages(values);
}
return this;
}
/**
* <code>repeated .ChunkErrorIndex chunk_error = 2;</code>
*/
public Builder clearChunkError() {
if (chunkErrorBuilder_ == null) {
chunkError_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000002);
onChanged();
} else {
chunkErrorBuilder_.clear();
}
return this;
}
/**
* <code>repeated .ChunkErrorIndex chunk_error = 2;</code>
*/
public Builder removeChunkError(int index) {
if (chunkErrorBuilder_ == null) {
ensureChunkErrorIsMutable();
chunkError_.remove(index);
onChanged();
} else {
chunkErrorBuilder_.remove(index);
}
return this;
}
/**
* <code>repeated .ChunkErrorIndex chunk_error = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex.Builder getChunkErrorBuilder(
int index) {
return getChunkErrorFieldBuilder().getBuilder(index);
}
/**
* <code>repeated .ChunkErrorIndex chunk_error = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndexOrBuilder getChunkErrorOrBuilder(
int index) {
if (chunkErrorBuilder_ == null) {
return chunkError_.get(index); } else {
return chunkErrorBuilder_.getMessageOrBuilder(index);
}
}
/**
* <code>repeated .ChunkErrorIndex chunk_error = 2;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndexOrBuilder>
getChunkErrorOrBuilderList() {
if (chunkErrorBuilder_ != null) {
return chunkErrorBuilder_.getMessageOrBuilderList();
} else {
return java.util.Collections.unmodifiableList(chunkError_);
}
}
/**
* <code>repeated .ChunkErrorIndex chunk_error = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex.Builder addChunkErrorBuilder() {
return getChunkErrorFieldBuilder().addBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex.getDefaultInstance());
}
/**
* <code>repeated .ChunkErrorIndex chunk_error = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex.Builder addChunkErrorBuilder(
int index) {
return getChunkErrorFieldBuilder().addBuilder(index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex.getDefaultInstance());
}
/**
* <code>repeated .ChunkErrorIndex chunk_error = 2;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex.Builder>
getChunkErrorBuilderList() {
return getChunkErrorFieldBuilder().getBuilderList();
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndexOrBuilder>
getChunkErrorFieldBuilder() {
if (chunkErrorBuilder_ == null) {
chunkErrorBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndex.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorIndexOrBuilder>(
chunkError_,
((bitField0_ & 0x00000002) == 0x00000002),
getParentForChildren(),
isClean());
chunkError_ = null;
}
return chunkErrorBuilder_;
}
// @@protoc_insertion_point(builder_scope:FileChunkError)
}
static {
defaultInstance = new FileChunkError(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:FileChunkError)
}
public interface StorageContainerErrorOrBuilder extends
// @@protoc_insertion_point(interface_extends:StorageContainerError)
com.google.protobuf.MessageOrBuilder {
/**
* <code>required string storage_container_key = 1;</code>
*/
boolean hasStorageContainerKey();
/**
* <code>required string storage_container_key = 1;</code>
*/
java.lang.String getStorageContainerKey();
/**
* <code>required string storage_container_key = 1;</code>
*/
com.google.protobuf.ByteString
getStorageContainerKeyBytes();
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
boolean hasErrorResponse();
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse getErrorResponse();
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponseOrBuilder getErrorResponseOrBuilder();
}
/**
* Protobuf type {@code StorageContainerError}
*/
public static final class StorageContainerError extends
com.google.protobuf.GeneratedMessage implements
// @@protoc_insertion_point(message_implements:StorageContainerError)
StorageContainerErrorOrBuilder {
// Use StorageContainerError.newBuilder() to construct.
private StorageContainerError(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private StorageContainerError(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final StorageContainerError defaultInstance;
public static StorageContainerError getDefaultInstance() {
return defaultInstance;
}
public StorageContainerError getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private StorageContainerError(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
com.google.protobuf.ByteString bs = input.readBytes();
bitField0_ |= 0x00000001;
storageContainerKey_ = bs;
break;
}
case 18: {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder subBuilder = null;
if (((bitField0_ & 0x00000002) == 0x00000002)) {
subBuilder = errorResponse_.toBuilder();
}
errorResponse_ = input.readMessage(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(errorResponse_);
errorResponse_ = subBuilder.buildPartial();
}
bitField0_ |= 0x00000002;
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_StorageContainerError_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_StorageContainerError_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError.Builder.class);
}
public static com.google.protobuf.Parser<StorageContainerError> PARSER =
new com.google.protobuf.AbstractParser<StorageContainerError>() {
public StorageContainerError parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new StorageContainerError(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<StorageContainerError> getParserForType() {
return PARSER;
}
private int bitField0_;
public static final int STORAGE_CONTAINER_KEY_FIELD_NUMBER = 1;
private java.lang.Object storageContainerKey_;
/**
* <code>required string storage_container_key = 1;</code>
*/
public boolean hasStorageContainerKey() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required string storage_container_key = 1;</code>
*/
public java.lang.String getStorageContainerKey() {
java.lang.Object ref = storageContainerKey_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
storageContainerKey_ = s;
}
return s;
}
}
/**
* <code>required string storage_container_key = 1;</code>
*/
public com.google.protobuf.ByteString
getStorageContainerKeyBytes() {
java.lang.Object ref = storageContainerKey_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
storageContainerKey_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int ERROR_RESPONSE_FIELD_NUMBER = 2;
private com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse errorResponse_;
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public boolean hasErrorResponse() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse getErrorResponse() {
return errorResponse_;
}
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponseOrBuilder getErrorResponseOrBuilder() {
return errorResponse_;
}
private void initFields() {
storageContainerKey_ = "";
errorResponse_ = com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.getDefaultInstance();
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
if (!hasStorageContainerKey()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasErrorResponse()) {
memoizedIsInitialized = 0;
return false;
}
if (!getErrorResponse().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeBytes(1, getStorageContainerKeyBytes());
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeMessage(2, errorResponse_);
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(1, getStorageContainerKeyBytes());
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(2, errorResponse_);
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code StorageContainerError}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:StorageContainerError)
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerErrorOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_StorageContainerError_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_StorageContainerError_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError.Builder.class);
}
// Construct using com.github.horrorho.inflatabledonkey.protocol.ChunkServer.StorageContainerError.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
getErrorResponseFieldBuilder();
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
storageContainerKey_ = "";
bitField0_ = (bitField0_ & ~0x00000001);
if (errorResponseBuilder_ == null) {
errorResponse_ = com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.getDefaultInstance();
} else {
errorResponseBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00000002);
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_StorageContainerError_descriptor;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError getDefaultInstanceForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError.getDefaultInstance();
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError build() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError buildPartial() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError result = new com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
result.storageContainerKey_ = storageContainerKey_;
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002;
}
if (errorResponseBuilder_ == null) {
result.errorResponse_ = errorResponse_;
} else {
result.errorResponse_ = errorResponseBuilder_.build();
}
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError) {
return mergeFrom((com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError other) {
if (other == com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError.getDefaultInstance()) return this;
if (other.hasStorageContainerKey()) {
bitField0_ |= 0x00000001;
storageContainerKey_ = other.storageContainerKey_;
onChanged();
}
if (other.hasErrorResponse()) {
mergeErrorResponse(other.getErrorResponse());
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
if (!hasStorageContainerKey()) {
return false;
}
if (!hasErrorResponse()) {
return false;
}
if (!getErrorResponse().isInitialized()) {
return false;
}
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private java.lang.Object storageContainerKey_ = "";
/**
* <code>required string storage_container_key = 1;</code>
*/
public boolean hasStorageContainerKey() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required string storage_container_key = 1;</code>
*/
public java.lang.String getStorageContainerKey() {
java.lang.Object ref = storageContainerKey_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
storageContainerKey_ = s;
}
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>required string storage_container_key = 1;</code>
*/
public com.google.protobuf.ByteString
getStorageContainerKeyBytes() {
java.lang.Object ref = storageContainerKey_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
storageContainerKey_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>required string storage_container_key = 1;</code>
*/
public Builder setStorageContainerKey(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
storageContainerKey_ = value;
onChanged();
return this;
}
/**
* <code>required string storage_container_key = 1;</code>
*/
public Builder clearStorageContainerKey() {
bitField0_ = (bitField0_ & ~0x00000001);
storageContainerKey_ = getDefaultInstance().getStorageContainerKey();
onChanged();
return this;
}
/**
* <code>required string storage_container_key = 1;</code>
*/
public Builder setStorageContainerKeyBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
storageContainerKey_ = value;
onChanged();
return this;
}
private com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse errorResponse_ = com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.getDefaultInstance();
private com.google.protobuf.SingleFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponseOrBuilder> errorResponseBuilder_;
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public boolean hasErrorResponse() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse getErrorResponse() {
if (errorResponseBuilder_ == null) {
return errorResponse_;
} else {
return errorResponseBuilder_.getMessage();
}
}
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public Builder setErrorResponse(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse value) {
if (errorResponseBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
errorResponse_ = value;
onChanged();
} else {
errorResponseBuilder_.setMessage(value);
}
bitField0_ |= 0x00000002;
return this;
}
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public Builder setErrorResponse(
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder builderForValue) {
if (errorResponseBuilder_ == null) {
errorResponse_ = builderForValue.build();
onChanged();
} else {
errorResponseBuilder_.setMessage(builderForValue.build());
}
bitField0_ |= 0x00000002;
return this;
}
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public Builder mergeErrorResponse(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse value) {
if (errorResponseBuilder_ == null) {
if (((bitField0_ & 0x00000002) == 0x00000002) &&
errorResponse_ != com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.getDefaultInstance()) {
errorResponse_ =
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.newBuilder(errorResponse_).mergeFrom(value).buildPartial();
} else {
errorResponse_ = value;
}
onChanged();
} else {
errorResponseBuilder_.mergeFrom(value);
}
bitField0_ |= 0x00000002;
return this;
}
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public Builder clearErrorResponse() {
if (errorResponseBuilder_ == null) {
errorResponse_ = com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.getDefaultInstance();
onChanged();
} else {
errorResponseBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00000002);
return this;
}
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder getErrorResponseBuilder() {
bitField0_ |= 0x00000002;
onChanged();
return getErrorResponseFieldBuilder().getBuilder();
}
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponseOrBuilder getErrorResponseOrBuilder() {
if (errorResponseBuilder_ != null) {
return errorResponseBuilder_.getMessageOrBuilder();
} else {
return errorResponse_;
}
}
/**
* <code>required .ErrorResponse error_response = 2;</code>
*/
private com.google.protobuf.SingleFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponseOrBuilder>
getErrorResponseFieldBuilder() {
if (errorResponseBuilder_ == null) {
errorResponseBuilder_ = new com.google.protobuf.SingleFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponseOrBuilder>(
getErrorResponse(),
getParentForChildren(),
isClean());
errorResponse_ = null;
}
return errorResponseBuilder_;
}
// @@protoc_insertion_point(builder_scope:StorageContainerError)
}
static {
defaultInstance = new StorageContainerError(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:StorageContainerError)
}
public interface MethodCompletionInfoOrBuilder extends
// @@protoc_insertion_point(interface_extends:MethodCompletionInfo)
com.google.protobuf.MessageOrBuilder {
/**
* <code>required string url = 1;</code>
*/
boolean hasUrl();
/**
* <code>required string url = 1;</code>
*/
java.lang.String getUrl();
/**
* <code>required string url = 1;</code>
*/
com.google.protobuf.ByteString
getUrlBytes();
/**
* <code>required uint32 response_status_code = 2;</code>
*/
boolean hasResponseStatusCode();
/**
* <code>required uint32 response_status_code = 2;</code>
*/
int getResponseStatusCode();
/**
* <code>optional string response_status_line = 3;</code>
*/
boolean hasResponseStatusLine();
/**
* <code>optional string response_status_line = 3;</code>
*/
java.lang.String getResponseStatusLine();
/**
* <code>optional string response_status_line = 3;</code>
*/
com.google.protobuf.ByteString
getResponseStatusLineBytes();
/**
* <code>repeated .NameValuePair vendor_response_headers = 4;</code>
*/
java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair>
getVendorResponseHeadersList();
/**
* <code>repeated .NameValuePair vendor_response_headers = 4;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair getVendorResponseHeaders(int index);
/**
* <code>repeated .NameValuePair vendor_response_headers = 4;</code>
*/
int getVendorResponseHeadersCount();
/**
* <code>repeated .NameValuePair vendor_response_headers = 4;</code>
*/
java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder>
getVendorResponseHeadersOrBuilderList();
/**
* <code>repeated .NameValuePair vendor_response_headers = 4;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder getVendorResponseHeadersOrBuilder(
int index);
/**
* <code>optional bytes response_body = 5;</code>
*/
boolean hasResponseBody();
/**
* <code>optional bytes response_body = 5;</code>
*/
com.google.protobuf.ByteString getResponseBody();
/**
* <code>optional .ErrorResponse error = 6;</code>
*/
boolean hasError();
/**
* <code>optional .ErrorResponse error = 6;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse getError();
/**
* <code>optional .ErrorResponse error = 6;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponseOrBuilder getErrorOrBuilder();
/**
* <code>optional bytes client_computed_md5 = 7;</code>
*/
boolean hasClientComputedMd5();
/**
* <code>optional bytes client_computed_md5 = 7;</code>
*/
com.google.protobuf.ByteString getClientComputedMd5();
/**
* <code>repeated .NameValuePair vendor_nv_pairs = 8;</code>
*/
java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair>
getVendorNvPairsList();
/**
* <code>repeated .NameValuePair vendor_nv_pairs = 8;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair getVendorNvPairs(int index);
/**
* <code>repeated .NameValuePair vendor_nv_pairs = 8;</code>
*/
int getVendorNvPairsCount();
/**
* <code>repeated .NameValuePair vendor_nv_pairs = 8;</code>
*/
java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder>
getVendorNvPairsOrBuilderList();
/**
* <code>repeated .NameValuePair vendor_nv_pairs = 8;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder getVendorNvPairsOrBuilder(
int index);
/**
* <code>repeated .NameValuePair client_nv_pairs = 9;</code>
*/
java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair>
getClientNvPairsList();
/**
* <code>repeated .NameValuePair client_nv_pairs = 9;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair getClientNvPairs(int index);
/**
* <code>repeated .NameValuePair client_nv_pairs = 9;</code>
*/
int getClientNvPairsCount();
/**
* <code>repeated .NameValuePair client_nv_pairs = 9;</code>
*/
java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder>
getClientNvPairsOrBuilderList();
/**
* <code>repeated .NameValuePair client_nv_pairs = 9;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder getClientNvPairsOrBuilder(
int index);
/**
* <code>required string storage_container_authorization_token = 10;</code>
*/
boolean hasStorageContainerAuthorizationToken();
/**
* <code>required string storage_container_authorization_token = 10;</code>
*/
java.lang.String getStorageContainerAuthorizationToken();
/**
* <code>required string storage_container_authorization_token = 10;</code>
*/
com.google.protobuf.ByteString
getStorageContainerAuthorizationTokenBytes();
}
/**
* Protobuf type {@code MethodCompletionInfo}
*/
public static final class MethodCompletionInfo extends
com.google.protobuf.GeneratedMessage implements
// @@protoc_insertion_point(message_implements:MethodCompletionInfo)
MethodCompletionInfoOrBuilder {
// Use MethodCompletionInfo.newBuilder() to construct.
private MethodCompletionInfo(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private MethodCompletionInfo(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final MethodCompletionInfo defaultInstance;
public static MethodCompletionInfo getDefaultInstance() {
return defaultInstance;
}
public MethodCompletionInfo getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private MethodCompletionInfo(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
com.google.protobuf.ByteString bs = input.readBytes();
bitField0_ |= 0x00000001;
url_ = bs;
break;
}
case 16: {
bitField0_ |= 0x00000002;
responseStatusCode_ = input.readUInt32();
break;
}
case 26: {
com.google.protobuf.ByteString bs = input.readBytes();
bitField0_ |= 0x00000004;
responseStatusLine_ = bs;
break;
}
case 34: {
if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
vendorResponseHeaders_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair>();
mutable_bitField0_ |= 0x00000008;
}
vendorResponseHeaders_.add(input.readMessage(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.PARSER, extensionRegistry));
break;
}
case 42: {
bitField0_ |= 0x00000008;
responseBody_ = input.readBytes();
break;
}
case 50: {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder subBuilder = null;
if (((bitField0_ & 0x00000010) == 0x00000010)) {
subBuilder = error_.toBuilder();
}
error_ = input.readMessage(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(error_);
error_ = subBuilder.buildPartial();
}
bitField0_ |= 0x00000010;
break;
}
case 58: {
bitField0_ |= 0x00000020;
clientComputedMd5_ = input.readBytes();
break;
}
case 66: {
if (!((mutable_bitField0_ & 0x00000080) == 0x00000080)) {
vendorNvPairs_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair>();
mutable_bitField0_ |= 0x00000080;
}
vendorNvPairs_.add(input.readMessage(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.PARSER, extensionRegistry));
break;
}
case 74: {
if (!((mutable_bitField0_ & 0x00000100) == 0x00000100)) {
clientNvPairs_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair>();
mutable_bitField0_ |= 0x00000100;
}
clientNvPairs_.add(input.readMessage(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.PARSER, extensionRegistry));
break;
}
case 82: {
com.google.protobuf.ByteString bs = input.readBytes();
bitField0_ |= 0x00000040;
storageContainerAuthorizationToken_ = bs;
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
vendorResponseHeaders_ = java.util.Collections.unmodifiableList(vendorResponseHeaders_);
}
if (((mutable_bitField0_ & 0x00000080) == 0x00000080)) {
vendorNvPairs_ = java.util.Collections.unmodifiableList(vendorNvPairs_);
}
if (((mutable_bitField0_ & 0x00000100) == 0x00000100)) {
clientNvPairs_ = java.util.Collections.unmodifiableList(clientNvPairs_);
}
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_MethodCompletionInfo_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_MethodCompletionInfo_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo.Builder.class);
}
public static com.google.protobuf.Parser<MethodCompletionInfo> PARSER =
new com.google.protobuf.AbstractParser<MethodCompletionInfo>() {
public MethodCompletionInfo parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new MethodCompletionInfo(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<MethodCompletionInfo> getParserForType() {
return PARSER;
}
private int bitField0_;
public static final int URL_FIELD_NUMBER = 1;
private java.lang.Object url_;
/**
* <code>required string url = 1;</code>
*/
public boolean hasUrl() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required string url = 1;</code>
*/
public java.lang.String getUrl() {
java.lang.Object ref = url_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
url_ = s;
}
return s;
}
}
/**
* <code>required string url = 1;</code>
*/
public com.google.protobuf.ByteString
getUrlBytes() {
java.lang.Object ref = url_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
url_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int RESPONSE_STATUS_CODE_FIELD_NUMBER = 2;
private int responseStatusCode_;
/**
* <code>required uint32 response_status_code = 2;</code>
*/
public boolean hasResponseStatusCode() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required uint32 response_status_code = 2;</code>
*/
public int getResponseStatusCode() {
return responseStatusCode_;
}
public static final int RESPONSE_STATUS_LINE_FIELD_NUMBER = 3;
private java.lang.Object responseStatusLine_;
/**
* <code>optional string response_status_line = 3;</code>
*/
public boolean hasResponseStatusLine() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>optional string response_status_line = 3;</code>
*/
public java.lang.String getResponseStatusLine() {
java.lang.Object ref = responseStatusLine_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
responseStatusLine_ = s;
}
return s;
}
}
/**
* <code>optional string response_status_line = 3;</code>
*/
public com.google.protobuf.ByteString
getResponseStatusLineBytes() {
java.lang.Object ref = responseStatusLine_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
responseStatusLine_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int VENDOR_RESPONSE_HEADERS_FIELD_NUMBER = 4;
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair> vendorResponseHeaders_;
/**
* <code>repeated .NameValuePair vendor_response_headers = 4;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair> getVendorResponseHeadersList() {
return vendorResponseHeaders_;
}
/**
* <code>repeated .NameValuePair vendor_response_headers = 4;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder>
getVendorResponseHeadersOrBuilderList() {
return vendorResponseHeaders_;
}
/**
* <code>repeated .NameValuePair vendor_response_headers = 4;</code>
*/
public int getVendorResponseHeadersCount() {
return vendorResponseHeaders_.size();
}
/**
* <code>repeated .NameValuePair vendor_response_headers = 4;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair getVendorResponseHeaders(int index) {
return vendorResponseHeaders_.get(index);
}
/**
* <code>repeated .NameValuePair vendor_response_headers = 4;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder getVendorResponseHeadersOrBuilder(
int index) {
return vendorResponseHeaders_.get(index);
}
public static final int RESPONSE_BODY_FIELD_NUMBER = 5;
private com.google.protobuf.ByteString responseBody_;
/**
* <code>optional bytes response_body = 5;</code>
*/
public boolean hasResponseBody() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>optional bytes response_body = 5;</code>
*/
public com.google.protobuf.ByteString getResponseBody() {
return responseBody_;
}
public static final int ERROR_FIELD_NUMBER = 6;
private com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse error_;
/**
* <code>optional .ErrorResponse error = 6;</code>
*/
public boolean hasError() {
return ((bitField0_ & 0x00000010) == 0x00000010);
}
/**
* <code>optional .ErrorResponse error = 6;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse getError() {
return error_;
}
/**
* <code>optional .ErrorResponse error = 6;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponseOrBuilder getErrorOrBuilder() {
return error_;
}
public static final int CLIENT_COMPUTED_MD5_FIELD_NUMBER = 7;
private com.google.protobuf.ByteString clientComputedMd5_;
/**
* <code>optional bytes client_computed_md5 = 7;</code>
*/
public boolean hasClientComputedMd5() {
return ((bitField0_ & 0x00000020) == 0x00000020);
}
/**
* <code>optional bytes client_computed_md5 = 7;</code>
*/
public com.google.protobuf.ByteString getClientComputedMd5() {
return clientComputedMd5_;
}
public static final int VENDOR_NV_PAIRS_FIELD_NUMBER = 8;
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair> vendorNvPairs_;
/**
* <code>repeated .NameValuePair vendor_nv_pairs = 8;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair> getVendorNvPairsList() {
return vendorNvPairs_;
}
/**
* <code>repeated .NameValuePair vendor_nv_pairs = 8;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder>
getVendorNvPairsOrBuilderList() {
return vendorNvPairs_;
}
/**
* <code>repeated .NameValuePair vendor_nv_pairs = 8;</code>
*/
public int getVendorNvPairsCount() {
return vendorNvPairs_.size();
}
/**
* <code>repeated .NameValuePair vendor_nv_pairs = 8;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair getVendorNvPairs(int index) {
return vendorNvPairs_.get(index);
}
/**
* <code>repeated .NameValuePair vendor_nv_pairs = 8;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder getVendorNvPairsOrBuilder(
int index) {
return vendorNvPairs_.get(index);
}
public static final int CLIENT_NV_PAIRS_FIELD_NUMBER = 9;
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair> clientNvPairs_;
/**
* <code>repeated .NameValuePair client_nv_pairs = 9;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair> getClientNvPairsList() {
return clientNvPairs_;
}
/**
* <code>repeated .NameValuePair client_nv_pairs = 9;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder>
getClientNvPairsOrBuilderList() {
return clientNvPairs_;
}
/**
* <code>repeated .NameValuePair client_nv_pairs = 9;</code>
*/
public int getClientNvPairsCount() {
return clientNvPairs_.size();
}
/**
* <code>repeated .NameValuePair client_nv_pairs = 9;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair getClientNvPairs(int index) {
return clientNvPairs_.get(index);
}
/**
* <code>repeated .NameValuePair client_nv_pairs = 9;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder getClientNvPairsOrBuilder(
int index) {
return clientNvPairs_.get(index);
}
public static final int STORAGE_CONTAINER_AUTHORIZATION_TOKEN_FIELD_NUMBER = 10;
private java.lang.Object storageContainerAuthorizationToken_;
/**
* <code>required string storage_container_authorization_token = 10;</code>
*/
public boolean hasStorageContainerAuthorizationToken() {
return ((bitField0_ & 0x00000040) == 0x00000040);
}
/**
* <code>required string storage_container_authorization_token = 10;</code>
*/
public java.lang.String getStorageContainerAuthorizationToken() {
java.lang.Object ref = storageContainerAuthorizationToken_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
storageContainerAuthorizationToken_ = s;
}
return s;
}
}
/**
* <code>required string storage_container_authorization_token = 10;</code>
*/
public com.google.protobuf.ByteString
getStorageContainerAuthorizationTokenBytes() {
java.lang.Object ref = storageContainerAuthorizationToken_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
storageContainerAuthorizationToken_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
private void initFields() {
url_ = "";
responseStatusCode_ = 0;
responseStatusLine_ = "";
vendorResponseHeaders_ = java.util.Collections.emptyList();
responseBody_ = com.google.protobuf.ByteString.EMPTY;
error_ = com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.getDefaultInstance();
clientComputedMd5_ = com.google.protobuf.ByteString.EMPTY;
vendorNvPairs_ = java.util.Collections.emptyList();
clientNvPairs_ = java.util.Collections.emptyList();
storageContainerAuthorizationToken_ = "";
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
if (!hasUrl()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasResponseStatusCode()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasStorageContainerAuthorizationToken()) {
memoizedIsInitialized = 0;
return false;
}
for (int i = 0; i < getVendorResponseHeadersCount(); i++) {
if (!getVendorResponseHeaders(i).isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
if (hasError()) {
if (!getError().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
for (int i = 0; i < getVendorNvPairsCount(); i++) {
if (!getVendorNvPairs(i).isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
for (int i = 0; i < getClientNvPairsCount(); i++) {
if (!getClientNvPairs(i).isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeBytes(1, getUrlBytes());
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeUInt32(2, responseStatusCode_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
output.writeBytes(3, getResponseStatusLineBytes());
}
for (int i = 0; i < vendorResponseHeaders_.size(); i++) {
output.writeMessage(4, vendorResponseHeaders_.get(i));
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
output.writeBytes(5, responseBody_);
}
if (((bitField0_ & 0x00000010) == 0x00000010)) {
output.writeMessage(6, error_);
}
if (((bitField0_ & 0x00000020) == 0x00000020)) {
output.writeBytes(7, clientComputedMd5_);
}
for (int i = 0; i < vendorNvPairs_.size(); i++) {
output.writeMessage(8, vendorNvPairs_.get(i));
}
for (int i = 0; i < clientNvPairs_.size(); i++) {
output.writeMessage(9, clientNvPairs_.get(i));
}
if (((bitField0_ & 0x00000040) == 0x00000040)) {
output.writeBytes(10, getStorageContainerAuthorizationTokenBytes());
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(1, getUrlBytes());
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += com.google.protobuf.CodedOutputStream
.computeUInt32Size(2, responseStatusCode_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(3, getResponseStatusLineBytes());
}
for (int i = 0; i < vendorResponseHeaders_.size(); i++) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(4, vendorResponseHeaders_.get(i));
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(5, responseBody_);
}
if (((bitField0_ & 0x00000010) == 0x00000010)) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(6, error_);
}
if (((bitField0_ & 0x00000020) == 0x00000020)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(7, clientComputedMd5_);
}
for (int i = 0; i < vendorNvPairs_.size(); i++) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(8, vendorNvPairs_.get(i));
}
for (int i = 0; i < clientNvPairs_.size(); i++) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(9, clientNvPairs_.get(i));
}
if (((bitField0_ & 0x00000040) == 0x00000040)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(10, getStorageContainerAuthorizationTokenBytes());
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code MethodCompletionInfo}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:MethodCompletionInfo)
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfoOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_MethodCompletionInfo_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_MethodCompletionInfo_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo.Builder.class);
}
// Construct using com.github.horrorho.inflatabledonkey.protocol.ChunkServer.MethodCompletionInfo.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
getVendorResponseHeadersFieldBuilder();
getErrorFieldBuilder();
getVendorNvPairsFieldBuilder();
getClientNvPairsFieldBuilder();
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
url_ = "";
bitField0_ = (bitField0_ & ~0x00000001);
responseStatusCode_ = 0;
bitField0_ = (bitField0_ & ~0x00000002);
responseStatusLine_ = "";
bitField0_ = (bitField0_ & ~0x00000004);
if (vendorResponseHeadersBuilder_ == null) {
vendorResponseHeaders_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000008);
} else {
vendorResponseHeadersBuilder_.clear();
}
responseBody_ = com.google.protobuf.ByteString.EMPTY;
bitField0_ = (bitField0_ & ~0x00000010);
if (errorBuilder_ == null) {
error_ = com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.getDefaultInstance();
} else {
errorBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00000020);
clientComputedMd5_ = com.google.protobuf.ByteString.EMPTY;
bitField0_ = (bitField0_ & ~0x00000040);
if (vendorNvPairsBuilder_ == null) {
vendorNvPairs_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000080);
} else {
vendorNvPairsBuilder_.clear();
}
if (clientNvPairsBuilder_ == null) {
clientNvPairs_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000100);
} else {
clientNvPairsBuilder_.clear();
}
storageContainerAuthorizationToken_ = "";
bitField0_ = (bitField0_ & ~0x00000200);
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_MethodCompletionInfo_descriptor;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo getDefaultInstanceForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo.getDefaultInstance();
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo build() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo buildPartial() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo result = new com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
result.url_ = url_;
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002;
}
result.responseStatusCode_ = responseStatusCode_;
if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
to_bitField0_ |= 0x00000004;
}
result.responseStatusLine_ = responseStatusLine_;
if (vendorResponseHeadersBuilder_ == null) {
if (((bitField0_ & 0x00000008) == 0x00000008)) {
vendorResponseHeaders_ = java.util.Collections.unmodifiableList(vendorResponseHeaders_);
bitField0_ = (bitField0_ & ~0x00000008);
}
result.vendorResponseHeaders_ = vendorResponseHeaders_;
} else {
result.vendorResponseHeaders_ = vendorResponseHeadersBuilder_.build();
}
if (((from_bitField0_ & 0x00000010) == 0x00000010)) {
to_bitField0_ |= 0x00000008;
}
result.responseBody_ = responseBody_;
if (((from_bitField0_ & 0x00000020) == 0x00000020)) {
to_bitField0_ |= 0x00000010;
}
if (errorBuilder_ == null) {
result.error_ = error_;
} else {
result.error_ = errorBuilder_.build();
}
if (((from_bitField0_ & 0x00000040) == 0x00000040)) {
to_bitField0_ |= 0x00000020;
}
result.clientComputedMd5_ = clientComputedMd5_;
if (vendorNvPairsBuilder_ == null) {
if (((bitField0_ & 0x00000080) == 0x00000080)) {
vendorNvPairs_ = java.util.Collections.unmodifiableList(vendorNvPairs_);
bitField0_ = (bitField0_ & ~0x00000080);
}
result.vendorNvPairs_ = vendorNvPairs_;
} else {
result.vendorNvPairs_ = vendorNvPairsBuilder_.build();
}
if (clientNvPairsBuilder_ == null) {
if (((bitField0_ & 0x00000100) == 0x00000100)) {
clientNvPairs_ = java.util.Collections.unmodifiableList(clientNvPairs_);
bitField0_ = (bitField0_ & ~0x00000100);
}
result.clientNvPairs_ = clientNvPairs_;
} else {
result.clientNvPairs_ = clientNvPairsBuilder_.build();
}
if (((from_bitField0_ & 0x00000200) == 0x00000200)) {
to_bitField0_ |= 0x00000040;
}
result.storageContainerAuthorizationToken_ = storageContainerAuthorizationToken_;
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo) {
return mergeFrom((com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo other) {
if (other == com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo.getDefaultInstance()) return this;
if (other.hasUrl()) {
bitField0_ |= 0x00000001;
url_ = other.url_;
onChanged();
}
if (other.hasResponseStatusCode()) {
setResponseStatusCode(other.getResponseStatusCode());
}
if (other.hasResponseStatusLine()) {
bitField0_ |= 0x00000004;
responseStatusLine_ = other.responseStatusLine_;
onChanged();
}
if (vendorResponseHeadersBuilder_ == null) {
if (!other.vendorResponseHeaders_.isEmpty()) {
if (vendorResponseHeaders_.isEmpty()) {
vendorResponseHeaders_ = other.vendorResponseHeaders_;
bitField0_ = (bitField0_ & ~0x00000008);
} else {
ensureVendorResponseHeadersIsMutable();
vendorResponseHeaders_.addAll(other.vendorResponseHeaders_);
}
onChanged();
}
} else {
if (!other.vendorResponseHeaders_.isEmpty()) {
if (vendorResponseHeadersBuilder_.isEmpty()) {
vendorResponseHeadersBuilder_.dispose();
vendorResponseHeadersBuilder_ = null;
vendorResponseHeaders_ = other.vendorResponseHeaders_;
bitField0_ = (bitField0_ & ~0x00000008);
vendorResponseHeadersBuilder_ =
com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
getVendorResponseHeadersFieldBuilder() : null;
} else {
vendorResponseHeadersBuilder_.addAllMessages(other.vendorResponseHeaders_);
}
}
}
if (other.hasResponseBody()) {
setResponseBody(other.getResponseBody());
}
if (other.hasError()) {
mergeError(other.getError());
}
if (other.hasClientComputedMd5()) {
setClientComputedMd5(other.getClientComputedMd5());
}
if (vendorNvPairsBuilder_ == null) {
if (!other.vendorNvPairs_.isEmpty()) {
if (vendorNvPairs_.isEmpty()) {
vendorNvPairs_ = other.vendorNvPairs_;
bitField0_ = (bitField0_ & ~0x00000080);
} else {
ensureVendorNvPairsIsMutable();
vendorNvPairs_.addAll(other.vendorNvPairs_);
}
onChanged();
}
} else {
if (!other.vendorNvPairs_.isEmpty()) {
if (vendorNvPairsBuilder_.isEmpty()) {
vendorNvPairsBuilder_.dispose();
vendorNvPairsBuilder_ = null;
vendorNvPairs_ = other.vendorNvPairs_;
bitField0_ = (bitField0_ & ~0x00000080);
vendorNvPairsBuilder_ =
com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
getVendorNvPairsFieldBuilder() : null;
} else {
vendorNvPairsBuilder_.addAllMessages(other.vendorNvPairs_);
}
}
}
if (clientNvPairsBuilder_ == null) {
if (!other.clientNvPairs_.isEmpty()) {
if (clientNvPairs_.isEmpty()) {
clientNvPairs_ = other.clientNvPairs_;
bitField0_ = (bitField0_ & ~0x00000100);
} else {
ensureClientNvPairsIsMutable();
clientNvPairs_.addAll(other.clientNvPairs_);
}
onChanged();
}
} else {
if (!other.clientNvPairs_.isEmpty()) {
if (clientNvPairsBuilder_.isEmpty()) {
clientNvPairsBuilder_.dispose();
clientNvPairsBuilder_ = null;
clientNvPairs_ = other.clientNvPairs_;
bitField0_ = (bitField0_ & ~0x00000100);
clientNvPairsBuilder_ =
com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
getClientNvPairsFieldBuilder() : null;
} else {
clientNvPairsBuilder_.addAllMessages(other.clientNvPairs_);
}
}
}
if (other.hasStorageContainerAuthorizationToken()) {
bitField0_ |= 0x00000200;
storageContainerAuthorizationToken_ = other.storageContainerAuthorizationToken_;
onChanged();
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
if (!hasUrl()) {
return false;
}
if (!hasResponseStatusCode()) {
return false;
}
if (!hasStorageContainerAuthorizationToken()) {
return false;
}
for (int i = 0; i < getVendorResponseHeadersCount(); i++) {
if (!getVendorResponseHeaders(i).isInitialized()) {
return false;
}
}
if (hasError()) {
if (!getError().isInitialized()) {
return false;
}
}
for (int i = 0; i < getVendorNvPairsCount(); i++) {
if (!getVendorNvPairs(i).isInitialized()) {
return false;
}
}
for (int i = 0; i < getClientNvPairsCount(); i++) {
if (!getClientNvPairs(i).isInitialized()) {
return false;
}
}
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private java.lang.Object url_ = "";
/**
* <code>required string url = 1;</code>
*/
public boolean hasUrl() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required string url = 1;</code>
*/
public java.lang.String getUrl() {
java.lang.Object ref = url_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
url_ = s;
}
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>required string url = 1;</code>
*/
public com.google.protobuf.ByteString
getUrlBytes() {
java.lang.Object ref = url_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
url_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>required string url = 1;</code>
*/
public Builder setUrl(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
url_ = value;
onChanged();
return this;
}
/**
* <code>required string url = 1;</code>
*/
public Builder clearUrl() {
bitField0_ = (bitField0_ & ~0x00000001);
url_ = getDefaultInstance().getUrl();
onChanged();
return this;
}
/**
* <code>required string url = 1;</code>
*/
public Builder setUrlBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
url_ = value;
onChanged();
return this;
}
private int responseStatusCode_ ;
/**
* <code>required uint32 response_status_code = 2;</code>
*/
public boolean hasResponseStatusCode() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required uint32 response_status_code = 2;</code>
*/
public int getResponseStatusCode() {
return responseStatusCode_;
}
/**
* <code>required uint32 response_status_code = 2;</code>
*/
public Builder setResponseStatusCode(int value) {
bitField0_ |= 0x00000002;
responseStatusCode_ = value;
onChanged();
return this;
}
/**
* <code>required uint32 response_status_code = 2;</code>
*/
public Builder clearResponseStatusCode() {
bitField0_ = (bitField0_ & ~0x00000002);
responseStatusCode_ = 0;
onChanged();
return this;
}
private java.lang.Object responseStatusLine_ = "";
/**
* <code>optional string response_status_line = 3;</code>
*/
public boolean hasResponseStatusLine() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>optional string response_status_line = 3;</code>
*/
public java.lang.String getResponseStatusLine() {
java.lang.Object ref = responseStatusLine_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
responseStatusLine_ = s;
}
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>optional string response_status_line = 3;</code>
*/
public com.google.protobuf.ByteString
getResponseStatusLineBytes() {
java.lang.Object ref = responseStatusLine_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
responseStatusLine_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>optional string response_status_line = 3;</code>
*/
public Builder setResponseStatusLine(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000004;
responseStatusLine_ = value;
onChanged();
return this;
}
/**
* <code>optional string response_status_line = 3;</code>
*/
public Builder clearResponseStatusLine() {
bitField0_ = (bitField0_ & ~0x00000004);
responseStatusLine_ = getDefaultInstance().getResponseStatusLine();
onChanged();
return this;
}
/**
* <code>optional string response_status_line = 3;</code>
*/
public Builder setResponseStatusLineBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000004;
responseStatusLine_ = value;
onChanged();
return this;
}
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair> vendorResponseHeaders_ =
java.util.Collections.emptyList();
private void ensureVendorResponseHeadersIsMutable() {
if (!((bitField0_ & 0x00000008) == 0x00000008)) {
vendorResponseHeaders_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair>(vendorResponseHeaders_);
bitField0_ |= 0x00000008;
}
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder> vendorResponseHeadersBuilder_;
/**
* <code>repeated .NameValuePair vendor_response_headers = 4;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair> getVendorResponseHeadersList() {
if (vendorResponseHeadersBuilder_ == null) {
return java.util.Collections.unmodifiableList(vendorResponseHeaders_);
} else {
return vendorResponseHeadersBuilder_.getMessageList();
}
}
/**
* <code>repeated .NameValuePair vendor_response_headers = 4;</code>
*/
public int getVendorResponseHeadersCount() {
if (vendorResponseHeadersBuilder_ == null) {
return vendorResponseHeaders_.size();
} else {
return vendorResponseHeadersBuilder_.getCount();
}
}
/**
* <code>repeated .NameValuePair vendor_response_headers = 4;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair getVendorResponseHeaders(int index) {
if (vendorResponseHeadersBuilder_ == null) {
return vendorResponseHeaders_.get(index);
} else {
return vendorResponseHeadersBuilder_.getMessage(index);
}
}
/**
* <code>repeated .NameValuePair vendor_response_headers = 4;</code>
*/
public Builder setVendorResponseHeaders(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair value) {
if (vendorResponseHeadersBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureVendorResponseHeadersIsMutable();
vendorResponseHeaders_.set(index, value);
onChanged();
} else {
vendorResponseHeadersBuilder_.setMessage(index, value);
}
return this;
}
/**
* <code>repeated .NameValuePair vendor_response_headers = 4;</code>
*/
public Builder setVendorResponseHeaders(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder builderForValue) {
if (vendorResponseHeadersBuilder_ == null) {
ensureVendorResponseHeadersIsMutable();
vendorResponseHeaders_.set(index, builderForValue.build());
onChanged();
} else {
vendorResponseHeadersBuilder_.setMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .NameValuePair vendor_response_headers = 4;</code>
*/
public Builder addVendorResponseHeaders(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair value) {
if (vendorResponseHeadersBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureVendorResponseHeadersIsMutable();
vendorResponseHeaders_.add(value);
onChanged();
} else {
vendorResponseHeadersBuilder_.addMessage(value);
}
return this;
}
/**
* <code>repeated .NameValuePair vendor_response_headers = 4;</code>
*/
public Builder addVendorResponseHeaders(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair value) {
if (vendorResponseHeadersBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureVendorResponseHeadersIsMutable();
vendorResponseHeaders_.add(index, value);
onChanged();
} else {
vendorResponseHeadersBuilder_.addMessage(index, value);
}
return this;
}
/**
* <code>repeated .NameValuePair vendor_response_headers = 4;</code>
*/
public Builder addVendorResponseHeaders(
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder builderForValue) {
if (vendorResponseHeadersBuilder_ == null) {
ensureVendorResponseHeadersIsMutable();
vendorResponseHeaders_.add(builderForValue.build());
onChanged();
} else {
vendorResponseHeadersBuilder_.addMessage(builderForValue.build());
}
return this;
}
/**
* <code>repeated .NameValuePair vendor_response_headers = 4;</code>
*/
public Builder addVendorResponseHeaders(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder builderForValue) {
if (vendorResponseHeadersBuilder_ == null) {
ensureVendorResponseHeadersIsMutable();
vendorResponseHeaders_.add(index, builderForValue.build());
onChanged();
} else {
vendorResponseHeadersBuilder_.addMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .NameValuePair vendor_response_headers = 4;</code>
*/
public Builder addAllVendorResponseHeaders(
java.lang.Iterable<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair> values) {
if (vendorResponseHeadersBuilder_ == null) {
ensureVendorResponseHeadersIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, vendorResponseHeaders_);
onChanged();
} else {
vendorResponseHeadersBuilder_.addAllMessages(values);
}
return this;
}
/**
* <code>repeated .NameValuePair vendor_response_headers = 4;</code>
*/
public Builder clearVendorResponseHeaders() {
if (vendorResponseHeadersBuilder_ == null) {
vendorResponseHeaders_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000008);
onChanged();
} else {
vendorResponseHeadersBuilder_.clear();
}
return this;
}
/**
* <code>repeated .NameValuePair vendor_response_headers = 4;</code>
*/
public Builder removeVendorResponseHeaders(int index) {
if (vendorResponseHeadersBuilder_ == null) {
ensureVendorResponseHeadersIsMutable();
vendorResponseHeaders_.remove(index);
onChanged();
} else {
vendorResponseHeadersBuilder_.remove(index);
}
return this;
}
/**
* <code>repeated .NameValuePair vendor_response_headers = 4;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder getVendorResponseHeadersBuilder(
int index) {
return getVendorResponseHeadersFieldBuilder().getBuilder(index);
}
/**
* <code>repeated .NameValuePair vendor_response_headers = 4;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder getVendorResponseHeadersOrBuilder(
int index) {
if (vendorResponseHeadersBuilder_ == null) {
return vendorResponseHeaders_.get(index); } else {
return vendorResponseHeadersBuilder_.getMessageOrBuilder(index);
}
}
/**
* <code>repeated .NameValuePair vendor_response_headers = 4;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder>
getVendorResponseHeadersOrBuilderList() {
if (vendorResponseHeadersBuilder_ != null) {
return vendorResponseHeadersBuilder_.getMessageOrBuilderList();
} else {
return java.util.Collections.unmodifiableList(vendorResponseHeaders_);
}
}
/**
* <code>repeated .NameValuePair vendor_response_headers = 4;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder addVendorResponseHeadersBuilder() {
return getVendorResponseHeadersFieldBuilder().addBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.getDefaultInstance());
}
/**
* <code>repeated .NameValuePair vendor_response_headers = 4;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder addVendorResponseHeadersBuilder(
int index) {
return getVendorResponseHeadersFieldBuilder().addBuilder(index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.getDefaultInstance());
}
/**
* <code>repeated .NameValuePair vendor_response_headers = 4;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder>
getVendorResponseHeadersBuilderList() {
return getVendorResponseHeadersFieldBuilder().getBuilderList();
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder>
getVendorResponseHeadersFieldBuilder() {
if (vendorResponseHeadersBuilder_ == null) {
vendorResponseHeadersBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder>(
vendorResponseHeaders_,
((bitField0_ & 0x00000008) == 0x00000008),
getParentForChildren(),
isClean());
vendorResponseHeaders_ = null;
}
return vendorResponseHeadersBuilder_;
}
private com.google.protobuf.ByteString responseBody_ = com.google.protobuf.ByteString.EMPTY;
/**
* <code>optional bytes response_body = 5;</code>
*/
public boolean hasResponseBody() {
return ((bitField0_ & 0x00000010) == 0x00000010);
}
/**
* <code>optional bytes response_body = 5;</code>
*/
public com.google.protobuf.ByteString getResponseBody() {
return responseBody_;
}
/**
* <code>optional bytes response_body = 5;</code>
*/
public Builder setResponseBody(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000010;
responseBody_ = value;
onChanged();
return this;
}
/**
* <code>optional bytes response_body = 5;</code>
*/
public Builder clearResponseBody() {
bitField0_ = (bitField0_ & ~0x00000010);
responseBody_ = getDefaultInstance().getResponseBody();
onChanged();
return this;
}
private com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse error_ = com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.getDefaultInstance();
private com.google.protobuf.SingleFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponseOrBuilder> errorBuilder_;
/**
* <code>optional .ErrorResponse error = 6;</code>
*/
public boolean hasError() {
return ((bitField0_ & 0x00000020) == 0x00000020);
}
/**
* <code>optional .ErrorResponse error = 6;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse getError() {
if (errorBuilder_ == null) {
return error_;
} else {
return errorBuilder_.getMessage();
}
}
/**
* <code>optional .ErrorResponse error = 6;</code>
*/
public Builder setError(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse value) {
if (errorBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
error_ = value;
onChanged();
} else {
errorBuilder_.setMessage(value);
}
bitField0_ |= 0x00000020;
return this;
}
/**
* <code>optional .ErrorResponse error = 6;</code>
*/
public Builder setError(
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder builderForValue) {
if (errorBuilder_ == null) {
error_ = builderForValue.build();
onChanged();
} else {
errorBuilder_.setMessage(builderForValue.build());
}
bitField0_ |= 0x00000020;
return this;
}
/**
* <code>optional .ErrorResponse error = 6;</code>
*/
public Builder mergeError(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse value) {
if (errorBuilder_ == null) {
if (((bitField0_ & 0x00000020) == 0x00000020) &&
error_ != com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.getDefaultInstance()) {
error_ =
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.newBuilder(error_).mergeFrom(value).buildPartial();
} else {
error_ = value;
}
onChanged();
} else {
errorBuilder_.mergeFrom(value);
}
bitField0_ |= 0x00000020;
return this;
}
/**
* <code>optional .ErrorResponse error = 6;</code>
*/
public Builder clearError() {
if (errorBuilder_ == null) {
error_ = com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.getDefaultInstance();
onChanged();
} else {
errorBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00000020);
return this;
}
/**
* <code>optional .ErrorResponse error = 6;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder getErrorBuilder() {
bitField0_ |= 0x00000020;
onChanged();
return getErrorFieldBuilder().getBuilder();
}
/**
* <code>optional .ErrorResponse error = 6;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponseOrBuilder getErrorOrBuilder() {
if (errorBuilder_ != null) {
return errorBuilder_.getMessageOrBuilder();
} else {
return error_;
}
}
/**
* <code>optional .ErrorResponse error = 6;</code>
*/
private com.google.protobuf.SingleFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponseOrBuilder>
getErrorFieldBuilder() {
if (errorBuilder_ == null) {
errorBuilder_ = new com.google.protobuf.SingleFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponse.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ErrorResponseOrBuilder>(
getError(),
getParentForChildren(),
isClean());
error_ = null;
}
return errorBuilder_;
}
private com.google.protobuf.ByteString clientComputedMd5_ = com.google.protobuf.ByteString.EMPTY;
/**
* <code>optional bytes client_computed_md5 = 7;</code>
*/
public boolean hasClientComputedMd5() {
return ((bitField0_ & 0x00000040) == 0x00000040);
}
/**
* <code>optional bytes client_computed_md5 = 7;</code>
*/
public com.google.protobuf.ByteString getClientComputedMd5() {
return clientComputedMd5_;
}
/**
* <code>optional bytes client_computed_md5 = 7;</code>
*/
public Builder setClientComputedMd5(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000040;
clientComputedMd5_ = value;
onChanged();
return this;
}
/**
* <code>optional bytes client_computed_md5 = 7;</code>
*/
public Builder clearClientComputedMd5() {
bitField0_ = (bitField0_ & ~0x00000040);
clientComputedMd5_ = getDefaultInstance().getClientComputedMd5();
onChanged();
return this;
}
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair> vendorNvPairs_ =
java.util.Collections.emptyList();
private void ensureVendorNvPairsIsMutable() {
if (!((bitField0_ & 0x00000080) == 0x00000080)) {
vendorNvPairs_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair>(vendorNvPairs_);
bitField0_ |= 0x00000080;
}
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder> vendorNvPairsBuilder_;
/**
* <code>repeated .NameValuePair vendor_nv_pairs = 8;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair> getVendorNvPairsList() {
if (vendorNvPairsBuilder_ == null) {
return java.util.Collections.unmodifiableList(vendorNvPairs_);
} else {
return vendorNvPairsBuilder_.getMessageList();
}
}
/**
* <code>repeated .NameValuePair vendor_nv_pairs = 8;</code>
*/
public int getVendorNvPairsCount() {
if (vendorNvPairsBuilder_ == null) {
return vendorNvPairs_.size();
} else {
return vendorNvPairsBuilder_.getCount();
}
}
/**
* <code>repeated .NameValuePair vendor_nv_pairs = 8;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair getVendorNvPairs(int index) {
if (vendorNvPairsBuilder_ == null) {
return vendorNvPairs_.get(index);
} else {
return vendorNvPairsBuilder_.getMessage(index);
}
}
/**
* <code>repeated .NameValuePair vendor_nv_pairs = 8;</code>
*/
public Builder setVendorNvPairs(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair value) {
if (vendorNvPairsBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureVendorNvPairsIsMutable();
vendorNvPairs_.set(index, value);
onChanged();
} else {
vendorNvPairsBuilder_.setMessage(index, value);
}
return this;
}
/**
* <code>repeated .NameValuePair vendor_nv_pairs = 8;</code>
*/
public Builder setVendorNvPairs(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder builderForValue) {
if (vendorNvPairsBuilder_ == null) {
ensureVendorNvPairsIsMutable();
vendorNvPairs_.set(index, builderForValue.build());
onChanged();
} else {
vendorNvPairsBuilder_.setMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .NameValuePair vendor_nv_pairs = 8;</code>
*/
public Builder addVendorNvPairs(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair value) {
if (vendorNvPairsBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureVendorNvPairsIsMutable();
vendorNvPairs_.add(value);
onChanged();
} else {
vendorNvPairsBuilder_.addMessage(value);
}
return this;
}
/**
* <code>repeated .NameValuePair vendor_nv_pairs = 8;</code>
*/
public Builder addVendorNvPairs(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair value) {
if (vendorNvPairsBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureVendorNvPairsIsMutable();
vendorNvPairs_.add(index, value);
onChanged();
} else {
vendorNvPairsBuilder_.addMessage(index, value);
}
return this;
}
/**
* <code>repeated .NameValuePair vendor_nv_pairs = 8;</code>
*/
public Builder addVendorNvPairs(
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder builderForValue) {
if (vendorNvPairsBuilder_ == null) {
ensureVendorNvPairsIsMutable();
vendorNvPairs_.add(builderForValue.build());
onChanged();
} else {
vendorNvPairsBuilder_.addMessage(builderForValue.build());
}
return this;
}
/**
* <code>repeated .NameValuePair vendor_nv_pairs = 8;</code>
*/
public Builder addVendorNvPairs(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder builderForValue) {
if (vendorNvPairsBuilder_ == null) {
ensureVendorNvPairsIsMutable();
vendorNvPairs_.add(index, builderForValue.build());
onChanged();
} else {
vendorNvPairsBuilder_.addMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .NameValuePair vendor_nv_pairs = 8;</code>
*/
public Builder addAllVendorNvPairs(
java.lang.Iterable<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair> values) {
if (vendorNvPairsBuilder_ == null) {
ensureVendorNvPairsIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, vendorNvPairs_);
onChanged();
} else {
vendorNvPairsBuilder_.addAllMessages(values);
}
return this;
}
/**
* <code>repeated .NameValuePair vendor_nv_pairs = 8;</code>
*/
public Builder clearVendorNvPairs() {
if (vendorNvPairsBuilder_ == null) {
vendorNvPairs_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000080);
onChanged();
} else {
vendorNvPairsBuilder_.clear();
}
return this;
}
/**
* <code>repeated .NameValuePair vendor_nv_pairs = 8;</code>
*/
public Builder removeVendorNvPairs(int index) {
if (vendorNvPairsBuilder_ == null) {
ensureVendorNvPairsIsMutable();
vendorNvPairs_.remove(index);
onChanged();
} else {
vendorNvPairsBuilder_.remove(index);
}
return this;
}
/**
* <code>repeated .NameValuePair vendor_nv_pairs = 8;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder getVendorNvPairsBuilder(
int index) {
return getVendorNvPairsFieldBuilder().getBuilder(index);
}
/**
* <code>repeated .NameValuePair vendor_nv_pairs = 8;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder getVendorNvPairsOrBuilder(
int index) {
if (vendorNvPairsBuilder_ == null) {
return vendorNvPairs_.get(index); } else {
return vendorNvPairsBuilder_.getMessageOrBuilder(index);
}
}
/**
* <code>repeated .NameValuePair vendor_nv_pairs = 8;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder>
getVendorNvPairsOrBuilderList() {
if (vendorNvPairsBuilder_ != null) {
return vendorNvPairsBuilder_.getMessageOrBuilderList();
} else {
return java.util.Collections.unmodifiableList(vendorNvPairs_);
}
}
/**
* <code>repeated .NameValuePair vendor_nv_pairs = 8;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder addVendorNvPairsBuilder() {
return getVendorNvPairsFieldBuilder().addBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.getDefaultInstance());
}
/**
* <code>repeated .NameValuePair vendor_nv_pairs = 8;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder addVendorNvPairsBuilder(
int index) {
return getVendorNvPairsFieldBuilder().addBuilder(index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.getDefaultInstance());
}
/**
* <code>repeated .NameValuePair vendor_nv_pairs = 8;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder>
getVendorNvPairsBuilderList() {
return getVendorNvPairsFieldBuilder().getBuilderList();
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder>
getVendorNvPairsFieldBuilder() {
if (vendorNvPairsBuilder_ == null) {
vendorNvPairsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder>(
vendorNvPairs_,
((bitField0_ & 0x00000080) == 0x00000080),
getParentForChildren(),
isClean());
vendorNvPairs_ = null;
}
return vendorNvPairsBuilder_;
}
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair> clientNvPairs_ =
java.util.Collections.emptyList();
private void ensureClientNvPairsIsMutable() {
if (!((bitField0_ & 0x00000100) == 0x00000100)) {
clientNvPairs_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair>(clientNvPairs_);
bitField0_ |= 0x00000100;
}
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder> clientNvPairsBuilder_;
/**
* <code>repeated .NameValuePair client_nv_pairs = 9;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair> getClientNvPairsList() {
if (clientNvPairsBuilder_ == null) {
return java.util.Collections.unmodifiableList(clientNvPairs_);
} else {
return clientNvPairsBuilder_.getMessageList();
}
}
/**
* <code>repeated .NameValuePair client_nv_pairs = 9;</code>
*/
public int getClientNvPairsCount() {
if (clientNvPairsBuilder_ == null) {
return clientNvPairs_.size();
} else {
return clientNvPairsBuilder_.getCount();
}
}
/**
* <code>repeated .NameValuePair client_nv_pairs = 9;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair getClientNvPairs(int index) {
if (clientNvPairsBuilder_ == null) {
return clientNvPairs_.get(index);
} else {
return clientNvPairsBuilder_.getMessage(index);
}
}
/**
* <code>repeated .NameValuePair client_nv_pairs = 9;</code>
*/
public Builder setClientNvPairs(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair value) {
if (clientNvPairsBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureClientNvPairsIsMutable();
clientNvPairs_.set(index, value);
onChanged();
} else {
clientNvPairsBuilder_.setMessage(index, value);
}
return this;
}
/**
* <code>repeated .NameValuePair client_nv_pairs = 9;</code>
*/
public Builder setClientNvPairs(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder builderForValue) {
if (clientNvPairsBuilder_ == null) {
ensureClientNvPairsIsMutable();
clientNvPairs_.set(index, builderForValue.build());
onChanged();
} else {
clientNvPairsBuilder_.setMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .NameValuePair client_nv_pairs = 9;</code>
*/
public Builder addClientNvPairs(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair value) {
if (clientNvPairsBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureClientNvPairsIsMutable();
clientNvPairs_.add(value);
onChanged();
} else {
clientNvPairsBuilder_.addMessage(value);
}
return this;
}
/**
* <code>repeated .NameValuePair client_nv_pairs = 9;</code>
*/
public Builder addClientNvPairs(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair value) {
if (clientNvPairsBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureClientNvPairsIsMutable();
clientNvPairs_.add(index, value);
onChanged();
} else {
clientNvPairsBuilder_.addMessage(index, value);
}
return this;
}
/**
* <code>repeated .NameValuePair client_nv_pairs = 9;</code>
*/
public Builder addClientNvPairs(
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder builderForValue) {
if (clientNvPairsBuilder_ == null) {
ensureClientNvPairsIsMutable();
clientNvPairs_.add(builderForValue.build());
onChanged();
} else {
clientNvPairsBuilder_.addMessage(builderForValue.build());
}
return this;
}
/**
* <code>repeated .NameValuePair client_nv_pairs = 9;</code>
*/
public Builder addClientNvPairs(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder builderForValue) {
if (clientNvPairsBuilder_ == null) {
ensureClientNvPairsIsMutable();
clientNvPairs_.add(index, builderForValue.build());
onChanged();
} else {
clientNvPairsBuilder_.addMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .NameValuePair client_nv_pairs = 9;</code>
*/
public Builder addAllClientNvPairs(
java.lang.Iterable<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair> values) {
if (clientNvPairsBuilder_ == null) {
ensureClientNvPairsIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, clientNvPairs_);
onChanged();
} else {
clientNvPairsBuilder_.addAllMessages(values);
}
return this;
}
/**
* <code>repeated .NameValuePair client_nv_pairs = 9;</code>
*/
public Builder clearClientNvPairs() {
if (clientNvPairsBuilder_ == null) {
clientNvPairs_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000100);
onChanged();
} else {
clientNvPairsBuilder_.clear();
}
return this;
}
/**
* <code>repeated .NameValuePair client_nv_pairs = 9;</code>
*/
public Builder removeClientNvPairs(int index) {
if (clientNvPairsBuilder_ == null) {
ensureClientNvPairsIsMutable();
clientNvPairs_.remove(index);
onChanged();
} else {
clientNvPairsBuilder_.remove(index);
}
return this;
}
/**
* <code>repeated .NameValuePair client_nv_pairs = 9;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder getClientNvPairsBuilder(
int index) {
return getClientNvPairsFieldBuilder().getBuilder(index);
}
/**
* <code>repeated .NameValuePair client_nv_pairs = 9;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder getClientNvPairsOrBuilder(
int index) {
if (clientNvPairsBuilder_ == null) {
return clientNvPairs_.get(index); } else {
return clientNvPairsBuilder_.getMessageOrBuilder(index);
}
}
/**
* <code>repeated .NameValuePair client_nv_pairs = 9;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder>
getClientNvPairsOrBuilderList() {
if (clientNvPairsBuilder_ != null) {
return clientNvPairsBuilder_.getMessageOrBuilderList();
} else {
return java.util.Collections.unmodifiableList(clientNvPairs_);
}
}
/**
* <code>repeated .NameValuePair client_nv_pairs = 9;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder addClientNvPairsBuilder() {
return getClientNvPairsFieldBuilder().addBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.getDefaultInstance());
}
/**
* <code>repeated .NameValuePair client_nv_pairs = 9;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder addClientNvPairsBuilder(
int index) {
return getClientNvPairsFieldBuilder().addBuilder(index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.getDefaultInstance());
}
/**
* <code>repeated .NameValuePair client_nv_pairs = 9;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder>
getClientNvPairsBuilderList() {
return getClientNvPairsFieldBuilder().getBuilderList();
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder>
getClientNvPairsFieldBuilder() {
if (clientNvPairsBuilder_ == null) {
clientNvPairsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePair.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.NameValuePairOrBuilder>(
clientNvPairs_,
((bitField0_ & 0x00000100) == 0x00000100),
getParentForChildren(),
isClean());
clientNvPairs_ = null;
}
return clientNvPairsBuilder_;
}
private java.lang.Object storageContainerAuthorizationToken_ = "";
/**
* <code>required string storage_container_authorization_token = 10;</code>
*/
public boolean hasStorageContainerAuthorizationToken() {
return ((bitField0_ & 0x00000200) == 0x00000200);
}
/**
* <code>required string storage_container_authorization_token = 10;</code>
*/
public java.lang.String getStorageContainerAuthorizationToken() {
java.lang.Object ref = storageContainerAuthorizationToken_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
storageContainerAuthorizationToken_ = s;
}
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>required string storage_container_authorization_token = 10;</code>
*/
public com.google.protobuf.ByteString
getStorageContainerAuthorizationTokenBytes() {
java.lang.Object ref = storageContainerAuthorizationToken_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
storageContainerAuthorizationToken_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>required string storage_container_authorization_token = 10;</code>
*/
public Builder setStorageContainerAuthorizationToken(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000200;
storageContainerAuthorizationToken_ = value;
onChanged();
return this;
}
/**
* <code>required string storage_container_authorization_token = 10;</code>
*/
public Builder clearStorageContainerAuthorizationToken() {
bitField0_ = (bitField0_ & ~0x00000200);
storageContainerAuthorizationToken_ = getDefaultInstance().getStorageContainerAuthorizationToken();
onChanged();
return this;
}
/**
* <code>required string storage_container_authorization_token = 10;</code>
*/
public Builder setStorageContainerAuthorizationTokenBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000200;
storageContainerAuthorizationToken_ = value;
onChanged();
return this;
}
// @@protoc_insertion_point(builder_scope:MethodCompletionInfo)
}
static {
defaultInstance = new MethodCompletionInfo(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:MethodCompletionInfo)
}
public interface MethodCompletionInfoListOrBuilder extends
// @@protoc_insertion_point(interface_extends:MethodCompletionInfoList)
com.google.protobuf.MessageOrBuilder {
/**
* <code>repeated .MethodCompletionInfo method_completion_info = 1;</code>
*/
java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo>
getMethodCompletionInfoList();
/**
* <code>repeated .MethodCompletionInfo method_completion_info = 1;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo getMethodCompletionInfo(int index);
/**
* <code>repeated .MethodCompletionInfo method_completion_info = 1;</code>
*/
int getMethodCompletionInfoCount();
/**
* <code>repeated .MethodCompletionInfo method_completion_info = 1;</code>
*/
java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfoOrBuilder>
getMethodCompletionInfoOrBuilderList();
/**
* <code>repeated .MethodCompletionInfo method_completion_info = 1;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfoOrBuilder getMethodCompletionInfoOrBuilder(
int index);
}
/**
* Protobuf type {@code MethodCompletionInfoList}
*/
public static final class MethodCompletionInfoList extends
com.google.protobuf.GeneratedMessage implements
// @@protoc_insertion_point(message_implements:MethodCompletionInfoList)
MethodCompletionInfoListOrBuilder {
// Use MethodCompletionInfoList.newBuilder() to construct.
private MethodCompletionInfoList(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private MethodCompletionInfoList(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final MethodCompletionInfoList defaultInstance;
public static MethodCompletionInfoList getDefaultInstance() {
return defaultInstance;
}
public MethodCompletionInfoList getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private MethodCompletionInfoList(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
methodCompletionInfo_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo>();
mutable_bitField0_ |= 0x00000001;
}
methodCompletionInfo_.add(input.readMessage(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo.PARSER, extensionRegistry));
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
methodCompletionInfo_ = java.util.Collections.unmodifiableList(methodCompletionInfo_);
}
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_MethodCompletionInfoList_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_MethodCompletionInfoList_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfoList.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfoList.Builder.class);
}
public static com.google.protobuf.Parser<MethodCompletionInfoList> PARSER =
new com.google.protobuf.AbstractParser<MethodCompletionInfoList>() {
public MethodCompletionInfoList parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new MethodCompletionInfoList(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<MethodCompletionInfoList> getParserForType() {
return PARSER;
}
public static final int METHOD_COMPLETION_INFO_FIELD_NUMBER = 1;
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo> methodCompletionInfo_;
/**
* <code>repeated .MethodCompletionInfo method_completion_info = 1;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo> getMethodCompletionInfoList() {
return methodCompletionInfo_;
}
/**
* <code>repeated .MethodCompletionInfo method_completion_info = 1;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfoOrBuilder>
getMethodCompletionInfoOrBuilderList() {
return methodCompletionInfo_;
}
/**
* <code>repeated .MethodCompletionInfo method_completion_info = 1;</code>
*/
public int getMethodCompletionInfoCount() {
return methodCompletionInfo_.size();
}
/**
* <code>repeated .MethodCompletionInfo method_completion_info = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo getMethodCompletionInfo(int index) {
return methodCompletionInfo_.get(index);
}
/**
* <code>repeated .MethodCompletionInfo method_completion_info = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfoOrBuilder getMethodCompletionInfoOrBuilder(
int index) {
return methodCompletionInfo_.get(index);
}
private void initFields() {
methodCompletionInfo_ = java.util.Collections.emptyList();
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
for (int i = 0; i < getMethodCompletionInfoCount(); i++) {
if (!getMethodCompletionInfo(i).isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
for (int i = 0; i < methodCompletionInfo_.size(); i++) {
output.writeMessage(1, methodCompletionInfo_.get(i));
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
for (int i = 0; i < methodCompletionInfo_.size(); i++) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(1, methodCompletionInfo_.get(i));
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfoList parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfoList parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfoList parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfoList parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfoList parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfoList parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfoList parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfoList parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfoList parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfoList parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfoList prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code MethodCompletionInfoList}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:MethodCompletionInfoList)
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfoListOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_MethodCompletionInfoList_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_MethodCompletionInfoList_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfoList.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfoList.Builder.class);
}
// Construct using com.github.horrorho.inflatabledonkey.protocol.ChunkServer.MethodCompletionInfoList.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
getMethodCompletionInfoFieldBuilder();
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
if (methodCompletionInfoBuilder_ == null) {
methodCompletionInfo_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
} else {
methodCompletionInfoBuilder_.clear();
}
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_MethodCompletionInfoList_descriptor;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfoList getDefaultInstanceForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfoList.getDefaultInstance();
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfoList build() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfoList result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfoList buildPartial() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfoList result = new com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfoList(this);
int from_bitField0_ = bitField0_;
if (methodCompletionInfoBuilder_ == null) {
if (((bitField0_ & 0x00000001) == 0x00000001)) {
methodCompletionInfo_ = java.util.Collections.unmodifiableList(methodCompletionInfo_);
bitField0_ = (bitField0_ & ~0x00000001);
}
result.methodCompletionInfo_ = methodCompletionInfo_;
} else {
result.methodCompletionInfo_ = methodCompletionInfoBuilder_.build();
}
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfoList) {
return mergeFrom((com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfoList)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfoList other) {
if (other == com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfoList.getDefaultInstance()) return this;
if (methodCompletionInfoBuilder_ == null) {
if (!other.methodCompletionInfo_.isEmpty()) {
if (methodCompletionInfo_.isEmpty()) {
methodCompletionInfo_ = other.methodCompletionInfo_;
bitField0_ = (bitField0_ & ~0x00000001);
} else {
ensureMethodCompletionInfoIsMutable();
methodCompletionInfo_.addAll(other.methodCompletionInfo_);
}
onChanged();
}
} else {
if (!other.methodCompletionInfo_.isEmpty()) {
if (methodCompletionInfoBuilder_.isEmpty()) {
methodCompletionInfoBuilder_.dispose();
methodCompletionInfoBuilder_ = null;
methodCompletionInfo_ = other.methodCompletionInfo_;
bitField0_ = (bitField0_ & ~0x00000001);
methodCompletionInfoBuilder_ =
com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
getMethodCompletionInfoFieldBuilder() : null;
} else {
methodCompletionInfoBuilder_.addAllMessages(other.methodCompletionInfo_);
}
}
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
for (int i = 0; i < getMethodCompletionInfoCount(); i++) {
if (!getMethodCompletionInfo(i).isInitialized()) {
return false;
}
}
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfoList parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfoList) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo> methodCompletionInfo_ =
java.util.Collections.emptyList();
private void ensureMethodCompletionInfoIsMutable() {
if (!((bitField0_ & 0x00000001) == 0x00000001)) {
methodCompletionInfo_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo>(methodCompletionInfo_);
bitField0_ |= 0x00000001;
}
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfoOrBuilder> methodCompletionInfoBuilder_;
/**
* <code>repeated .MethodCompletionInfo method_completion_info = 1;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo> getMethodCompletionInfoList() {
if (methodCompletionInfoBuilder_ == null) {
return java.util.Collections.unmodifiableList(methodCompletionInfo_);
} else {
return methodCompletionInfoBuilder_.getMessageList();
}
}
/**
* <code>repeated .MethodCompletionInfo method_completion_info = 1;</code>
*/
public int getMethodCompletionInfoCount() {
if (methodCompletionInfoBuilder_ == null) {
return methodCompletionInfo_.size();
} else {
return methodCompletionInfoBuilder_.getCount();
}
}
/**
* <code>repeated .MethodCompletionInfo method_completion_info = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo getMethodCompletionInfo(int index) {
if (methodCompletionInfoBuilder_ == null) {
return methodCompletionInfo_.get(index);
} else {
return methodCompletionInfoBuilder_.getMessage(index);
}
}
/**
* <code>repeated .MethodCompletionInfo method_completion_info = 1;</code>
*/
public Builder setMethodCompletionInfo(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo value) {
if (methodCompletionInfoBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureMethodCompletionInfoIsMutable();
methodCompletionInfo_.set(index, value);
onChanged();
} else {
methodCompletionInfoBuilder_.setMessage(index, value);
}
return this;
}
/**
* <code>repeated .MethodCompletionInfo method_completion_info = 1;</code>
*/
public Builder setMethodCompletionInfo(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo.Builder builderForValue) {
if (methodCompletionInfoBuilder_ == null) {
ensureMethodCompletionInfoIsMutable();
methodCompletionInfo_.set(index, builderForValue.build());
onChanged();
} else {
methodCompletionInfoBuilder_.setMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .MethodCompletionInfo method_completion_info = 1;</code>
*/
public Builder addMethodCompletionInfo(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo value) {
if (methodCompletionInfoBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureMethodCompletionInfoIsMutable();
methodCompletionInfo_.add(value);
onChanged();
} else {
methodCompletionInfoBuilder_.addMessage(value);
}
return this;
}
/**
* <code>repeated .MethodCompletionInfo method_completion_info = 1;</code>
*/
public Builder addMethodCompletionInfo(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo value) {
if (methodCompletionInfoBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureMethodCompletionInfoIsMutable();
methodCompletionInfo_.add(index, value);
onChanged();
} else {
methodCompletionInfoBuilder_.addMessage(index, value);
}
return this;
}
/**
* <code>repeated .MethodCompletionInfo method_completion_info = 1;</code>
*/
public Builder addMethodCompletionInfo(
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo.Builder builderForValue) {
if (methodCompletionInfoBuilder_ == null) {
ensureMethodCompletionInfoIsMutable();
methodCompletionInfo_.add(builderForValue.build());
onChanged();
} else {
methodCompletionInfoBuilder_.addMessage(builderForValue.build());
}
return this;
}
/**
* <code>repeated .MethodCompletionInfo method_completion_info = 1;</code>
*/
public Builder addMethodCompletionInfo(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo.Builder builderForValue) {
if (methodCompletionInfoBuilder_ == null) {
ensureMethodCompletionInfoIsMutable();
methodCompletionInfo_.add(index, builderForValue.build());
onChanged();
} else {
methodCompletionInfoBuilder_.addMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .MethodCompletionInfo method_completion_info = 1;</code>
*/
public Builder addAllMethodCompletionInfo(
java.lang.Iterable<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo> values) {
if (methodCompletionInfoBuilder_ == null) {
ensureMethodCompletionInfoIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, methodCompletionInfo_);
onChanged();
} else {
methodCompletionInfoBuilder_.addAllMessages(values);
}
return this;
}
/**
* <code>repeated .MethodCompletionInfo method_completion_info = 1;</code>
*/
public Builder clearMethodCompletionInfo() {
if (methodCompletionInfoBuilder_ == null) {
methodCompletionInfo_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
onChanged();
} else {
methodCompletionInfoBuilder_.clear();
}
return this;
}
/**
* <code>repeated .MethodCompletionInfo method_completion_info = 1;</code>
*/
public Builder removeMethodCompletionInfo(int index) {
if (methodCompletionInfoBuilder_ == null) {
ensureMethodCompletionInfoIsMutable();
methodCompletionInfo_.remove(index);
onChanged();
} else {
methodCompletionInfoBuilder_.remove(index);
}
return this;
}
/**
* <code>repeated .MethodCompletionInfo method_completion_info = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo.Builder getMethodCompletionInfoBuilder(
int index) {
return getMethodCompletionInfoFieldBuilder().getBuilder(index);
}
/**
* <code>repeated .MethodCompletionInfo method_completion_info = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfoOrBuilder getMethodCompletionInfoOrBuilder(
int index) {
if (methodCompletionInfoBuilder_ == null) {
return methodCompletionInfo_.get(index); } else {
return methodCompletionInfoBuilder_.getMessageOrBuilder(index);
}
}
/**
* <code>repeated .MethodCompletionInfo method_completion_info = 1;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfoOrBuilder>
getMethodCompletionInfoOrBuilderList() {
if (methodCompletionInfoBuilder_ != null) {
return methodCompletionInfoBuilder_.getMessageOrBuilderList();
} else {
return java.util.Collections.unmodifiableList(methodCompletionInfo_);
}
}
/**
* <code>repeated .MethodCompletionInfo method_completion_info = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo.Builder addMethodCompletionInfoBuilder() {
return getMethodCompletionInfoFieldBuilder().addBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo.getDefaultInstance());
}
/**
* <code>repeated .MethodCompletionInfo method_completion_info = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo.Builder addMethodCompletionInfoBuilder(
int index) {
return getMethodCompletionInfoFieldBuilder().addBuilder(index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo.getDefaultInstance());
}
/**
* <code>repeated .MethodCompletionInfo method_completion_info = 1;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo.Builder>
getMethodCompletionInfoBuilderList() {
return getMethodCompletionInfoFieldBuilder().getBuilderList();
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfoOrBuilder>
getMethodCompletionInfoFieldBuilder() {
if (methodCompletionInfoBuilder_ == null) {
methodCompletionInfoBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfo.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.MethodCompletionInfoOrBuilder>(
methodCompletionInfo_,
((bitField0_ & 0x00000001) == 0x00000001),
getParentForChildren(),
isClean());
methodCompletionInfo_ = null;
}
return methodCompletionInfoBuilder_;
}
// @@protoc_insertion_point(builder_scope:MethodCompletionInfoList)
}
static {
defaultInstance = new MethodCompletionInfoList(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:MethodCompletionInfoList)
}
public interface FileChunkListOrBuilder extends
// @@protoc_insertion_point(interface_extends:FileChunkList)
com.google.protobuf.MessageOrBuilder {
/**
* <code>required bytes file_checksum = 1;</code>
*/
boolean hasFileChecksum();
/**
* <code>required bytes file_checksum = 1;</code>
*/
com.google.protobuf.ByteString getFileChecksum();
/**
* <code>required string authorization = 2;</code>
*/
boolean hasAuthorization();
/**
* <code>required string authorization = 2;</code>
*/
java.lang.String getAuthorization();
/**
* <code>required string authorization = 2;</code>
*/
com.google.protobuf.ByteString
getAuthorizationBytes();
/**
* <code>repeated .ChunkInfo chunk_info = 3;</code>
*/
java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo>
getChunkInfoList();
/**
* <code>repeated .ChunkInfo chunk_info = 3;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo getChunkInfo(int index);
/**
* <code>repeated .ChunkInfo chunk_info = 3;</code>
*/
int getChunkInfoCount();
/**
* <code>repeated .ChunkInfo chunk_info = 3;</code>
*/
java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfoOrBuilder>
getChunkInfoOrBuilderList();
/**
* <code>repeated .ChunkInfo chunk_info = 3;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfoOrBuilder getChunkInfoOrBuilder(
int index);
}
/**
* Protobuf type {@code FileChunkList}
*/
public static final class FileChunkList extends
com.google.protobuf.GeneratedMessage implements
// @@protoc_insertion_point(message_implements:FileChunkList)
FileChunkListOrBuilder {
// Use FileChunkList.newBuilder() to construct.
private FileChunkList(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private FileChunkList(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final FileChunkList defaultInstance;
public static FileChunkList getDefaultInstance() {
return defaultInstance;
}
public FileChunkList getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private FileChunkList(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
bitField0_ |= 0x00000001;
fileChecksum_ = input.readBytes();
break;
}
case 18: {
com.google.protobuf.ByteString bs = input.readBytes();
bitField0_ |= 0x00000002;
authorization_ = bs;
break;
}
case 26: {
if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) {
chunkInfo_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo>();
mutable_bitField0_ |= 0x00000004;
}
chunkInfo_.add(input.readMessage(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo.PARSER, extensionRegistry));
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) {
chunkInfo_ = java.util.Collections.unmodifiableList(chunkInfo_);
}
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileChunkList_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileChunkList_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList.Builder.class);
}
public static com.google.protobuf.Parser<FileChunkList> PARSER =
new com.google.protobuf.AbstractParser<FileChunkList>() {
public FileChunkList parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new FileChunkList(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<FileChunkList> getParserForType() {
return PARSER;
}
private int bitField0_;
public static final int FILE_CHECKSUM_FIELD_NUMBER = 1;
private com.google.protobuf.ByteString fileChecksum_;
/**
* <code>required bytes file_checksum = 1;</code>
*/
public boolean hasFileChecksum() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required bytes file_checksum = 1;</code>
*/
public com.google.protobuf.ByteString getFileChecksum() {
return fileChecksum_;
}
public static final int AUTHORIZATION_FIELD_NUMBER = 2;
private java.lang.Object authorization_;
/**
* <code>required string authorization = 2;</code>
*/
public boolean hasAuthorization() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required string authorization = 2;</code>
*/
public java.lang.String getAuthorization() {
java.lang.Object ref = authorization_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
authorization_ = s;
}
return s;
}
}
/**
* <code>required string authorization = 2;</code>
*/
public com.google.protobuf.ByteString
getAuthorizationBytes() {
java.lang.Object ref = authorization_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
authorization_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int CHUNK_INFO_FIELD_NUMBER = 3;
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo> chunkInfo_;
/**
* <code>repeated .ChunkInfo chunk_info = 3;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo> getChunkInfoList() {
return chunkInfo_;
}
/**
* <code>repeated .ChunkInfo chunk_info = 3;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfoOrBuilder>
getChunkInfoOrBuilderList() {
return chunkInfo_;
}
/**
* <code>repeated .ChunkInfo chunk_info = 3;</code>
*/
public int getChunkInfoCount() {
return chunkInfo_.size();
}
/**
* <code>repeated .ChunkInfo chunk_info = 3;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo getChunkInfo(int index) {
return chunkInfo_.get(index);
}
/**
* <code>repeated .ChunkInfo chunk_info = 3;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfoOrBuilder getChunkInfoOrBuilder(
int index) {
return chunkInfo_.get(index);
}
private void initFields() {
fileChecksum_ = com.google.protobuf.ByteString.EMPTY;
authorization_ = "";
chunkInfo_ = java.util.Collections.emptyList();
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
if (!hasFileChecksum()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasAuthorization()) {
memoizedIsInitialized = 0;
return false;
}
for (int i = 0; i < getChunkInfoCount(); i++) {
if (!getChunkInfo(i).isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeBytes(1, fileChecksum_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeBytes(2, getAuthorizationBytes());
}
for (int i = 0; i < chunkInfo_.size(); i++) {
output.writeMessage(3, chunkInfo_.get(i));
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(1, fileChecksum_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(2, getAuthorizationBytes());
}
for (int i = 0; i < chunkInfo_.size(); i++) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(3, chunkInfo_.get(i));
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code FileChunkList}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:FileChunkList)
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkListOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileChunkList_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileChunkList_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList.Builder.class);
}
// Construct using com.github.horrorho.inflatabledonkey.protocol.ChunkServer.FileChunkList.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
getChunkInfoFieldBuilder();
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
fileChecksum_ = com.google.protobuf.ByteString.EMPTY;
bitField0_ = (bitField0_ & ~0x00000001);
authorization_ = "";
bitField0_ = (bitField0_ & ~0x00000002);
if (chunkInfoBuilder_ == null) {
chunkInfo_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000004);
} else {
chunkInfoBuilder_.clear();
}
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileChunkList_descriptor;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList getDefaultInstanceForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList.getDefaultInstance();
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList build() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList buildPartial() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList result = new com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
result.fileChecksum_ = fileChecksum_;
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002;
}
result.authorization_ = authorization_;
if (chunkInfoBuilder_ == null) {
if (((bitField0_ & 0x00000004) == 0x00000004)) {
chunkInfo_ = java.util.Collections.unmodifiableList(chunkInfo_);
bitField0_ = (bitField0_ & ~0x00000004);
}
result.chunkInfo_ = chunkInfo_;
} else {
result.chunkInfo_ = chunkInfoBuilder_.build();
}
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList) {
return mergeFrom((com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList other) {
if (other == com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList.getDefaultInstance()) return this;
if (other.hasFileChecksum()) {
setFileChecksum(other.getFileChecksum());
}
if (other.hasAuthorization()) {
bitField0_ |= 0x00000002;
authorization_ = other.authorization_;
onChanged();
}
if (chunkInfoBuilder_ == null) {
if (!other.chunkInfo_.isEmpty()) {
if (chunkInfo_.isEmpty()) {
chunkInfo_ = other.chunkInfo_;
bitField0_ = (bitField0_ & ~0x00000004);
} else {
ensureChunkInfoIsMutable();
chunkInfo_.addAll(other.chunkInfo_);
}
onChanged();
}
} else {
if (!other.chunkInfo_.isEmpty()) {
if (chunkInfoBuilder_.isEmpty()) {
chunkInfoBuilder_.dispose();
chunkInfoBuilder_ = null;
chunkInfo_ = other.chunkInfo_;
bitField0_ = (bitField0_ & ~0x00000004);
chunkInfoBuilder_ =
com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
getChunkInfoFieldBuilder() : null;
} else {
chunkInfoBuilder_.addAllMessages(other.chunkInfo_);
}
}
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
if (!hasFileChecksum()) {
return false;
}
if (!hasAuthorization()) {
return false;
}
for (int i = 0; i < getChunkInfoCount(); i++) {
if (!getChunkInfo(i).isInitialized()) {
return false;
}
}
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private com.google.protobuf.ByteString fileChecksum_ = com.google.protobuf.ByteString.EMPTY;
/**
* <code>required bytes file_checksum = 1;</code>
*/
public boolean hasFileChecksum() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required bytes file_checksum = 1;</code>
*/
public com.google.protobuf.ByteString getFileChecksum() {
return fileChecksum_;
}
/**
* <code>required bytes file_checksum = 1;</code>
*/
public Builder setFileChecksum(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
fileChecksum_ = value;
onChanged();
return this;
}
/**
* <code>required bytes file_checksum = 1;</code>
*/
public Builder clearFileChecksum() {
bitField0_ = (bitField0_ & ~0x00000001);
fileChecksum_ = getDefaultInstance().getFileChecksum();
onChanged();
return this;
}
private java.lang.Object authorization_ = "";
/**
* <code>required string authorization = 2;</code>
*/
public boolean hasAuthorization() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required string authorization = 2;</code>
*/
public java.lang.String getAuthorization() {
java.lang.Object ref = authorization_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
authorization_ = s;
}
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>required string authorization = 2;</code>
*/
public com.google.protobuf.ByteString
getAuthorizationBytes() {
java.lang.Object ref = authorization_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
authorization_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>required string authorization = 2;</code>
*/
public Builder setAuthorization(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000002;
authorization_ = value;
onChanged();
return this;
}
/**
* <code>required string authorization = 2;</code>
*/
public Builder clearAuthorization() {
bitField0_ = (bitField0_ & ~0x00000002);
authorization_ = getDefaultInstance().getAuthorization();
onChanged();
return this;
}
/**
* <code>required string authorization = 2;</code>
*/
public Builder setAuthorizationBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000002;
authorization_ = value;
onChanged();
return this;
}
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo> chunkInfo_ =
java.util.Collections.emptyList();
private void ensureChunkInfoIsMutable() {
if (!((bitField0_ & 0x00000004) == 0x00000004)) {
chunkInfo_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo>(chunkInfo_);
bitField0_ |= 0x00000004;
}
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfoOrBuilder> chunkInfoBuilder_;
/**
* <code>repeated .ChunkInfo chunk_info = 3;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo> getChunkInfoList() {
if (chunkInfoBuilder_ == null) {
return java.util.Collections.unmodifiableList(chunkInfo_);
} else {
return chunkInfoBuilder_.getMessageList();
}
}
/**
* <code>repeated .ChunkInfo chunk_info = 3;</code>
*/
public int getChunkInfoCount() {
if (chunkInfoBuilder_ == null) {
return chunkInfo_.size();
} else {
return chunkInfoBuilder_.getCount();
}
}
/**
* <code>repeated .ChunkInfo chunk_info = 3;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo getChunkInfo(int index) {
if (chunkInfoBuilder_ == null) {
return chunkInfo_.get(index);
} else {
return chunkInfoBuilder_.getMessage(index);
}
}
/**
* <code>repeated .ChunkInfo chunk_info = 3;</code>
*/
public Builder setChunkInfo(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo value) {
if (chunkInfoBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureChunkInfoIsMutable();
chunkInfo_.set(index, value);
onChanged();
} else {
chunkInfoBuilder_.setMessage(index, value);
}
return this;
}
/**
* <code>repeated .ChunkInfo chunk_info = 3;</code>
*/
public Builder setChunkInfo(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo.Builder builderForValue) {
if (chunkInfoBuilder_ == null) {
ensureChunkInfoIsMutable();
chunkInfo_.set(index, builderForValue.build());
onChanged();
} else {
chunkInfoBuilder_.setMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .ChunkInfo chunk_info = 3;</code>
*/
public Builder addChunkInfo(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo value) {
if (chunkInfoBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureChunkInfoIsMutable();
chunkInfo_.add(value);
onChanged();
} else {
chunkInfoBuilder_.addMessage(value);
}
return this;
}
/**
* <code>repeated .ChunkInfo chunk_info = 3;</code>
*/
public Builder addChunkInfo(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo value) {
if (chunkInfoBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureChunkInfoIsMutable();
chunkInfo_.add(index, value);
onChanged();
} else {
chunkInfoBuilder_.addMessage(index, value);
}
return this;
}
/**
* <code>repeated .ChunkInfo chunk_info = 3;</code>
*/
public Builder addChunkInfo(
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo.Builder builderForValue) {
if (chunkInfoBuilder_ == null) {
ensureChunkInfoIsMutable();
chunkInfo_.add(builderForValue.build());
onChanged();
} else {
chunkInfoBuilder_.addMessage(builderForValue.build());
}
return this;
}
/**
* <code>repeated .ChunkInfo chunk_info = 3;</code>
*/
public Builder addChunkInfo(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo.Builder builderForValue) {
if (chunkInfoBuilder_ == null) {
ensureChunkInfoIsMutable();
chunkInfo_.add(index, builderForValue.build());
onChanged();
} else {
chunkInfoBuilder_.addMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .ChunkInfo chunk_info = 3;</code>
*/
public Builder addAllChunkInfo(
java.lang.Iterable<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo> values) {
if (chunkInfoBuilder_ == null) {
ensureChunkInfoIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, chunkInfo_);
onChanged();
} else {
chunkInfoBuilder_.addAllMessages(values);
}
return this;
}
/**
* <code>repeated .ChunkInfo chunk_info = 3;</code>
*/
public Builder clearChunkInfo() {
if (chunkInfoBuilder_ == null) {
chunkInfo_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000004);
onChanged();
} else {
chunkInfoBuilder_.clear();
}
return this;
}
/**
* <code>repeated .ChunkInfo chunk_info = 3;</code>
*/
public Builder removeChunkInfo(int index) {
if (chunkInfoBuilder_ == null) {
ensureChunkInfoIsMutable();
chunkInfo_.remove(index);
onChanged();
} else {
chunkInfoBuilder_.remove(index);
}
return this;
}
/**
* <code>repeated .ChunkInfo chunk_info = 3;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo.Builder getChunkInfoBuilder(
int index) {
return getChunkInfoFieldBuilder().getBuilder(index);
}
/**
* <code>repeated .ChunkInfo chunk_info = 3;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfoOrBuilder getChunkInfoOrBuilder(
int index) {
if (chunkInfoBuilder_ == null) {
return chunkInfo_.get(index); } else {
return chunkInfoBuilder_.getMessageOrBuilder(index);
}
}
/**
* <code>repeated .ChunkInfo chunk_info = 3;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfoOrBuilder>
getChunkInfoOrBuilderList() {
if (chunkInfoBuilder_ != null) {
return chunkInfoBuilder_.getMessageOrBuilderList();
} else {
return java.util.Collections.unmodifiableList(chunkInfo_);
}
}
/**
* <code>repeated .ChunkInfo chunk_info = 3;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo.Builder addChunkInfoBuilder() {
return getChunkInfoFieldBuilder().addBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo.getDefaultInstance());
}
/**
* <code>repeated .ChunkInfo chunk_info = 3;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo.Builder addChunkInfoBuilder(
int index) {
return getChunkInfoFieldBuilder().addBuilder(index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo.getDefaultInstance());
}
/**
* <code>repeated .ChunkInfo chunk_info = 3;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo.Builder>
getChunkInfoBuilderList() {
return getChunkInfoFieldBuilder().getBuilderList();
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfoOrBuilder>
getChunkInfoFieldBuilder() {
if (chunkInfoBuilder_ == null) {
chunkInfoBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfoOrBuilder>(
chunkInfo_,
((bitField0_ & 0x00000004) == 0x00000004),
getParentForChildren(),
isClean());
chunkInfo_ = null;
}
return chunkInfoBuilder_;
}
// @@protoc_insertion_point(builder_scope:FileChunkList)
}
static {
defaultInstance = new FileChunkList(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:FileChunkList)
}
public interface FileChunkListsOrBuilder extends
// @@protoc_insertion_point(interface_extends:FileChunkLists)
com.google.protobuf.MessageOrBuilder {
/**
* <code>repeated .FileChunkList file_chunk_list = 1;</code>
*/
java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList>
getFileChunkListList();
/**
* <code>repeated .FileChunkList file_chunk_list = 1;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList getFileChunkList(int index);
/**
* <code>repeated .FileChunkList file_chunk_list = 1;</code>
*/
int getFileChunkListCount();
/**
* <code>repeated .FileChunkList file_chunk_list = 1;</code>
*/
java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkListOrBuilder>
getFileChunkListOrBuilderList();
/**
* <code>repeated .FileChunkList file_chunk_list = 1;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkListOrBuilder getFileChunkListOrBuilder(
int index);
}
/**
* Protobuf type {@code FileChunkLists}
*/
public static final class FileChunkLists extends
com.google.protobuf.GeneratedMessage implements
// @@protoc_insertion_point(message_implements:FileChunkLists)
FileChunkListsOrBuilder {
// Use FileChunkLists.newBuilder() to construct.
private FileChunkLists(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private FileChunkLists(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final FileChunkLists defaultInstance;
public static FileChunkLists getDefaultInstance() {
return defaultInstance;
}
public FileChunkLists getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private FileChunkLists(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
fileChunkList_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList>();
mutable_bitField0_ |= 0x00000001;
}
fileChunkList_.add(input.readMessage(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList.PARSER, extensionRegistry));
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
fileChunkList_ = java.util.Collections.unmodifiableList(fileChunkList_);
}
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileChunkLists_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileChunkLists_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkLists.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkLists.Builder.class);
}
public static com.google.protobuf.Parser<FileChunkLists> PARSER =
new com.google.protobuf.AbstractParser<FileChunkLists>() {
public FileChunkLists parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new FileChunkLists(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<FileChunkLists> getParserForType() {
return PARSER;
}
public static final int FILE_CHUNK_LIST_FIELD_NUMBER = 1;
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList> fileChunkList_;
/**
* <code>repeated .FileChunkList file_chunk_list = 1;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList> getFileChunkListList() {
return fileChunkList_;
}
/**
* <code>repeated .FileChunkList file_chunk_list = 1;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkListOrBuilder>
getFileChunkListOrBuilderList() {
return fileChunkList_;
}
/**
* <code>repeated .FileChunkList file_chunk_list = 1;</code>
*/
public int getFileChunkListCount() {
return fileChunkList_.size();
}
/**
* <code>repeated .FileChunkList file_chunk_list = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList getFileChunkList(int index) {
return fileChunkList_.get(index);
}
/**
* <code>repeated .FileChunkList file_chunk_list = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkListOrBuilder getFileChunkListOrBuilder(
int index) {
return fileChunkList_.get(index);
}
private void initFields() {
fileChunkList_ = java.util.Collections.emptyList();
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
for (int i = 0; i < getFileChunkListCount(); i++) {
if (!getFileChunkList(i).isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
for (int i = 0; i < fileChunkList_.size(); i++) {
output.writeMessage(1, fileChunkList_.get(i));
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
for (int i = 0; i < fileChunkList_.size(); i++) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(1, fileChunkList_.get(i));
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkLists parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkLists parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkLists parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkLists parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkLists parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkLists parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkLists parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkLists parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkLists parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkLists parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkLists prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code FileChunkLists}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:FileChunkLists)
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkListsOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileChunkLists_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileChunkLists_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkLists.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkLists.Builder.class);
}
// Construct using com.github.horrorho.inflatabledonkey.protocol.ChunkServer.FileChunkLists.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
getFileChunkListFieldBuilder();
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
if (fileChunkListBuilder_ == null) {
fileChunkList_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
} else {
fileChunkListBuilder_.clear();
}
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileChunkLists_descriptor;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkLists getDefaultInstanceForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkLists.getDefaultInstance();
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkLists build() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkLists result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkLists buildPartial() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkLists result = new com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkLists(this);
int from_bitField0_ = bitField0_;
if (fileChunkListBuilder_ == null) {
if (((bitField0_ & 0x00000001) == 0x00000001)) {
fileChunkList_ = java.util.Collections.unmodifiableList(fileChunkList_);
bitField0_ = (bitField0_ & ~0x00000001);
}
result.fileChunkList_ = fileChunkList_;
} else {
result.fileChunkList_ = fileChunkListBuilder_.build();
}
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkLists) {
return mergeFrom((com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkLists)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkLists other) {
if (other == com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkLists.getDefaultInstance()) return this;
if (fileChunkListBuilder_ == null) {
if (!other.fileChunkList_.isEmpty()) {
if (fileChunkList_.isEmpty()) {
fileChunkList_ = other.fileChunkList_;
bitField0_ = (bitField0_ & ~0x00000001);
} else {
ensureFileChunkListIsMutable();
fileChunkList_.addAll(other.fileChunkList_);
}
onChanged();
}
} else {
if (!other.fileChunkList_.isEmpty()) {
if (fileChunkListBuilder_.isEmpty()) {
fileChunkListBuilder_.dispose();
fileChunkListBuilder_ = null;
fileChunkList_ = other.fileChunkList_;
bitField0_ = (bitField0_ & ~0x00000001);
fileChunkListBuilder_ =
com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
getFileChunkListFieldBuilder() : null;
} else {
fileChunkListBuilder_.addAllMessages(other.fileChunkList_);
}
}
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
for (int i = 0; i < getFileChunkListCount(); i++) {
if (!getFileChunkList(i).isInitialized()) {
return false;
}
}
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkLists parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkLists) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList> fileChunkList_ =
java.util.Collections.emptyList();
private void ensureFileChunkListIsMutable() {
if (!((bitField0_ & 0x00000001) == 0x00000001)) {
fileChunkList_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList>(fileChunkList_);
bitField0_ |= 0x00000001;
}
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkListOrBuilder> fileChunkListBuilder_;
/**
* <code>repeated .FileChunkList file_chunk_list = 1;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList> getFileChunkListList() {
if (fileChunkListBuilder_ == null) {
return java.util.Collections.unmodifiableList(fileChunkList_);
} else {
return fileChunkListBuilder_.getMessageList();
}
}
/**
* <code>repeated .FileChunkList file_chunk_list = 1;</code>
*/
public int getFileChunkListCount() {
if (fileChunkListBuilder_ == null) {
return fileChunkList_.size();
} else {
return fileChunkListBuilder_.getCount();
}
}
/**
* <code>repeated .FileChunkList file_chunk_list = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList getFileChunkList(int index) {
if (fileChunkListBuilder_ == null) {
return fileChunkList_.get(index);
} else {
return fileChunkListBuilder_.getMessage(index);
}
}
/**
* <code>repeated .FileChunkList file_chunk_list = 1;</code>
*/
public Builder setFileChunkList(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList value) {
if (fileChunkListBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureFileChunkListIsMutable();
fileChunkList_.set(index, value);
onChanged();
} else {
fileChunkListBuilder_.setMessage(index, value);
}
return this;
}
/**
* <code>repeated .FileChunkList file_chunk_list = 1;</code>
*/
public Builder setFileChunkList(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList.Builder builderForValue) {
if (fileChunkListBuilder_ == null) {
ensureFileChunkListIsMutable();
fileChunkList_.set(index, builderForValue.build());
onChanged();
} else {
fileChunkListBuilder_.setMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .FileChunkList file_chunk_list = 1;</code>
*/
public Builder addFileChunkList(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList value) {
if (fileChunkListBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureFileChunkListIsMutable();
fileChunkList_.add(value);
onChanged();
} else {
fileChunkListBuilder_.addMessage(value);
}
return this;
}
/**
* <code>repeated .FileChunkList file_chunk_list = 1;</code>
*/
public Builder addFileChunkList(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList value) {
if (fileChunkListBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureFileChunkListIsMutable();
fileChunkList_.add(index, value);
onChanged();
} else {
fileChunkListBuilder_.addMessage(index, value);
}
return this;
}
/**
* <code>repeated .FileChunkList file_chunk_list = 1;</code>
*/
public Builder addFileChunkList(
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList.Builder builderForValue) {
if (fileChunkListBuilder_ == null) {
ensureFileChunkListIsMutable();
fileChunkList_.add(builderForValue.build());
onChanged();
} else {
fileChunkListBuilder_.addMessage(builderForValue.build());
}
return this;
}
/**
* <code>repeated .FileChunkList file_chunk_list = 1;</code>
*/
public Builder addFileChunkList(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList.Builder builderForValue) {
if (fileChunkListBuilder_ == null) {
ensureFileChunkListIsMutable();
fileChunkList_.add(index, builderForValue.build());
onChanged();
} else {
fileChunkListBuilder_.addMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .FileChunkList file_chunk_list = 1;</code>
*/
public Builder addAllFileChunkList(
java.lang.Iterable<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList> values) {
if (fileChunkListBuilder_ == null) {
ensureFileChunkListIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, fileChunkList_);
onChanged();
} else {
fileChunkListBuilder_.addAllMessages(values);
}
return this;
}
/**
* <code>repeated .FileChunkList file_chunk_list = 1;</code>
*/
public Builder clearFileChunkList() {
if (fileChunkListBuilder_ == null) {
fileChunkList_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
onChanged();
} else {
fileChunkListBuilder_.clear();
}
return this;
}
/**
* <code>repeated .FileChunkList file_chunk_list = 1;</code>
*/
public Builder removeFileChunkList(int index) {
if (fileChunkListBuilder_ == null) {
ensureFileChunkListIsMutable();
fileChunkList_.remove(index);
onChanged();
} else {
fileChunkListBuilder_.remove(index);
}
return this;
}
/**
* <code>repeated .FileChunkList file_chunk_list = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList.Builder getFileChunkListBuilder(
int index) {
return getFileChunkListFieldBuilder().getBuilder(index);
}
/**
* <code>repeated .FileChunkList file_chunk_list = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkListOrBuilder getFileChunkListOrBuilder(
int index) {
if (fileChunkListBuilder_ == null) {
return fileChunkList_.get(index); } else {
return fileChunkListBuilder_.getMessageOrBuilder(index);
}
}
/**
* <code>repeated .FileChunkList file_chunk_list = 1;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkListOrBuilder>
getFileChunkListOrBuilderList() {
if (fileChunkListBuilder_ != null) {
return fileChunkListBuilder_.getMessageOrBuilderList();
} else {
return java.util.Collections.unmodifiableList(fileChunkList_);
}
}
/**
* <code>repeated .FileChunkList file_chunk_list = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList.Builder addFileChunkListBuilder() {
return getFileChunkListFieldBuilder().addBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList.getDefaultInstance());
}
/**
* <code>repeated .FileChunkList file_chunk_list = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList.Builder addFileChunkListBuilder(
int index) {
return getFileChunkListFieldBuilder().addBuilder(index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList.getDefaultInstance());
}
/**
* <code>repeated .FileChunkList file_chunk_list = 1;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList.Builder>
getFileChunkListBuilderList() {
return getFileChunkListFieldBuilder().getBuilderList();
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkListOrBuilder>
getFileChunkListFieldBuilder() {
if (fileChunkListBuilder_ == null) {
fileChunkListBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkList.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkListOrBuilder>(
fileChunkList_,
((bitField0_ & 0x00000001) == 0x00000001),
getParentForChildren(),
isClean());
fileChunkList_ = null;
}
return fileChunkListBuilder_;
}
// @@protoc_insertion_point(builder_scope:FileChunkLists)
}
static {
defaultInstance = new FileChunkLists(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:FileChunkLists)
}
public interface StorageContainerChunkListOrBuilder extends
// @@protoc_insertion_point(interface_extends:StorageContainerChunkList)
com.google.protobuf.MessageOrBuilder {
/**
* <code>required bytes storage_container_key = 1;</code>
*/
boolean hasStorageContainerKey();
/**
* <code>required bytes storage_container_key = 1;</code>
*/
com.google.protobuf.ByteString getStorageContainerKey();
/**
* <code>required .HostInfo host_info = 2;</code>
*/
boolean hasHostInfo();
/**
* <code>required .HostInfo host_info = 2;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo getHostInfo();
/**
* <code>required .HostInfo host_info = 2;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfoOrBuilder getHostInfoOrBuilder();
/**
* <code>repeated bytes chunk_checksum = 3;</code>
*/
java.util.List<com.google.protobuf.ByteString> getChunkChecksumList();
/**
* <code>repeated bytes chunk_checksum = 3;</code>
*/
int getChunkChecksumCount();
/**
* <code>repeated bytes chunk_checksum = 3;</code>
*/
com.google.protobuf.ByteString getChunkChecksum(int index);
/**
* <code>required string storage_container_authorization_token = 4;</code>
*/
boolean hasStorageContainerAuthorizationToken();
/**
* <code>required string storage_container_authorization_token = 4;</code>
*/
java.lang.String getStorageContainerAuthorizationToken();
/**
* <code>required string storage_container_authorization_token = 4;</code>
*/
com.google.protobuf.ByteString
getStorageContainerAuthorizationTokenBytes();
}
/**
* Protobuf type {@code StorageContainerChunkList}
*/
public static final class StorageContainerChunkList extends
com.google.protobuf.GeneratedMessage implements
// @@protoc_insertion_point(message_implements:StorageContainerChunkList)
StorageContainerChunkListOrBuilder {
// Use StorageContainerChunkList.newBuilder() to construct.
private StorageContainerChunkList(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private StorageContainerChunkList(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final StorageContainerChunkList defaultInstance;
public static StorageContainerChunkList getDefaultInstance() {
return defaultInstance;
}
public StorageContainerChunkList getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private StorageContainerChunkList(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
bitField0_ |= 0x00000001;
storageContainerKey_ = input.readBytes();
break;
}
case 18: {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo.Builder subBuilder = null;
if (((bitField0_ & 0x00000002) == 0x00000002)) {
subBuilder = hostInfo_.toBuilder();
}
hostInfo_ = input.readMessage(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(hostInfo_);
hostInfo_ = subBuilder.buildPartial();
}
bitField0_ |= 0x00000002;
break;
}
case 26: {
if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) {
chunkChecksum_ = new java.util.ArrayList<com.google.protobuf.ByteString>();
mutable_bitField0_ |= 0x00000004;
}
chunkChecksum_.add(input.readBytes());
break;
}
case 34: {
com.google.protobuf.ByteString bs = input.readBytes();
bitField0_ |= 0x00000004;
storageContainerAuthorizationToken_ = bs;
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) {
chunkChecksum_ = java.util.Collections.unmodifiableList(chunkChecksum_);
}
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_StorageContainerChunkList_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_StorageContainerChunkList_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList.Builder.class);
}
public static com.google.protobuf.Parser<StorageContainerChunkList> PARSER =
new com.google.protobuf.AbstractParser<StorageContainerChunkList>() {
public StorageContainerChunkList parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new StorageContainerChunkList(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<StorageContainerChunkList> getParserForType() {
return PARSER;
}
private int bitField0_;
public static final int STORAGE_CONTAINER_KEY_FIELD_NUMBER = 1;
private com.google.protobuf.ByteString storageContainerKey_;
/**
* <code>required bytes storage_container_key = 1;</code>
*/
public boolean hasStorageContainerKey() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required bytes storage_container_key = 1;</code>
*/
public com.google.protobuf.ByteString getStorageContainerKey() {
return storageContainerKey_;
}
public static final int HOST_INFO_FIELD_NUMBER = 2;
private com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo hostInfo_;
/**
* <code>required .HostInfo host_info = 2;</code>
*/
public boolean hasHostInfo() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required .HostInfo host_info = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo getHostInfo() {
return hostInfo_;
}
/**
* <code>required .HostInfo host_info = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfoOrBuilder getHostInfoOrBuilder() {
return hostInfo_;
}
public static final int CHUNK_CHECKSUM_FIELD_NUMBER = 3;
private java.util.List<com.google.protobuf.ByteString> chunkChecksum_;
/**
* <code>repeated bytes chunk_checksum = 3;</code>
*/
public java.util.List<com.google.protobuf.ByteString>
getChunkChecksumList() {
return chunkChecksum_;
}
/**
* <code>repeated bytes chunk_checksum = 3;</code>
*/
public int getChunkChecksumCount() {
return chunkChecksum_.size();
}
/**
* <code>repeated bytes chunk_checksum = 3;</code>
*/
public com.google.protobuf.ByteString getChunkChecksum(int index) {
return chunkChecksum_.get(index);
}
public static final int STORAGE_CONTAINER_AUTHORIZATION_TOKEN_FIELD_NUMBER = 4;
private java.lang.Object storageContainerAuthorizationToken_;
/**
* <code>required string storage_container_authorization_token = 4;</code>
*/
public boolean hasStorageContainerAuthorizationToken() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>required string storage_container_authorization_token = 4;</code>
*/
public java.lang.String getStorageContainerAuthorizationToken() {
java.lang.Object ref = storageContainerAuthorizationToken_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
storageContainerAuthorizationToken_ = s;
}
return s;
}
}
/**
* <code>required string storage_container_authorization_token = 4;</code>
*/
public com.google.protobuf.ByteString
getStorageContainerAuthorizationTokenBytes() {
java.lang.Object ref = storageContainerAuthorizationToken_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
storageContainerAuthorizationToken_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
private void initFields() {
storageContainerKey_ = com.google.protobuf.ByteString.EMPTY;
hostInfo_ = com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo.getDefaultInstance();
chunkChecksum_ = java.util.Collections.emptyList();
storageContainerAuthorizationToken_ = "";
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
if (!hasStorageContainerKey()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasHostInfo()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasStorageContainerAuthorizationToken()) {
memoizedIsInitialized = 0;
return false;
}
if (!getHostInfo().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeBytes(1, storageContainerKey_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeMessage(2, hostInfo_);
}
for (int i = 0; i < chunkChecksum_.size(); i++) {
output.writeBytes(3, chunkChecksum_.get(i));
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
output.writeBytes(4, getStorageContainerAuthorizationTokenBytes());
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(1, storageContainerKey_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(2, hostInfo_);
}
{
int dataSize = 0;
for (int i = 0; i < chunkChecksum_.size(); i++) {
dataSize += com.google.protobuf.CodedOutputStream
.computeBytesSizeNoTag(chunkChecksum_.get(i));
}
size += dataSize;
size += 1 * getChunkChecksumList().size();
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(4, getStorageContainerAuthorizationTokenBytes());
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code StorageContainerChunkList}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:StorageContainerChunkList)
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkListOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_StorageContainerChunkList_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_StorageContainerChunkList_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList.Builder.class);
}
// Construct using com.github.horrorho.inflatabledonkey.protocol.ChunkServer.StorageContainerChunkList.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
getHostInfoFieldBuilder();
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
storageContainerKey_ = com.google.protobuf.ByteString.EMPTY;
bitField0_ = (bitField0_ & ~0x00000001);
if (hostInfoBuilder_ == null) {
hostInfo_ = com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo.getDefaultInstance();
} else {
hostInfoBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00000002);
chunkChecksum_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000004);
storageContainerAuthorizationToken_ = "";
bitField0_ = (bitField0_ & ~0x00000008);
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_StorageContainerChunkList_descriptor;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList getDefaultInstanceForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList.getDefaultInstance();
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList build() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList buildPartial() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList result = new com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
result.storageContainerKey_ = storageContainerKey_;
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002;
}
if (hostInfoBuilder_ == null) {
result.hostInfo_ = hostInfo_;
} else {
result.hostInfo_ = hostInfoBuilder_.build();
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
chunkChecksum_ = java.util.Collections.unmodifiableList(chunkChecksum_);
bitField0_ = (bitField0_ & ~0x00000004);
}
result.chunkChecksum_ = chunkChecksum_;
if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
to_bitField0_ |= 0x00000004;
}
result.storageContainerAuthorizationToken_ = storageContainerAuthorizationToken_;
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList) {
return mergeFrom((com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList other) {
if (other == com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList.getDefaultInstance()) return this;
if (other.hasStorageContainerKey()) {
setStorageContainerKey(other.getStorageContainerKey());
}
if (other.hasHostInfo()) {
mergeHostInfo(other.getHostInfo());
}
if (!other.chunkChecksum_.isEmpty()) {
if (chunkChecksum_.isEmpty()) {
chunkChecksum_ = other.chunkChecksum_;
bitField0_ = (bitField0_ & ~0x00000004);
} else {
ensureChunkChecksumIsMutable();
chunkChecksum_.addAll(other.chunkChecksum_);
}
onChanged();
}
if (other.hasStorageContainerAuthorizationToken()) {
bitField0_ |= 0x00000008;
storageContainerAuthorizationToken_ = other.storageContainerAuthorizationToken_;
onChanged();
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
if (!hasStorageContainerKey()) {
return false;
}
if (!hasHostInfo()) {
return false;
}
if (!hasStorageContainerAuthorizationToken()) {
return false;
}
if (!getHostInfo().isInitialized()) {
return false;
}
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private com.google.protobuf.ByteString storageContainerKey_ = com.google.protobuf.ByteString.EMPTY;
/**
* <code>required bytes storage_container_key = 1;</code>
*/
public boolean hasStorageContainerKey() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required bytes storage_container_key = 1;</code>
*/
public com.google.protobuf.ByteString getStorageContainerKey() {
return storageContainerKey_;
}
/**
* <code>required bytes storage_container_key = 1;</code>
*/
public Builder setStorageContainerKey(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
storageContainerKey_ = value;
onChanged();
return this;
}
/**
* <code>required bytes storage_container_key = 1;</code>
*/
public Builder clearStorageContainerKey() {
bitField0_ = (bitField0_ & ~0x00000001);
storageContainerKey_ = getDefaultInstance().getStorageContainerKey();
onChanged();
return this;
}
private com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo hostInfo_ = com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo.getDefaultInstance();
private com.google.protobuf.SingleFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfoOrBuilder> hostInfoBuilder_;
/**
* <code>required .HostInfo host_info = 2;</code>
*/
public boolean hasHostInfo() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required .HostInfo host_info = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo getHostInfo() {
if (hostInfoBuilder_ == null) {
return hostInfo_;
} else {
return hostInfoBuilder_.getMessage();
}
}
/**
* <code>required .HostInfo host_info = 2;</code>
*/
public Builder setHostInfo(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo value) {
if (hostInfoBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
hostInfo_ = value;
onChanged();
} else {
hostInfoBuilder_.setMessage(value);
}
bitField0_ |= 0x00000002;
return this;
}
/**
* <code>required .HostInfo host_info = 2;</code>
*/
public Builder setHostInfo(
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo.Builder builderForValue) {
if (hostInfoBuilder_ == null) {
hostInfo_ = builderForValue.build();
onChanged();
} else {
hostInfoBuilder_.setMessage(builderForValue.build());
}
bitField0_ |= 0x00000002;
return this;
}
/**
* <code>required .HostInfo host_info = 2;</code>
*/
public Builder mergeHostInfo(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo value) {
if (hostInfoBuilder_ == null) {
if (((bitField0_ & 0x00000002) == 0x00000002) &&
hostInfo_ != com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo.getDefaultInstance()) {
hostInfo_ =
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo.newBuilder(hostInfo_).mergeFrom(value).buildPartial();
} else {
hostInfo_ = value;
}
onChanged();
} else {
hostInfoBuilder_.mergeFrom(value);
}
bitField0_ |= 0x00000002;
return this;
}
/**
* <code>required .HostInfo host_info = 2;</code>
*/
public Builder clearHostInfo() {
if (hostInfoBuilder_ == null) {
hostInfo_ = com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo.getDefaultInstance();
onChanged();
} else {
hostInfoBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00000002);
return this;
}
/**
* <code>required .HostInfo host_info = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo.Builder getHostInfoBuilder() {
bitField0_ |= 0x00000002;
onChanged();
return getHostInfoFieldBuilder().getBuilder();
}
/**
* <code>required .HostInfo host_info = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfoOrBuilder getHostInfoOrBuilder() {
if (hostInfoBuilder_ != null) {
return hostInfoBuilder_.getMessageOrBuilder();
} else {
return hostInfo_;
}
}
/**
* <code>required .HostInfo host_info = 2;</code>
*/
private com.google.protobuf.SingleFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfoOrBuilder>
getHostInfoFieldBuilder() {
if (hostInfoBuilder_ == null) {
hostInfoBuilder_ = new com.google.protobuf.SingleFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfoOrBuilder>(
getHostInfo(),
getParentForChildren(),
isClean());
hostInfo_ = null;
}
return hostInfoBuilder_;
}
private java.util.List<com.google.protobuf.ByteString> chunkChecksum_ = java.util.Collections.emptyList();
private void ensureChunkChecksumIsMutable() {
if (!((bitField0_ & 0x00000004) == 0x00000004)) {
chunkChecksum_ = new java.util.ArrayList<com.google.protobuf.ByteString>(chunkChecksum_);
bitField0_ |= 0x00000004;
}
}
/**
* <code>repeated bytes chunk_checksum = 3;</code>
*/
public java.util.List<com.google.protobuf.ByteString>
getChunkChecksumList() {
return java.util.Collections.unmodifiableList(chunkChecksum_);
}
/**
* <code>repeated bytes chunk_checksum = 3;</code>
*/
public int getChunkChecksumCount() {
return chunkChecksum_.size();
}
/**
* <code>repeated bytes chunk_checksum = 3;</code>
*/
public com.google.protobuf.ByteString getChunkChecksum(int index) {
return chunkChecksum_.get(index);
}
/**
* <code>repeated bytes chunk_checksum = 3;</code>
*/
public Builder setChunkChecksum(
int index, com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
ensureChunkChecksumIsMutable();
chunkChecksum_.set(index, value);
onChanged();
return this;
}
/**
* <code>repeated bytes chunk_checksum = 3;</code>
*/
public Builder addChunkChecksum(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
ensureChunkChecksumIsMutable();
chunkChecksum_.add(value);
onChanged();
return this;
}
/**
* <code>repeated bytes chunk_checksum = 3;</code>
*/
public Builder addAllChunkChecksum(
java.lang.Iterable<? extends com.google.protobuf.ByteString> values) {
ensureChunkChecksumIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, chunkChecksum_);
onChanged();
return this;
}
/**
* <code>repeated bytes chunk_checksum = 3;</code>
*/
public Builder clearChunkChecksum() {
chunkChecksum_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000004);
onChanged();
return this;
}
private java.lang.Object storageContainerAuthorizationToken_ = "";
/**
* <code>required string storage_container_authorization_token = 4;</code>
*/
public boolean hasStorageContainerAuthorizationToken() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>required string storage_container_authorization_token = 4;</code>
*/
public java.lang.String getStorageContainerAuthorizationToken() {
java.lang.Object ref = storageContainerAuthorizationToken_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
storageContainerAuthorizationToken_ = s;
}
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>required string storage_container_authorization_token = 4;</code>
*/
public com.google.protobuf.ByteString
getStorageContainerAuthorizationTokenBytes() {
java.lang.Object ref = storageContainerAuthorizationToken_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
storageContainerAuthorizationToken_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>required string storage_container_authorization_token = 4;</code>
*/
public Builder setStorageContainerAuthorizationToken(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000008;
storageContainerAuthorizationToken_ = value;
onChanged();
return this;
}
/**
* <code>required string storage_container_authorization_token = 4;</code>
*/
public Builder clearStorageContainerAuthorizationToken() {
bitField0_ = (bitField0_ & ~0x00000008);
storageContainerAuthorizationToken_ = getDefaultInstance().getStorageContainerAuthorizationToken();
onChanged();
return this;
}
/**
* <code>required string storage_container_authorization_token = 4;</code>
*/
public Builder setStorageContainerAuthorizationTokenBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000008;
storageContainerAuthorizationToken_ = value;
onChanged();
return this;
}
// @@protoc_insertion_point(builder_scope:StorageContainerChunkList)
}
static {
defaultInstance = new StorageContainerChunkList(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:StorageContainerChunkList)
}
public interface StorageContainerChunkListsOrBuilder extends
// @@protoc_insertion_point(interface_extends:StorageContainerChunkLists)
com.google.protobuf.MessageOrBuilder {
/**
* <code>repeated .StorageContainerChunkList storage_container_chunk_list = 1;</code>
*/
java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList>
getStorageContainerChunkListList();
/**
* <code>repeated .StorageContainerChunkList storage_container_chunk_list = 1;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList getStorageContainerChunkList(int index);
/**
* <code>repeated .StorageContainerChunkList storage_container_chunk_list = 1;</code>
*/
int getStorageContainerChunkListCount();
/**
* <code>repeated .StorageContainerChunkList storage_container_chunk_list = 1;</code>
*/
java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkListOrBuilder>
getStorageContainerChunkListOrBuilderList();
/**
* <code>repeated .StorageContainerChunkList storage_container_chunk_list = 1;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkListOrBuilder getStorageContainerChunkListOrBuilder(
int index);
/**
* <code>repeated .FileError file_error = 2;</code>
*/
java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError>
getFileErrorList();
/**
* <code>repeated .FileError file_error = 2;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError getFileError(int index);
/**
* <code>repeated .FileError file_error = 2;</code>
*/
int getFileErrorCount();
/**
* <code>repeated .FileError file_error = 2;</code>
*/
java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileErrorOrBuilder>
getFileErrorOrBuilderList();
/**
* <code>repeated .FileError file_error = 2;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileErrorOrBuilder getFileErrorOrBuilder(
int index);
/**
* <code>optional uint32 verbosity_level = 3;</code>
*/
boolean hasVerbosityLevel();
/**
* <code>optional uint32 verbosity_level = 3;</code>
*/
int getVerbosityLevel();
}
/**
* Protobuf type {@code StorageContainerChunkLists}
*/
public static final class StorageContainerChunkLists extends
com.google.protobuf.GeneratedMessage implements
// @@protoc_insertion_point(message_implements:StorageContainerChunkLists)
StorageContainerChunkListsOrBuilder {
// Use StorageContainerChunkLists.newBuilder() to construct.
private StorageContainerChunkLists(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private StorageContainerChunkLists(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final StorageContainerChunkLists defaultInstance;
public static StorageContainerChunkLists getDefaultInstance() {
return defaultInstance;
}
public StorageContainerChunkLists getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private StorageContainerChunkLists(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
storageContainerChunkList_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList>();
mutable_bitField0_ |= 0x00000001;
}
storageContainerChunkList_.add(input.readMessage(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList.PARSER, extensionRegistry));
break;
}
case 18: {
if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
fileError_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError>();
mutable_bitField0_ |= 0x00000002;
}
fileError_.add(input.readMessage(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError.PARSER, extensionRegistry));
break;
}
case 24: {
bitField0_ |= 0x00000001;
verbosityLevel_ = input.readUInt32();
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
storageContainerChunkList_ = java.util.Collections.unmodifiableList(storageContainerChunkList_);
}
if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
fileError_ = java.util.Collections.unmodifiableList(fileError_);
}
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_StorageContainerChunkLists_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_StorageContainerChunkLists_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkLists.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkLists.Builder.class);
}
public static com.google.protobuf.Parser<StorageContainerChunkLists> PARSER =
new com.google.protobuf.AbstractParser<StorageContainerChunkLists>() {
public StorageContainerChunkLists parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new StorageContainerChunkLists(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<StorageContainerChunkLists> getParserForType() {
return PARSER;
}
private int bitField0_;
public static final int STORAGE_CONTAINER_CHUNK_LIST_FIELD_NUMBER = 1;
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList> storageContainerChunkList_;
/**
* <code>repeated .StorageContainerChunkList storage_container_chunk_list = 1;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList> getStorageContainerChunkListList() {
return storageContainerChunkList_;
}
/**
* <code>repeated .StorageContainerChunkList storage_container_chunk_list = 1;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkListOrBuilder>
getStorageContainerChunkListOrBuilderList() {
return storageContainerChunkList_;
}
/**
* <code>repeated .StorageContainerChunkList storage_container_chunk_list = 1;</code>
*/
public int getStorageContainerChunkListCount() {
return storageContainerChunkList_.size();
}
/**
* <code>repeated .StorageContainerChunkList storage_container_chunk_list = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList getStorageContainerChunkList(int index) {
return storageContainerChunkList_.get(index);
}
/**
* <code>repeated .StorageContainerChunkList storage_container_chunk_list = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkListOrBuilder getStorageContainerChunkListOrBuilder(
int index) {
return storageContainerChunkList_.get(index);
}
public static final int FILE_ERROR_FIELD_NUMBER = 2;
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError> fileError_;
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError> getFileErrorList() {
return fileError_;
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileErrorOrBuilder>
getFileErrorOrBuilderList() {
return fileError_;
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public int getFileErrorCount() {
return fileError_.size();
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError getFileError(int index) {
return fileError_.get(index);
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileErrorOrBuilder getFileErrorOrBuilder(
int index) {
return fileError_.get(index);
}
public static final int VERBOSITY_LEVEL_FIELD_NUMBER = 3;
private int verbosityLevel_;
/**
* <code>optional uint32 verbosity_level = 3;</code>
*/
public boolean hasVerbosityLevel() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>optional uint32 verbosity_level = 3;</code>
*/
public int getVerbosityLevel() {
return verbosityLevel_;
}
private void initFields() {
storageContainerChunkList_ = java.util.Collections.emptyList();
fileError_ = java.util.Collections.emptyList();
verbosityLevel_ = 0;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
for (int i = 0; i < getStorageContainerChunkListCount(); i++) {
if (!getStorageContainerChunkList(i).isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
for (int i = 0; i < getFileErrorCount(); i++) {
if (!getFileError(i).isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
for (int i = 0; i < storageContainerChunkList_.size(); i++) {
output.writeMessage(1, storageContainerChunkList_.get(i));
}
for (int i = 0; i < fileError_.size(); i++) {
output.writeMessage(2, fileError_.get(i));
}
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeUInt32(3, verbosityLevel_);
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
for (int i = 0; i < storageContainerChunkList_.size(); i++) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(1, storageContainerChunkList_.get(i));
}
for (int i = 0; i < fileError_.size(); i++) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(2, fileError_.get(i));
}
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream
.computeUInt32Size(3, verbosityLevel_);
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkLists parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkLists parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkLists parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkLists parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkLists parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkLists parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkLists parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkLists parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkLists parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkLists parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkLists prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code StorageContainerChunkLists}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:StorageContainerChunkLists)
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkListsOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_StorageContainerChunkLists_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_StorageContainerChunkLists_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkLists.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkLists.Builder.class);
}
// Construct using com.github.horrorho.inflatabledonkey.protocol.ChunkServer.StorageContainerChunkLists.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
getStorageContainerChunkListFieldBuilder();
getFileErrorFieldBuilder();
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
if (storageContainerChunkListBuilder_ == null) {
storageContainerChunkList_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
} else {
storageContainerChunkListBuilder_.clear();
}
if (fileErrorBuilder_ == null) {
fileError_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000002);
} else {
fileErrorBuilder_.clear();
}
verbosityLevel_ = 0;
bitField0_ = (bitField0_ & ~0x00000004);
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_StorageContainerChunkLists_descriptor;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkLists getDefaultInstanceForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkLists.getDefaultInstance();
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkLists build() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkLists result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkLists buildPartial() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkLists result = new com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkLists(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (storageContainerChunkListBuilder_ == null) {
if (((bitField0_ & 0x00000001) == 0x00000001)) {
storageContainerChunkList_ = java.util.Collections.unmodifiableList(storageContainerChunkList_);
bitField0_ = (bitField0_ & ~0x00000001);
}
result.storageContainerChunkList_ = storageContainerChunkList_;
} else {
result.storageContainerChunkList_ = storageContainerChunkListBuilder_.build();
}
if (fileErrorBuilder_ == null) {
if (((bitField0_ & 0x00000002) == 0x00000002)) {
fileError_ = java.util.Collections.unmodifiableList(fileError_);
bitField0_ = (bitField0_ & ~0x00000002);
}
result.fileError_ = fileError_;
} else {
result.fileError_ = fileErrorBuilder_.build();
}
if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
to_bitField0_ |= 0x00000001;
}
result.verbosityLevel_ = verbosityLevel_;
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkLists) {
return mergeFrom((com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkLists)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkLists other) {
if (other == com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkLists.getDefaultInstance()) return this;
if (storageContainerChunkListBuilder_ == null) {
if (!other.storageContainerChunkList_.isEmpty()) {
if (storageContainerChunkList_.isEmpty()) {
storageContainerChunkList_ = other.storageContainerChunkList_;
bitField0_ = (bitField0_ & ~0x00000001);
} else {
ensureStorageContainerChunkListIsMutable();
storageContainerChunkList_.addAll(other.storageContainerChunkList_);
}
onChanged();
}
} else {
if (!other.storageContainerChunkList_.isEmpty()) {
if (storageContainerChunkListBuilder_.isEmpty()) {
storageContainerChunkListBuilder_.dispose();
storageContainerChunkListBuilder_ = null;
storageContainerChunkList_ = other.storageContainerChunkList_;
bitField0_ = (bitField0_ & ~0x00000001);
storageContainerChunkListBuilder_ =
com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
getStorageContainerChunkListFieldBuilder() : null;
} else {
storageContainerChunkListBuilder_.addAllMessages(other.storageContainerChunkList_);
}
}
}
if (fileErrorBuilder_ == null) {
if (!other.fileError_.isEmpty()) {
if (fileError_.isEmpty()) {
fileError_ = other.fileError_;
bitField0_ = (bitField0_ & ~0x00000002);
} else {
ensureFileErrorIsMutable();
fileError_.addAll(other.fileError_);
}
onChanged();
}
} else {
if (!other.fileError_.isEmpty()) {
if (fileErrorBuilder_.isEmpty()) {
fileErrorBuilder_.dispose();
fileErrorBuilder_ = null;
fileError_ = other.fileError_;
bitField0_ = (bitField0_ & ~0x00000002);
fileErrorBuilder_ =
com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
getFileErrorFieldBuilder() : null;
} else {
fileErrorBuilder_.addAllMessages(other.fileError_);
}
}
}
if (other.hasVerbosityLevel()) {
setVerbosityLevel(other.getVerbosityLevel());
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
for (int i = 0; i < getStorageContainerChunkListCount(); i++) {
if (!getStorageContainerChunkList(i).isInitialized()) {
return false;
}
}
for (int i = 0; i < getFileErrorCount(); i++) {
if (!getFileError(i).isInitialized()) {
return false;
}
}
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkLists parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkLists) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList> storageContainerChunkList_ =
java.util.Collections.emptyList();
private void ensureStorageContainerChunkListIsMutable() {
if (!((bitField0_ & 0x00000001) == 0x00000001)) {
storageContainerChunkList_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList>(storageContainerChunkList_);
bitField0_ |= 0x00000001;
}
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkListOrBuilder> storageContainerChunkListBuilder_;
/**
* <code>repeated .StorageContainerChunkList storage_container_chunk_list = 1;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList> getStorageContainerChunkListList() {
if (storageContainerChunkListBuilder_ == null) {
return java.util.Collections.unmodifiableList(storageContainerChunkList_);
} else {
return storageContainerChunkListBuilder_.getMessageList();
}
}
/**
* <code>repeated .StorageContainerChunkList storage_container_chunk_list = 1;</code>
*/
public int getStorageContainerChunkListCount() {
if (storageContainerChunkListBuilder_ == null) {
return storageContainerChunkList_.size();
} else {
return storageContainerChunkListBuilder_.getCount();
}
}
/**
* <code>repeated .StorageContainerChunkList storage_container_chunk_list = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList getStorageContainerChunkList(int index) {
if (storageContainerChunkListBuilder_ == null) {
return storageContainerChunkList_.get(index);
} else {
return storageContainerChunkListBuilder_.getMessage(index);
}
}
/**
* <code>repeated .StorageContainerChunkList storage_container_chunk_list = 1;</code>
*/
public Builder setStorageContainerChunkList(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList value) {
if (storageContainerChunkListBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureStorageContainerChunkListIsMutable();
storageContainerChunkList_.set(index, value);
onChanged();
} else {
storageContainerChunkListBuilder_.setMessage(index, value);
}
return this;
}
/**
* <code>repeated .StorageContainerChunkList storage_container_chunk_list = 1;</code>
*/
public Builder setStorageContainerChunkList(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList.Builder builderForValue) {
if (storageContainerChunkListBuilder_ == null) {
ensureStorageContainerChunkListIsMutable();
storageContainerChunkList_.set(index, builderForValue.build());
onChanged();
} else {
storageContainerChunkListBuilder_.setMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .StorageContainerChunkList storage_container_chunk_list = 1;</code>
*/
public Builder addStorageContainerChunkList(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList value) {
if (storageContainerChunkListBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureStorageContainerChunkListIsMutable();
storageContainerChunkList_.add(value);
onChanged();
} else {
storageContainerChunkListBuilder_.addMessage(value);
}
return this;
}
/**
* <code>repeated .StorageContainerChunkList storage_container_chunk_list = 1;</code>
*/
public Builder addStorageContainerChunkList(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList value) {
if (storageContainerChunkListBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureStorageContainerChunkListIsMutable();
storageContainerChunkList_.add(index, value);
onChanged();
} else {
storageContainerChunkListBuilder_.addMessage(index, value);
}
return this;
}
/**
* <code>repeated .StorageContainerChunkList storage_container_chunk_list = 1;</code>
*/
public Builder addStorageContainerChunkList(
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList.Builder builderForValue) {
if (storageContainerChunkListBuilder_ == null) {
ensureStorageContainerChunkListIsMutable();
storageContainerChunkList_.add(builderForValue.build());
onChanged();
} else {
storageContainerChunkListBuilder_.addMessage(builderForValue.build());
}
return this;
}
/**
* <code>repeated .StorageContainerChunkList storage_container_chunk_list = 1;</code>
*/
public Builder addStorageContainerChunkList(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList.Builder builderForValue) {
if (storageContainerChunkListBuilder_ == null) {
ensureStorageContainerChunkListIsMutable();
storageContainerChunkList_.add(index, builderForValue.build());
onChanged();
} else {
storageContainerChunkListBuilder_.addMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .StorageContainerChunkList storage_container_chunk_list = 1;</code>
*/
public Builder addAllStorageContainerChunkList(
java.lang.Iterable<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList> values) {
if (storageContainerChunkListBuilder_ == null) {
ensureStorageContainerChunkListIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, storageContainerChunkList_);
onChanged();
} else {
storageContainerChunkListBuilder_.addAllMessages(values);
}
return this;
}
/**
* <code>repeated .StorageContainerChunkList storage_container_chunk_list = 1;</code>
*/
public Builder clearStorageContainerChunkList() {
if (storageContainerChunkListBuilder_ == null) {
storageContainerChunkList_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
onChanged();
} else {
storageContainerChunkListBuilder_.clear();
}
return this;
}
/**
* <code>repeated .StorageContainerChunkList storage_container_chunk_list = 1;</code>
*/
public Builder removeStorageContainerChunkList(int index) {
if (storageContainerChunkListBuilder_ == null) {
ensureStorageContainerChunkListIsMutable();
storageContainerChunkList_.remove(index);
onChanged();
} else {
storageContainerChunkListBuilder_.remove(index);
}
return this;
}
/**
* <code>repeated .StorageContainerChunkList storage_container_chunk_list = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList.Builder getStorageContainerChunkListBuilder(
int index) {
return getStorageContainerChunkListFieldBuilder().getBuilder(index);
}
/**
* <code>repeated .StorageContainerChunkList storage_container_chunk_list = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkListOrBuilder getStorageContainerChunkListOrBuilder(
int index) {
if (storageContainerChunkListBuilder_ == null) {
return storageContainerChunkList_.get(index); } else {
return storageContainerChunkListBuilder_.getMessageOrBuilder(index);
}
}
/**
* <code>repeated .StorageContainerChunkList storage_container_chunk_list = 1;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkListOrBuilder>
getStorageContainerChunkListOrBuilderList() {
if (storageContainerChunkListBuilder_ != null) {
return storageContainerChunkListBuilder_.getMessageOrBuilderList();
} else {
return java.util.Collections.unmodifiableList(storageContainerChunkList_);
}
}
/**
* <code>repeated .StorageContainerChunkList storage_container_chunk_list = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList.Builder addStorageContainerChunkListBuilder() {
return getStorageContainerChunkListFieldBuilder().addBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList.getDefaultInstance());
}
/**
* <code>repeated .StorageContainerChunkList storage_container_chunk_list = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList.Builder addStorageContainerChunkListBuilder(
int index) {
return getStorageContainerChunkListFieldBuilder().addBuilder(index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList.getDefaultInstance());
}
/**
* <code>repeated .StorageContainerChunkList storage_container_chunk_list = 1;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList.Builder>
getStorageContainerChunkListBuilderList() {
return getStorageContainerChunkListFieldBuilder().getBuilderList();
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkListOrBuilder>
getStorageContainerChunkListFieldBuilder() {
if (storageContainerChunkListBuilder_ == null) {
storageContainerChunkListBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkList.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerChunkListOrBuilder>(
storageContainerChunkList_,
((bitField0_ & 0x00000001) == 0x00000001),
getParentForChildren(),
isClean());
storageContainerChunkList_ = null;
}
return storageContainerChunkListBuilder_;
}
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError> fileError_ =
java.util.Collections.emptyList();
private void ensureFileErrorIsMutable() {
if (!((bitField0_ & 0x00000002) == 0x00000002)) {
fileError_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError>(fileError_);
bitField0_ |= 0x00000002;
}
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileErrorOrBuilder> fileErrorBuilder_;
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError> getFileErrorList() {
if (fileErrorBuilder_ == null) {
return java.util.Collections.unmodifiableList(fileError_);
} else {
return fileErrorBuilder_.getMessageList();
}
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public int getFileErrorCount() {
if (fileErrorBuilder_ == null) {
return fileError_.size();
} else {
return fileErrorBuilder_.getCount();
}
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError getFileError(int index) {
if (fileErrorBuilder_ == null) {
return fileError_.get(index);
} else {
return fileErrorBuilder_.getMessage(index);
}
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public Builder setFileError(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError value) {
if (fileErrorBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureFileErrorIsMutable();
fileError_.set(index, value);
onChanged();
} else {
fileErrorBuilder_.setMessage(index, value);
}
return this;
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public Builder setFileError(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError.Builder builderForValue) {
if (fileErrorBuilder_ == null) {
ensureFileErrorIsMutable();
fileError_.set(index, builderForValue.build());
onChanged();
} else {
fileErrorBuilder_.setMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public Builder addFileError(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError value) {
if (fileErrorBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureFileErrorIsMutable();
fileError_.add(value);
onChanged();
} else {
fileErrorBuilder_.addMessage(value);
}
return this;
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public Builder addFileError(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError value) {
if (fileErrorBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureFileErrorIsMutable();
fileError_.add(index, value);
onChanged();
} else {
fileErrorBuilder_.addMessage(index, value);
}
return this;
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public Builder addFileError(
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError.Builder builderForValue) {
if (fileErrorBuilder_ == null) {
ensureFileErrorIsMutable();
fileError_.add(builderForValue.build());
onChanged();
} else {
fileErrorBuilder_.addMessage(builderForValue.build());
}
return this;
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public Builder addFileError(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError.Builder builderForValue) {
if (fileErrorBuilder_ == null) {
ensureFileErrorIsMutable();
fileError_.add(index, builderForValue.build());
onChanged();
} else {
fileErrorBuilder_.addMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public Builder addAllFileError(
java.lang.Iterable<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError> values) {
if (fileErrorBuilder_ == null) {
ensureFileErrorIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, fileError_);
onChanged();
} else {
fileErrorBuilder_.addAllMessages(values);
}
return this;
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public Builder clearFileError() {
if (fileErrorBuilder_ == null) {
fileError_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000002);
onChanged();
} else {
fileErrorBuilder_.clear();
}
return this;
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public Builder removeFileError(int index) {
if (fileErrorBuilder_ == null) {
ensureFileErrorIsMutable();
fileError_.remove(index);
onChanged();
} else {
fileErrorBuilder_.remove(index);
}
return this;
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError.Builder getFileErrorBuilder(
int index) {
return getFileErrorFieldBuilder().getBuilder(index);
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileErrorOrBuilder getFileErrorOrBuilder(
int index) {
if (fileErrorBuilder_ == null) {
return fileError_.get(index); } else {
return fileErrorBuilder_.getMessageOrBuilder(index);
}
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileErrorOrBuilder>
getFileErrorOrBuilderList() {
if (fileErrorBuilder_ != null) {
return fileErrorBuilder_.getMessageOrBuilderList();
} else {
return java.util.Collections.unmodifiableList(fileError_);
}
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError.Builder addFileErrorBuilder() {
return getFileErrorFieldBuilder().addBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError.getDefaultInstance());
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError.Builder addFileErrorBuilder(
int index) {
return getFileErrorFieldBuilder().addBuilder(index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError.getDefaultInstance());
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError.Builder>
getFileErrorBuilderList() {
return getFileErrorFieldBuilder().getBuilderList();
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileErrorOrBuilder>
getFileErrorFieldBuilder() {
if (fileErrorBuilder_ == null) {
fileErrorBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileErrorOrBuilder>(
fileError_,
((bitField0_ & 0x00000002) == 0x00000002),
getParentForChildren(),
isClean());
fileError_ = null;
}
return fileErrorBuilder_;
}
private int verbosityLevel_ ;
/**
* <code>optional uint32 verbosity_level = 3;</code>
*/
public boolean hasVerbosityLevel() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>optional uint32 verbosity_level = 3;</code>
*/
public int getVerbosityLevel() {
return verbosityLevel_;
}
/**
* <code>optional uint32 verbosity_level = 3;</code>
*/
public Builder setVerbosityLevel(int value) {
bitField0_ |= 0x00000004;
verbosityLevel_ = value;
onChanged();
return this;
}
/**
* <code>optional uint32 verbosity_level = 3;</code>
*/
public Builder clearVerbosityLevel() {
bitField0_ = (bitField0_ & ~0x00000004);
verbosityLevel_ = 0;
onChanged();
return this;
}
// @@protoc_insertion_point(builder_scope:StorageContainerChunkLists)
}
static {
defaultInstance = new StorageContainerChunkLists(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:StorageContainerChunkLists)
}
public interface StorageContainerErrorListOrBuilder extends
// @@protoc_insertion_point(interface_extends:StorageContainerErrorList)
com.google.protobuf.MessageOrBuilder {
/**
* <code>repeated .StorageContainerError storage_container_error = 1;</code>
*/
java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError>
getStorageContainerErrorList();
/**
* <code>repeated .StorageContainerError storage_container_error = 1;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError getStorageContainerError(int index);
/**
* <code>repeated .StorageContainerError storage_container_error = 1;</code>
*/
int getStorageContainerErrorCount();
/**
* <code>repeated .StorageContainerError storage_container_error = 1;</code>
*/
java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerErrorOrBuilder>
getStorageContainerErrorOrBuilderList();
/**
* <code>repeated .StorageContainerError storage_container_error = 1;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerErrorOrBuilder getStorageContainerErrorOrBuilder(
int index);
}
/**
* Protobuf type {@code StorageContainerErrorList}
*/
public static final class StorageContainerErrorList extends
com.google.protobuf.GeneratedMessage implements
// @@protoc_insertion_point(message_implements:StorageContainerErrorList)
StorageContainerErrorListOrBuilder {
// Use StorageContainerErrorList.newBuilder() to construct.
private StorageContainerErrorList(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private StorageContainerErrorList(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final StorageContainerErrorList defaultInstance;
public static StorageContainerErrorList getDefaultInstance() {
return defaultInstance;
}
public StorageContainerErrorList getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private StorageContainerErrorList(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
storageContainerError_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError>();
mutable_bitField0_ |= 0x00000001;
}
storageContainerError_.add(input.readMessage(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError.PARSER, extensionRegistry));
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
storageContainerError_ = java.util.Collections.unmodifiableList(storageContainerError_);
}
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_StorageContainerErrorList_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_StorageContainerErrorList_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerErrorList.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerErrorList.Builder.class);
}
public static com.google.protobuf.Parser<StorageContainerErrorList> PARSER =
new com.google.protobuf.AbstractParser<StorageContainerErrorList>() {
public StorageContainerErrorList parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new StorageContainerErrorList(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<StorageContainerErrorList> getParserForType() {
return PARSER;
}
public static final int STORAGE_CONTAINER_ERROR_FIELD_NUMBER = 1;
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError> storageContainerError_;
/**
* <code>repeated .StorageContainerError storage_container_error = 1;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError> getStorageContainerErrorList() {
return storageContainerError_;
}
/**
* <code>repeated .StorageContainerError storage_container_error = 1;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerErrorOrBuilder>
getStorageContainerErrorOrBuilderList() {
return storageContainerError_;
}
/**
* <code>repeated .StorageContainerError storage_container_error = 1;</code>
*/
public int getStorageContainerErrorCount() {
return storageContainerError_.size();
}
/**
* <code>repeated .StorageContainerError storage_container_error = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError getStorageContainerError(int index) {
return storageContainerError_.get(index);
}
/**
* <code>repeated .StorageContainerError storage_container_error = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerErrorOrBuilder getStorageContainerErrorOrBuilder(
int index) {
return storageContainerError_.get(index);
}
private void initFields() {
storageContainerError_ = java.util.Collections.emptyList();
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
for (int i = 0; i < getStorageContainerErrorCount(); i++) {
if (!getStorageContainerError(i).isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
for (int i = 0; i < storageContainerError_.size(); i++) {
output.writeMessage(1, storageContainerError_.get(i));
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
for (int i = 0; i < storageContainerError_.size(); i++) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(1, storageContainerError_.get(i));
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerErrorList parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerErrorList parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerErrorList parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerErrorList parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerErrorList parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerErrorList parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerErrorList parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerErrorList parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerErrorList parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerErrorList parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerErrorList prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code StorageContainerErrorList}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:StorageContainerErrorList)
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerErrorListOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_StorageContainerErrorList_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_StorageContainerErrorList_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerErrorList.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerErrorList.Builder.class);
}
// Construct using com.github.horrorho.inflatabledonkey.protocol.ChunkServer.StorageContainerErrorList.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
getStorageContainerErrorFieldBuilder();
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
if (storageContainerErrorBuilder_ == null) {
storageContainerError_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
} else {
storageContainerErrorBuilder_.clear();
}
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_StorageContainerErrorList_descriptor;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerErrorList getDefaultInstanceForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerErrorList.getDefaultInstance();
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerErrorList build() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerErrorList result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerErrorList buildPartial() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerErrorList result = new com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerErrorList(this);
int from_bitField0_ = bitField0_;
if (storageContainerErrorBuilder_ == null) {
if (((bitField0_ & 0x00000001) == 0x00000001)) {
storageContainerError_ = java.util.Collections.unmodifiableList(storageContainerError_);
bitField0_ = (bitField0_ & ~0x00000001);
}
result.storageContainerError_ = storageContainerError_;
} else {
result.storageContainerError_ = storageContainerErrorBuilder_.build();
}
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerErrorList) {
return mergeFrom((com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerErrorList)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerErrorList other) {
if (other == com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerErrorList.getDefaultInstance()) return this;
if (storageContainerErrorBuilder_ == null) {
if (!other.storageContainerError_.isEmpty()) {
if (storageContainerError_.isEmpty()) {
storageContainerError_ = other.storageContainerError_;
bitField0_ = (bitField0_ & ~0x00000001);
} else {
ensureStorageContainerErrorIsMutable();
storageContainerError_.addAll(other.storageContainerError_);
}
onChanged();
}
} else {
if (!other.storageContainerError_.isEmpty()) {
if (storageContainerErrorBuilder_.isEmpty()) {
storageContainerErrorBuilder_.dispose();
storageContainerErrorBuilder_ = null;
storageContainerError_ = other.storageContainerError_;
bitField0_ = (bitField0_ & ~0x00000001);
storageContainerErrorBuilder_ =
com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
getStorageContainerErrorFieldBuilder() : null;
} else {
storageContainerErrorBuilder_.addAllMessages(other.storageContainerError_);
}
}
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
for (int i = 0; i < getStorageContainerErrorCount(); i++) {
if (!getStorageContainerError(i).isInitialized()) {
return false;
}
}
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerErrorList parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerErrorList) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError> storageContainerError_ =
java.util.Collections.emptyList();
private void ensureStorageContainerErrorIsMutable() {
if (!((bitField0_ & 0x00000001) == 0x00000001)) {
storageContainerError_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError>(storageContainerError_);
bitField0_ |= 0x00000001;
}
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerErrorOrBuilder> storageContainerErrorBuilder_;
/**
* <code>repeated .StorageContainerError storage_container_error = 1;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError> getStorageContainerErrorList() {
if (storageContainerErrorBuilder_ == null) {
return java.util.Collections.unmodifiableList(storageContainerError_);
} else {
return storageContainerErrorBuilder_.getMessageList();
}
}
/**
* <code>repeated .StorageContainerError storage_container_error = 1;</code>
*/
public int getStorageContainerErrorCount() {
if (storageContainerErrorBuilder_ == null) {
return storageContainerError_.size();
} else {
return storageContainerErrorBuilder_.getCount();
}
}
/**
* <code>repeated .StorageContainerError storage_container_error = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError getStorageContainerError(int index) {
if (storageContainerErrorBuilder_ == null) {
return storageContainerError_.get(index);
} else {
return storageContainerErrorBuilder_.getMessage(index);
}
}
/**
* <code>repeated .StorageContainerError storage_container_error = 1;</code>
*/
public Builder setStorageContainerError(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError value) {
if (storageContainerErrorBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureStorageContainerErrorIsMutable();
storageContainerError_.set(index, value);
onChanged();
} else {
storageContainerErrorBuilder_.setMessage(index, value);
}
return this;
}
/**
* <code>repeated .StorageContainerError storage_container_error = 1;</code>
*/
public Builder setStorageContainerError(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError.Builder builderForValue) {
if (storageContainerErrorBuilder_ == null) {
ensureStorageContainerErrorIsMutable();
storageContainerError_.set(index, builderForValue.build());
onChanged();
} else {
storageContainerErrorBuilder_.setMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .StorageContainerError storage_container_error = 1;</code>
*/
public Builder addStorageContainerError(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError value) {
if (storageContainerErrorBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureStorageContainerErrorIsMutable();
storageContainerError_.add(value);
onChanged();
} else {
storageContainerErrorBuilder_.addMessage(value);
}
return this;
}
/**
* <code>repeated .StorageContainerError storage_container_error = 1;</code>
*/
public Builder addStorageContainerError(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError value) {
if (storageContainerErrorBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureStorageContainerErrorIsMutable();
storageContainerError_.add(index, value);
onChanged();
} else {
storageContainerErrorBuilder_.addMessage(index, value);
}
return this;
}
/**
* <code>repeated .StorageContainerError storage_container_error = 1;</code>
*/
public Builder addStorageContainerError(
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError.Builder builderForValue) {
if (storageContainerErrorBuilder_ == null) {
ensureStorageContainerErrorIsMutable();
storageContainerError_.add(builderForValue.build());
onChanged();
} else {
storageContainerErrorBuilder_.addMessage(builderForValue.build());
}
return this;
}
/**
* <code>repeated .StorageContainerError storage_container_error = 1;</code>
*/
public Builder addStorageContainerError(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError.Builder builderForValue) {
if (storageContainerErrorBuilder_ == null) {
ensureStorageContainerErrorIsMutable();
storageContainerError_.add(index, builderForValue.build());
onChanged();
} else {
storageContainerErrorBuilder_.addMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .StorageContainerError storage_container_error = 1;</code>
*/
public Builder addAllStorageContainerError(
java.lang.Iterable<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError> values) {
if (storageContainerErrorBuilder_ == null) {
ensureStorageContainerErrorIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, storageContainerError_);
onChanged();
} else {
storageContainerErrorBuilder_.addAllMessages(values);
}
return this;
}
/**
* <code>repeated .StorageContainerError storage_container_error = 1;</code>
*/
public Builder clearStorageContainerError() {
if (storageContainerErrorBuilder_ == null) {
storageContainerError_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
onChanged();
} else {
storageContainerErrorBuilder_.clear();
}
return this;
}
/**
* <code>repeated .StorageContainerError storage_container_error = 1;</code>
*/
public Builder removeStorageContainerError(int index) {
if (storageContainerErrorBuilder_ == null) {
ensureStorageContainerErrorIsMutable();
storageContainerError_.remove(index);
onChanged();
} else {
storageContainerErrorBuilder_.remove(index);
}
return this;
}
/**
* <code>repeated .StorageContainerError storage_container_error = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError.Builder getStorageContainerErrorBuilder(
int index) {
return getStorageContainerErrorFieldBuilder().getBuilder(index);
}
/**
* <code>repeated .StorageContainerError storage_container_error = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerErrorOrBuilder getStorageContainerErrorOrBuilder(
int index) {
if (storageContainerErrorBuilder_ == null) {
return storageContainerError_.get(index); } else {
return storageContainerErrorBuilder_.getMessageOrBuilder(index);
}
}
/**
* <code>repeated .StorageContainerError storage_container_error = 1;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerErrorOrBuilder>
getStorageContainerErrorOrBuilderList() {
if (storageContainerErrorBuilder_ != null) {
return storageContainerErrorBuilder_.getMessageOrBuilderList();
} else {
return java.util.Collections.unmodifiableList(storageContainerError_);
}
}
/**
* <code>repeated .StorageContainerError storage_container_error = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError.Builder addStorageContainerErrorBuilder() {
return getStorageContainerErrorFieldBuilder().addBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError.getDefaultInstance());
}
/**
* <code>repeated .StorageContainerError storage_container_error = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError.Builder addStorageContainerErrorBuilder(
int index) {
return getStorageContainerErrorFieldBuilder().addBuilder(index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError.getDefaultInstance());
}
/**
* <code>repeated .StorageContainerError storage_container_error = 1;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError.Builder>
getStorageContainerErrorBuilderList() {
return getStorageContainerErrorFieldBuilder().getBuilderList();
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerErrorOrBuilder>
getStorageContainerErrorFieldBuilder() {
if (storageContainerErrorBuilder_ == null) {
storageContainerErrorBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerError.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageContainerErrorOrBuilder>(
storageContainerError_,
((bitField0_ & 0x00000001) == 0x00000001),
getParentForChildren(),
isClean());
storageContainerError_ = null;
}
return storageContainerErrorBuilder_;
}
// @@protoc_insertion_point(builder_scope:StorageContainerErrorList)
}
static {
defaultInstance = new StorageContainerErrorList(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:StorageContainerErrorList)
}
public interface FileChecksumAuthorizationOrBuilder extends
// @@protoc_insertion_point(interface_extends:FileChecksumAuthorization)
com.google.protobuf.MessageOrBuilder {
/**
* <code>required bytes file_checksum = 1;</code>
*/
boolean hasFileChecksum();
/**
* <code>required bytes file_checksum = 1;</code>
*/
com.google.protobuf.ByteString getFileChecksum();
/**
* <code>required string authorization = 2;</code>
*/
boolean hasAuthorization();
/**
* <code>required string authorization = 2;</code>
*/
java.lang.String getAuthorization();
/**
* <code>required string authorization = 2;</code>
*/
com.google.protobuf.ByteString
getAuthorizationBytes();
/**
* <code>repeated bytes chunk_checksums = 3;</code>
*/
java.util.List<com.google.protobuf.ByteString> getChunkChecksumsList();
/**
* <code>repeated bytes chunk_checksums = 3;</code>
*/
int getChunkChecksumsCount();
/**
* <code>repeated bytes chunk_checksums = 3;</code>
*/
com.google.protobuf.ByteString getChunkChecksums(int index);
}
/**
* Protobuf type {@code FileChecksumAuthorization}
*/
public static final class FileChecksumAuthorization extends
com.google.protobuf.GeneratedMessage implements
// @@protoc_insertion_point(message_implements:FileChecksumAuthorization)
FileChecksumAuthorizationOrBuilder {
// Use FileChecksumAuthorization.newBuilder() to construct.
private FileChecksumAuthorization(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private FileChecksumAuthorization(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final FileChecksumAuthorization defaultInstance;
public static FileChecksumAuthorization getDefaultInstance() {
return defaultInstance;
}
public FileChecksumAuthorization getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private FileChecksumAuthorization(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
bitField0_ |= 0x00000001;
fileChecksum_ = input.readBytes();
break;
}
case 18: {
com.google.protobuf.ByteString bs = input.readBytes();
bitField0_ |= 0x00000002;
authorization_ = bs;
break;
}
case 26: {
if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) {
chunkChecksums_ = new java.util.ArrayList<com.google.protobuf.ByteString>();
mutable_bitField0_ |= 0x00000004;
}
chunkChecksums_.add(input.readBytes());
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) {
chunkChecksums_ = java.util.Collections.unmodifiableList(chunkChecksums_);
}
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileChecksumAuthorization_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileChecksumAuthorization_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization.Builder.class);
}
public static com.google.protobuf.Parser<FileChecksumAuthorization> PARSER =
new com.google.protobuf.AbstractParser<FileChecksumAuthorization>() {
public FileChecksumAuthorization parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new FileChecksumAuthorization(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<FileChecksumAuthorization> getParserForType() {
return PARSER;
}
private int bitField0_;
public static final int FILE_CHECKSUM_FIELD_NUMBER = 1;
private com.google.protobuf.ByteString fileChecksum_;
/**
* <code>required bytes file_checksum = 1;</code>
*/
public boolean hasFileChecksum() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required bytes file_checksum = 1;</code>
*/
public com.google.protobuf.ByteString getFileChecksum() {
return fileChecksum_;
}
public static final int AUTHORIZATION_FIELD_NUMBER = 2;
private java.lang.Object authorization_;
/**
* <code>required string authorization = 2;</code>
*/
public boolean hasAuthorization() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required string authorization = 2;</code>
*/
public java.lang.String getAuthorization() {
java.lang.Object ref = authorization_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
authorization_ = s;
}
return s;
}
}
/**
* <code>required string authorization = 2;</code>
*/
public com.google.protobuf.ByteString
getAuthorizationBytes() {
java.lang.Object ref = authorization_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
authorization_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int CHUNK_CHECKSUMS_FIELD_NUMBER = 3;
private java.util.List<com.google.protobuf.ByteString> chunkChecksums_;
/**
* <code>repeated bytes chunk_checksums = 3;</code>
*/
public java.util.List<com.google.protobuf.ByteString>
getChunkChecksumsList() {
return chunkChecksums_;
}
/**
* <code>repeated bytes chunk_checksums = 3;</code>
*/
public int getChunkChecksumsCount() {
return chunkChecksums_.size();
}
/**
* <code>repeated bytes chunk_checksums = 3;</code>
*/
public com.google.protobuf.ByteString getChunkChecksums(int index) {
return chunkChecksums_.get(index);
}
private void initFields() {
fileChecksum_ = com.google.protobuf.ByteString.EMPTY;
authorization_ = "";
chunkChecksums_ = java.util.Collections.emptyList();
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
if (!hasFileChecksum()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasAuthorization()) {
memoizedIsInitialized = 0;
return false;
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeBytes(1, fileChecksum_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeBytes(2, getAuthorizationBytes());
}
for (int i = 0; i < chunkChecksums_.size(); i++) {
output.writeBytes(3, chunkChecksums_.get(i));
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(1, fileChecksum_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(2, getAuthorizationBytes());
}
{
int dataSize = 0;
for (int i = 0; i < chunkChecksums_.size(); i++) {
dataSize += com.google.protobuf.CodedOutputStream
.computeBytesSizeNoTag(chunkChecksums_.get(i));
}
size += dataSize;
size += 1 * getChunkChecksumsList().size();
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code FileChecksumAuthorization}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:FileChecksumAuthorization)
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorizationOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileChecksumAuthorization_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileChecksumAuthorization_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization.Builder.class);
}
// Construct using com.github.horrorho.inflatabledonkey.protocol.ChunkServer.FileChecksumAuthorization.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
fileChecksum_ = com.google.protobuf.ByteString.EMPTY;
bitField0_ = (bitField0_ & ~0x00000001);
authorization_ = "";
bitField0_ = (bitField0_ & ~0x00000002);
chunkChecksums_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000004);
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileChecksumAuthorization_descriptor;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization getDefaultInstanceForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization.getDefaultInstance();
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization build() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization buildPartial() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization result = new com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
result.fileChecksum_ = fileChecksum_;
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002;
}
result.authorization_ = authorization_;
if (((bitField0_ & 0x00000004) == 0x00000004)) {
chunkChecksums_ = java.util.Collections.unmodifiableList(chunkChecksums_);
bitField0_ = (bitField0_ & ~0x00000004);
}
result.chunkChecksums_ = chunkChecksums_;
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization) {
return mergeFrom((com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization other) {
if (other == com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization.getDefaultInstance()) return this;
if (other.hasFileChecksum()) {
setFileChecksum(other.getFileChecksum());
}
if (other.hasAuthorization()) {
bitField0_ |= 0x00000002;
authorization_ = other.authorization_;
onChanged();
}
if (!other.chunkChecksums_.isEmpty()) {
if (chunkChecksums_.isEmpty()) {
chunkChecksums_ = other.chunkChecksums_;
bitField0_ = (bitField0_ & ~0x00000004);
} else {
ensureChunkChecksumsIsMutable();
chunkChecksums_.addAll(other.chunkChecksums_);
}
onChanged();
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
if (!hasFileChecksum()) {
return false;
}
if (!hasAuthorization()) {
return false;
}
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private com.google.protobuf.ByteString fileChecksum_ = com.google.protobuf.ByteString.EMPTY;
/**
* <code>required bytes file_checksum = 1;</code>
*/
public boolean hasFileChecksum() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required bytes file_checksum = 1;</code>
*/
public com.google.protobuf.ByteString getFileChecksum() {
return fileChecksum_;
}
/**
* <code>required bytes file_checksum = 1;</code>
*/
public Builder setFileChecksum(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
fileChecksum_ = value;
onChanged();
return this;
}
/**
* <code>required bytes file_checksum = 1;</code>
*/
public Builder clearFileChecksum() {
bitField0_ = (bitField0_ & ~0x00000001);
fileChecksum_ = getDefaultInstance().getFileChecksum();
onChanged();
return this;
}
private java.lang.Object authorization_ = "";
/**
* <code>required string authorization = 2;</code>
*/
public boolean hasAuthorization() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required string authorization = 2;</code>
*/
public java.lang.String getAuthorization() {
java.lang.Object ref = authorization_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
authorization_ = s;
}
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>required string authorization = 2;</code>
*/
public com.google.protobuf.ByteString
getAuthorizationBytes() {
java.lang.Object ref = authorization_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
authorization_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>required string authorization = 2;</code>
*/
public Builder setAuthorization(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000002;
authorization_ = value;
onChanged();
return this;
}
/**
* <code>required string authorization = 2;</code>
*/
public Builder clearAuthorization() {
bitField0_ = (bitField0_ & ~0x00000002);
authorization_ = getDefaultInstance().getAuthorization();
onChanged();
return this;
}
/**
* <code>required string authorization = 2;</code>
*/
public Builder setAuthorizationBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000002;
authorization_ = value;
onChanged();
return this;
}
private java.util.List<com.google.protobuf.ByteString> chunkChecksums_ = java.util.Collections.emptyList();
private void ensureChunkChecksumsIsMutable() {
if (!((bitField0_ & 0x00000004) == 0x00000004)) {
chunkChecksums_ = new java.util.ArrayList<com.google.protobuf.ByteString>(chunkChecksums_);
bitField0_ |= 0x00000004;
}
}
/**
* <code>repeated bytes chunk_checksums = 3;</code>
*/
public java.util.List<com.google.protobuf.ByteString>
getChunkChecksumsList() {
return java.util.Collections.unmodifiableList(chunkChecksums_);
}
/**
* <code>repeated bytes chunk_checksums = 3;</code>
*/
public int getChunkChecksumsCount() {
return chunkChecksums_.size();
}
/**
* <code>repeated bytes chunk_checksums = 3;</code>
*/
public com.google.protobuf.ByteString getChunkChecksums(int index) {
return chunkChecksums_.get(index);
}
/**
* <code>repeated bytes chunk_checksums = 3;</code>
*/
public Builder setChunkChecksums(
int index, com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
ensureChunkChecksumsIsMutable();
chunkChecksums_.set(index, value);
onChanged();
return this;
}
/**
* <code>repeated bytes chunk_checksums = 3;</code>
*/
public Builder addChunkChecksums(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
ensureChunkChecksumsIsMutable();
chunkChecksums_.add(value);
onChanged();
return this;
}
/**
* <code>repeated bytes chunk_checksums = 3;</code>
*/
public Builder addAllChunkChecksums(
java.lang.Iterable<? extends com.google.protobuf.ByteString> values) {
ensureChunkChecksumsIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, chunkChecksums_);
onChanged();
return this;
}
/**
* <code>repeated bytes chunk_checksums = 3;</code>
*/
public Builder clearChunkChecksums() {
chunkChecksums_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000004);
onChanged();
return this;
}
// @@protoc_insertion_point(builder_scope:FileChecksumAuthorization)
}
static {
defaultInstance = new FileChecksumAuthorization(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:FileChecksumAuthorization)
}
public interface FileChecksumAuthorizationListOrBuilder extends
// @@protoc_insertion_point(interface_extends:FileChecksumAuthorizationList)
com.google.protobuf.MessageOrBuilder {
/**
* <code>repeated .FileChecksumAuthorization file_checksum_authorization = 1;</code>
*/
java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization>
getFileChecksumAuthorizationList();
/**
* <code>repeated .FileChecksumAuthorization file_checksum_authorization = 1;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization getFileChecksumAuthorization(int index);
/**
* <code>repeated .FileChecksumAuthorization file_checksum_authorization = 1;</code>
*/
int getFileChecksumAuthorizationCount();
/**
* <code>repeated .FileChecksumAuthorization file_checksum_authorization = 1;</code>
*/
java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorizationOrBuilder>
getFileChecksumAuthorizationOrBuilderList();
/**
* <code>repeated .FileChecksumAuthorization file_checksum_authorization = 1;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorizationOrBuilder getFileChecksumAuthorizationOrBuilder(
int index);
}
/**
* Protobuf type {@code FileChecksumAuthorizationList}
*/
public static final class FileChecksumAuthorizationList extends
com.google.protobuf.GeneratedMessage implements
// @@protoc_insertion_point(message_implements:FileChecksumAuthorizationList)
FileChecksumAuthorizationListOrBuilder {
// Use FileChecksumAuthorizationList.newBuilder() to construct.
private FileChecksumAuthorizationList(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private FileChecksumAuthorizationList(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final FileChecksumAuthorizationList defaultInstance;
public static FileChecksumAuthorizationList getDefaultInstance() {
return defaultInstance;
}
public FileChecksumAuthorizationList getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private FileChecksumAuthorizationList(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
fileChecksumAuthorization_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization>();
mutable_bitField0_ |= 0x00000001;
}
fileChecksumAuthorization_.add(input.readMessage(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization.PARSER, extensionRegistry));
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
fileChecksumAuthorization_ = java.util.Collections.unmodifiableList(fileChecksumAuthorization_);
}
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileChecksumAuthorizationList_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileChecksumAuthorizationList_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorizationList.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorizationList.Builder.class);
}
public static com.google.protobuf.Parser<FileChecksumAuthorizationList> PARSER =
new com.google.protobuf.AbstractParser<FileChecksumAuthorizationList>() {
public FileChecksumAuthorizationList parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new FileChecksumAuthorizationList(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<FileChecksumAuthorizationList> getParserForType() {
return PARSER;
}
public static final int FILE_CHECKSUM_AUTHORIZATION_FIELD_NUMBER = 1;
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization> fileChecksumAuthorization_;
/**
* <code>repeated .FileChecksumAuthorization file_checksum_authorization = 1;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization> getFileChecksumAuthorizationList() {
return fileChecksumAuthorization_;
}
/**
* <code>repeated .FileChecksumAuthorization file_checksum_authorization = 1;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorizationOrBuilder>
getFileChecksumAuthorizationOrBuilderList() {
return fileChecksumAuthorization_;
}
/**
* <code>repeated .FileChecksumAuthorization file_checksum_authorization = 1;</code>
*/
public int getFileChecksumAuthorizationCount() {
return fileChecksumAuthorization_.size();
}
/**
* <code>repeated .FileChecksumAuthorization file_checksum_authorization = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization getFileChecksumAuthorization(int index) {
return fileChecksumAuthorization_.get(index);
}
/**
* <code>repeated .FileChecksumAuthorization file_checksum_authorization = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorizationOrBuilder getFileChecksumAuthorizationOrBuilder(
int index) {
return fileChecksumAuthorization_.get(index);
}
private void initFields() {
fileChecksumAuthorization_ = java.util.Collections.emptyList();
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
for (int i = 0; i < getFileChecksumAuthorizationCount(); i++) {
if (!getFileChecksumAuthorization(i).isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
for (int i = 0; i < fileChecksumAuthorization_.size(); i++) {
output.writeMessage(1, fileChecksumAuthorization_.get(i));
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
for (int i = 0; i < fileChecksumAuthorization_.size(); i++) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(1, fileChecksumAuthorization_.get(i));
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorizationList parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorizationList parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorizationList parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorizationList parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorizationList parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorizationList parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorizationList parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorizationList parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorizationList parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorizationList parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorizationList prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code FileChecksumAuthorizationList}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:FileChecksumAuthorizationList)
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorizationListOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileChecksumAuthorizationList_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileChecksumAuthorizationList_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorizationList.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorizationList.Builder.class);
}
// Construct using com.github.horrorho.inflatabledonkey.protocol.ChunkServer.FileChecksumAuthorizationList.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
getFileChecksumAuthorizationFieldBuilder();
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
if (fileChecksumAuthorizationBuilder_ == null) {
fileChecksumAuthorization_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
} else {
fileChecksumAuthorizationBuilder_.clear();
}
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileChecksumAuthorizationList_descriptor;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorizationList getDefaultInstanceForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorizationList.getDefaultInstance();
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorizationList build() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorizationList result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorizationList buildPartial() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorizationList result = new com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorizationList(this);
int from_bitField0_ = bitField0_;
if (fileChecksumAuthorizationBuilder_ == null) {
if (((bitField0_ & 0x00000001) == 0x00000001)) {
fileChecksumAuthorization_ = java.util.Collections.unmodifiableList(fileChecksumAuthorization_);
bitField0_ = (bitField0_ & ~0x00000001);
}
result.fileChecksumAuthorization_ = fileChecksumAuthorization_;
} else {
result.fileChecksumAuthorization_ = fileChecksumAuthorizationBuilder_.build();
}
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorizationList) {
return mergeFrom((com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorizationList)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorizationList other) {
if (other == com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorizationList.getDefaultInstance()) return this;
if (fileChecksumAuthorizationBuilder_ == null) {
if (!other.fileChecksumAuthorization_.isEmpty()) {
if (fileChecksumAuthorization_.isEmpty()) {
fileChecksumAuthorization_ = other.fileChecksumAuthorization_;
bitField0_ = (bitField0_ & ~0x00000001);
} else {
ensureFileChecksumAuthorizationIsMutable();
fileChecksumAuthorization_.addAll(other.fileChecksumAuthorization_);
}
onChanged();
}
} else {
if (!other.fileChecksumAuthorization_.isEmpty()) {
if (fileChecksumAuthorizationBuilder_.isEmpty()) {
fileChecksumAuthorizationBuilder_.dispose();
fileChecksumAuthorizationBuilder_ = null;
fileChecksumAuthorization_ = other.fileChecksumAuthorization_;
bitField0_ = (bitField0_ & ~0x00000001);
fileChecksumAuthorizationBuilder_ =
com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
getFileChecksumAuthorizationFieldBuilder() : null;
} else {
fileChecksumAuthorizationBuilder_.addAllMessages(other.fileChecksumAuthorization_);
}
}
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
for (int i = 0; i < getFileChecksumAuthorizationCount(); i++) {
if (!getFileChecksumAuthorization(i).isInitialized()) {
return false;
}
}
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorizationList parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorizationList) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization> fileChecksumAuthorization_ =
java.util.Collections.emptyList();
private void ensureFileChecksumAuthorizationIsMutable() {
if (!((bitField0_ & 0x00000001) == 0x00000001)) {
fileChecksumAuthorization_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization>(fileChecksumAuthorization_);
bitField0_ |= 0x00000001;
}
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorizationOrBuilder> fileChecksumAuthorizationBuilder_;
/**
* <code>repeated .FileChecksumAuthorization file_checksum_authorization = 1;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization> getFileChecksumAuthorizationList() {
if (fileChecksumAuthorizationBuilder_ == null) {
return java.util.Collections.unmodifiableList(fileChecksumAuthorization_);
} else {
return fileChecksumAuthorizationBuilder_.getMessageList();
}
}
/**
* <code>repeated .FileChecksumAuthorization file_checksum_authorization = 1;</code>
*/
public int getFileChecksumAuthorizationCount() {
if (fileChecksumAuthorizationBuilder_ == null) {
return fileChecksumAuthorization_.size();
} else {
return fileChecksumAuthorizationBuilder_.getCount();
}
}
/**
* <code>repeated .FileChecksumAuthorization file_checksum_authorization = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization getFileChecksumAuthorization(int index) {
if (fileChecksumAuthorizationBuilder_ == null) {
return fileChecksumAuthorization_.get(index);
} else {
return fileChecksumAuthorizationBuilder_.getMessage(index);
}
}
/**
* <code>repeated .FileChecksumAuthorization file_checksum_authorization = 1;</code>
*/
public Builder setFileChecksumAuthorization(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization value) {
if (fileChecksumAuthorizationBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureFileChecksumAuthorizationIsMutable();
fileChecksumAuthorization_.set(index, value);
onChanged();
} else {
fileChecksumAuthorizationBuilder_.setMessage(index, value);
}
return this;
}
/**
* <code>repeated .FileChecksumAuthorization file_checksum_authorization = 1;</code>
*/
public Builder setFileChecksumAuthorization(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization.Builder builderForValue) {
if (fileChecksumAuthorizationBuilder_ == null) {
ensureFileChecksumAuthorizationIsMutable();
fileChecksumAuthorization_.set(index, builderForValue.build());
onChanged();
} else {
fileChecksumAuthorizationBuilder_.setMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .FileChecksumAuthorization file_checksum_authorization = 1;</code>
*/
public Builder addFileChecksumAuthorization(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization value) {
if (fileChecksumAuthorizationBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureFileChecksumAuthorizationIsMutable();
fileChecksumAuthorization_.add(value);
onChanged();
} else {
fileChecksumAuthorizationBuilder_.addMessage(value);
}
return this;
}
/**
* <code>repeated .FileChecksumAuthorization file_checksum_authorization = 1;</code>
*/
public Builder addFileChecksumAuthorization(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization value) {
if (fileChecksumAuthorizationBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureFileChecksumAuthorizationIsMutable();
fileChecksumAuthorization_.add(index, value);
onChanged();
} else {
fileChecksumAuthorizationBuilder_.addMessage(index, value);
}
return this;
}
/**
* <code>repeated .FileChecksumAuthorization file_checksum_authorization = 1;</code>
*/
public Builder addFileChecksumAuthorization(
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization.Builder builderForValue) {
if (fileChecksumAuthorizationBuilder_ == null) {
ensureFileChecksumAuthorizationIsMutable();
fileChecksumAuthorization_.add(builderForValue.build());
onChanged();
} else {
fileChecksumAuthorizationBuilder_.addMessage(builderForValue.build());
}
return this;
}
/**
* <code>repeated .FileChecksumAuthorization file_checksum_authorization = 1;</code>
*/
public Builder addFileChecksumAuthorization(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization.Builder builderForValue) {
if (fileChecksumAuthorizationBuilder_ == null) {
ensureFileChecksumAuthorizationIsMutable();
fileChecksumAuthorization_.add(index, builderForValue.build());
onChanged();
} else {
fileChecksumAuthorizationBuilder_.addMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .FileChecksumAuthorization file_checksum_authorization = 1;</code>
*/
public Builder addAllFileChecksumAuthorization(
java.lang.Iterable<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization> values) {
if (fileChecksumAuthorizationBuilder_ == null) {
ensureFileChecksumAuthorizationIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, fileChecksumAuthorization_);
onChanged();
} else {
fileChecksumAuthorizationBuilder_.addAllMessages(values);
}
return this;
}
/**
* <code>repeated .FileChecksumAuthorization file_checksum_authorization = 1;</code>
*/
public Builder clearFileChecksumAuthorization() {
if (fileChecksumAuthorizationBuilder_ == null) {
fileChecksumAuthorization_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
onChanged();
} else {
fileChecksumAuthorizationBuilder_.clear();
}
return this;
}
/**
* <code>repeated .FileChecksumAuthorization file_checksum_authorization = 1;</code>
*/
public Builder removeFileChecksumAuthorization(int index) {
if (fileChecksumAuthorizationBuilder_ == null) {
ensureFileChecksumAuthorizationIsMutable();
fileChecksumAuthorization_.remove(index);
onChanged();
} else {
fileChecksumAuthorizationBuilder_.remove(index);
}
return this;
}
/**
* <code>repeated .FileChecksumAuthorization file_checksum_authorization = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization.Builder getFileChecksumAuthorizationBuilder(
int index) {
return getFileChecksumAuthorizationFieldBuilder().getBuilder(index);
}
/**
* <code>repeated .FileChecksumAuthorization file_checksum_authorization = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorizationOrBuilder getFileChecksumAuthorizationOrBuilder(
int index) {
if (fileChecksumAuthorizationBuilder_ == null) {
return fileChecksumAuthorization_.get(index); } else {
return fileChecksumAuthorizationBuilder_.getMessageOrBuilder(index);
}
}
/**
* <code>repeated .FileChecksumAuthorization file_checksum_authorization = 1;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorizationOrBuilder>
getFileChecksumAuthorizationOrBuilderList() {
if (fileChecksumAuthorizationBuilder_ != null) {
return fileChecksumAuthorizationBuilder_.getMessageOrBuilderList();
} else {
return java.util.Collections.unmodifiableList(fileChecksumAuthorization_);
}
}
/**
* <code>repeated .FileChecksumAuthorization file_checksum_authorization = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization.Builder addFileChecksumAuthorizationBuilder() {
return getFileChecksumAuthorizationFieldBuilder().addBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization.getDefaultInstance());
}
/**
* <code>repeated .FileChecksumAuthorization file_checksum_authorization = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization.Builder addFileChecksumAuthorizationBuilder(
int index) {
return getFileChecksumAuthorizationFieldBuilder().addBuilder(index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization.getDefaultInstance());
}
/**
* <code>repeated .FileChecksumAuthorization file_checksum_authorization = 1;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization.Builder>
getFileChecksumAuthorizationBuilderList() {
return getFileChecksumAuthorizationFieldBuilder().getBuilderList();
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorizationOrBuilder>
getFileChecksumAuthorizationFieldBuilder() {
if (fileChecksumAuthorizationBuilder_ == null) {
fileChecksumAuthorizationBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorization.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumAuthorizationOrBuilder>(
fileChecksumAuthorization_,
((bitField0_ & 0x00000001) == 0x00000001),
getParentForChildren(),
isClean());
fileChecksumAuthorization_ = null;
}
return fileChecksumAuthorizationBuilder_;
}
// @@protoc_insertion_point(builder_scope:FileChecksumAuthorizationList)
}
static {
defaultInstance = new FileChecksumAuthorizationList(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:FileChecksumAuthorizationList)
}
public interface ChunkReferenceOrBuilder extends
// @@protoc_insertion_point(interface_extends:ChunkReference)
com.google.protobuf.MessageOrBuilder {
/**
* <code>required uint64 container_index = 1;</code>
*/
boolean hasContainerIndex();
/**
* <code>required uint64 container_index = 1;</code>
*/
long getContainerIndex();
/**
* <code>required uint64 chunk_index = 2;</code>
*/
boolean hasChunkIndex();
/**
* <code>required uint64 chunk_index = 2;</code>
*/
long getChunkIndex();
}
/**
* Protobuf type {@code ChunkReference}
*/
public static final class ChunkReference extends
com.google.protobuf.GeneratedMessage implements
// @@protoc_insertion_point(message_implements:ChunkReference)
ChunkReferenceOrBuilder {
// Use ChunkReference.newBuilder() to construct.
private ChunkReference(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private ChunkReference(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final ChunkReference defaultInstance;
public static ChunkReference getDefaultInstance() {
return defaultInstance;
}
public ChunkReference getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private ChunkReference(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 8: {
bitField0_ |= 0x00000001;
containerIndex_ = input.readUInt64();
break;
}
case 16: {
bitField0_ |= 0x00000002;
chunkIndex_ = input.readUInt64();
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_ChunkReference_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_ChunkReference_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference.Builder.class);
}
public static com.google.protobuf.Parser<ChunkReference> PARSER =
new com.google.protobuf.AbstractParser<ChunkReference>() {
public ChunkReference parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new ChunkReference(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<ChunkReference> getParserForType() {
return PARSER;
}
private int bitField0_;
public static final int CONTAINER_INDEX_FIELD_NUMBER = 1;
private long containerIndex_;
/**
* <code>required uint64 container_index = 1;</code>
*/
public boolean hasContainerIndex() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required uint64 container_index = 1;</code>
*/
public long getContainerIndex() {
return containerIndex_;
}
public static final int CHUNK_INDEX_FIELD_NUMBER = 2;
private long chunkIndex_;
/**
* <code>required uint64 chunk_index = 2;</code>
*/
public boolean hasChunkIndex() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required uint64 chunk_index = 2;</code>
*/
public long getChunkIndex() {
return chunkIndex_;
}
private void initFields() {
containerIndex_ = 0L;
chunkIndex_ = 0L;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
if (!hasContainerIndex()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasChunkIndex()) {
memoizedIsInitialized = 0;
return false;
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeUInt64(1, containerIndex_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeUInt64(2, chunkIndex_);
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream
.computeUInt64Size(1, containerIndex_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += com.google.protobuf.CodedOutputStream
.computeUInt64Size(2, chunkIndex_);
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code ChunkReference}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:ChunkReference)
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReferenceOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_ChunkReference_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_ChunkReference_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference.Builder.class);
}
// Construct using com.github.horrorho.inflatabledonkey.protocol.ChunkServer.ChunkReference.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
containerIndex_ = 0L;
bitField0_ = (bitField0_ & ~0x00000001);
chunkIndex_ = 0L;
bitField0_ = (bitField0_ & ~0x00000002);
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_ChunkReference_descriptor;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference getDefaultInstanceForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference.getDefaultInstance();
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference build() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference buildPartial() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference result = new com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
result.containerIndex_ = containerIndex_;
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002;
}
result.chunkIndex_ = chunkIndex_;
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference) {
return mergeFrom((com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference other) {
if (other == com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference.getDefaultInstance()) return this;
if (other.hasContainerIndex()) {
setContainerIndex(other.getContainerIndex());
}
if (other.hasChunkIndex()) {
setChunkIndex(other.getChunkIndex());
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
if (!hasContainerIndex()) {
return false;
}
if (!hasChunkIndex()) {
return false;
}
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private long containerIndex_ ;
/**
* <code>required uint64 container_index = 1;</code>
*/
public boolean hasContainerIndex() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required uint64 container_index = 1;</code>
*/
public long getContainerIndex() {
return containerIndex_;
}
/**
* <code>required uint64 container_index = 1;</code>
*/
public Builder setContainerIndex(long value) {
bitField0_ |= 0x00000001;
containerIndex_ = value;
onChanged();
return this;
}
/**
* <code>required uint64 container_index = 1;</code>
*/
public Builder clearContainerIndex() {
bitField0_ = (bitField0_ & ~0x00000001);
containerIndex_ = 0L;
onChanged();
return this;
}
private long chunkIndex_ ;
/**
* <code>required uint64 chunk_index = 2;</code>
*/
public boolean hasChunkIndex() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required uint64 chunk_index = 2;</code>
*/
public long getChunkIndex() {
return chunkIndex_;
}
/**
* <code>required uint64 chunk_index = 2;</code>
*/
public Builder setChunkIndex(long value) {
bitField0_ |= 0x00000002;
chunkIndex_ = value;
onChanged();
return this;
}
/**
* <code>required uint64 chunk_index = 2;</code>
*/
public Builder clearChunkIndex() {
bitField0_ = (bitField0_ & ~0x00000002);
chunkIndex_ = 0L;
onChanged();
return this;
}
// @@protoc_insertion_point(builder_scope:ChunkReference)
}
static {
defaultInstance = new ChunkReference(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:ChunkReference)
}
public interface FileChecksumChunkReferencesOrBuilder extends
// @@protoc_insertion_point(interface_extends:FileChecksumChunkReferences)
com.google.protobuf.MessageOrBuilder {
/**
* <code>required bytes file_checksum = 1;</code>
*/
boolean hasFileChecksum();
/**
* <code>required bytes file_checksum = 1;</code>
*/
com.google.protobuf.ByteString getFileChecksum();
/**
* <code>repeated .ChunkReference chunk_references = 2;</code>
*/
java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference>
getChunkReferencesList();
/**
* <code>repeated .ChunkReference chunk_references = 2;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference getChunkReferences(int index);
/**
* <code>repeated .ChunkReference chunk_references = 2;</code>
*/
int getChunkReferencesCount();
/**
* <code>repeated .ChunkReference chunk_references = 2;</code>
*/
java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReferenceOrBuilder>
getChunkReferencesOrBuilderList();
/**
* <code>repeated .ChunkReference chunk_references = 2;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReferenceOrBuilder getChunkReferencesOrBuilder(
int index);
/**
* <code>optional bytes file_signature = 3;</code>
*/
boolean hasFileSignature();
/**
* <code>optional bytes file_signature = 3;</code>
*/
com.google.protobuf.ByteString getFileSignature();
}
/**
* Protobuf type {@code FileChecksumChunkReferences}
*/
public static final class FileChecksumChunkReferences extends
com.google.protobuf.GeneratedMessage implements
// @@protoc_insertion_point(message_implements:FileChecksumChunkReferences)
FileChecksumChunkReferencesOrBuilder {
// Use FileChecksumChunkReferences.newBuilder() to construct.
private FileChecksumChunkReferences(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private FileChecksumChunkReferences(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final FileChecksumChunkReferences defaultInstance;
public static FileChecksumChunkReferences getDefaultInstance() {
return defaultInstance;
}
public FileChecksumChunkReferences getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private FileChecksumChunkReferences(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
bitField0_ |= 0x00000001;
fileChecksum_ = input.readBytes();
break;
}
case 18: {
if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
chunkReferences_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference>();
mutable_bitField0_ |= 0x00000002;
}
chunkReferences_.add(input.readMessage(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference.PARSER, extensionRegistry));
break;
}
case 26: {
bitField0_ |= 0x00000002;
fileSignature_ = input.readBytes();
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
chunkReferences_ = java.util.Collections.unmodifiableList(chunkReferences_);
}
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileChecksumChunkReferences_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileChecksumChunkReferences_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences.Builder.class);
}
public static com.google.protobuf.Parser<FileChecksumChunkReferences> PARSER =
new com.google.protobuf.AbstractParser<FileChecksumChunkReferences>() {
public FileChecksumChunkReferences parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new FileChecksumChunkReferences(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<FileChecksumChunkReferences> getParserForType() {
return PARSER;
}
private int bitField0_;
public static final int FILE_CHECKSUM_FIELD_NUMBER = 1;
private com.google.protobuf.ByteString fileChecksum_;
/**
* <code>required bytes file_checksum = 1;</code>
*/
public boolean hasFileChecksum() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required bytes file_checksum = 1;</code>
*/
public com.google.protobuf.ByteString getFileChecksum() {
return fileChecksum_;
}
public static final int CHUNK_REFERENCES_FIELD_NUMBER = 2;
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference> chunkReferences_;
/**
* <code>repeated .ChunkReference chunk_references = 2;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference> getChunkReferencesList() {
return chunkReferences_;
}
/**
* <code>repeated .ChunkReference chunk_references = 2;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReferenceOrBuilder>
getChunkReferencesOrBuilderList() {
return chunkReferences_;
}
/**
* <code>repeated .ChunkReference chunk_references = 2;</code>
*/
public int getChunkReferencesCount() {
return chunkReferences_.size();
}
/**
* <code>repeated .ChunkReference chunk_references = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference getChunkReferences(int index) {
return chunkReferences_.get(index);
}
/**
* <code>repeated .ChunkReference chunk_references = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReferenceOrBuilder getChunkReferencesOrBuilder(
int index) {
return chunkReferences_.get(index);
}
public static final int FILE_SIGNATURE_FIELD_NUMBER = 3;
private com.google.protobuf.ByteString fileSignature_;
/**
* <code>optional bytes file_signature = 3;</code>
*/
public boolean hasFileSignature() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>optional bytes file_signature = 3;</code>
*/
public com.google.protobuf.ByteString getFileSignature() {
return fileSignature_;
}
private void initFields() {
fileChecksum_ = com.google.protobuf.ByteString.EMPTY;
chunkReferences_ = java.util.Collections.emptyList();
fileSignature_ = com.google.protobuf.ByteString.EMPTY;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
if (!hasFileChecksum()) {
memoizedIsInitialized = 0;
return false;
}
for (int i = 0; i < getChunkReferencesCount(); i++) {
if (!getChunkReferences(i).isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeBytes(1, fileChecksum_);
}
for (int i = 0; i < chunkReferences_.size(); i++) {
output.writeMessage(2, chunkReferences_.get(i));
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeBytes(3, fileSignature_);
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(1, fileChecksum_);
}
for (int i = 0; i < chunkReferences_.size(); i++) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(2, chunkReferences_.get(i));
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(3, fileSignature_);
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code FileChecksumChunkReferences}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:FileChecksumChunkReferences)
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferencesOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileChecksumChunkReferences_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileChecksumChunkReferences_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences.Builder.class);
}
// Construct using com.github.horrorho.inflatabledonkey.protocol.ChunkServer.FileChecksumChunkReferences.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
getChunkReferencesFieldBuilder();
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
fileChecksum_ = com.google.protobuf.ByteString.EMPTY;
bitField0_ = (bitField0_ & ~0x00000001);
if (chunkReferencesBuilder_ == null) {
chunkReferences_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000002);
} else {
chunkReferencesBuilder_.clear();
}
fileSignature_ = com.google.protobuf.ByteString.EMPTY;
bitField0_ = (bitField0_ & ~0x00000004);
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileChecksumChunkReferences_descriptor;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences getDefaultInstanceForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences.getDefaultInstance();
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences build() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences buildPartial() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences result = new com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
result.fileChecksum_ = fileChecksum_;
if (chunkReferencesBuilder_ == null) {
if (((bitField0_ & 0x00000002) == 0x00000002)) {
chunkReferences_ = java.util.Collections.unmodifiableList(chunkReferences_);
bitField0_ = (bitField0_ & ~0x00000002);
}
result.chunkReferences_ = chunkReferences_;
} else {
result.chunkReferences_ = chunkReferencesBuilder_.build();
}
if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
to_bitField0_ |= 0x00000002;
}
result.fileSignature_ = fileSignature_;
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences) {
return mergeFrom((com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences other) {
if (other == com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences.getDefaultInstance()) return this;
if (other.hasFileChecksum()) {
setFileChecksum(other.getFileChecksum());
}
if (chunkReferencesBuilder_ == null) {
if (!other.chunkReferences_.isEmpty()) {
if (chunkReferences_.isEmpty()) {
chunkReferences_ = other.chunkReferences_;
bitField0_ = (bitField0_ & ~0x00000002);
} else {
ensureChunkReferencesIsMutable();
chunkReferences_.addAll(other.chunkReferences_);
}
onChanged();
}
} else {
if (!other.chunkReferences_.isEmpty()) {
if (chunkReferencesBuilder_.isEmpty()) {
chunkReferencesBuilder_.dispose();
chunkReferencesBuilder_ = null;
chunkReferences_ = other.chunkReferences_;
bitField0_ = (bitField0_ & ~0x00000002);
chunkReferencesBuilder_ =
com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
getChunkReferencesFieldBuilder() : null;
} else {
chunkReferencesBuilder_.addAllMessages(other.chunkReferences_);
}
}
}
if (other.hasFileSignature()) {
setFileSignature(other.getFileSignature());
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
if (!hasFileChecksum()) {
return false;
}
for (int i = 0; i < getChunkReferencesCount(); i++) {
if (!getChunkReferences(i).isInitialized()) {
return false;
}
}
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private com.google.protobuf.ByteString fileChecksum_ = com.google.protobuf.ByteString.EMPTY;
/**
* <code>required bytes file_checksum = 1;</code>
*/
public boolean hasFileChecksum() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required bytes file_checksum = 1;</code>
*/
public com.google.protobuf.ByteString getFileChecksum() {
return fileChecksum_;
}
/**
* <code>required bytes file_checksum = 1;</code>
*/
public Builder setFileChecksum(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
fileChecksum_ = value;
onChanged();
return this;
}
/**
* <code>required bytes file_checksum = 1;</code>
*/
public Builder clearFileChecksum() {
bitField0_ = (bitField0_ & ~0x00000001);
fileChecksum_ = getDefaultInstance().getFileChecksum();
onChanged();
return this;
}
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference> chunkReferences_ =
java.util.Collections.emptyList();
private void ensureChunkReferencesIsMutable() {
if (!((bitField0_ & 0x00000002) == 0x00000002)) {
chunkReferences_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference>(chunkReferences_);
bitField0_ |= 0x00000002;
}
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReferenceOrBuilder> chunkReferencesBuilder_;
/**
* <code>repeated .ChunkReference chunk_references = 2;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference> getChunkReferencesList() {
if (chunkReferencesBuilder_ == null) {
return java.util.Collections.unmodifiableList(chunkReferences_);
} else {
return chunkReferencesBuilder_.getMessageList();
}
}
/**
* <code>repeated .ChunkReference chunk_references = 2;</code>
*/
public int getChunkReferencesCount() {
if (chunkReferencesBuilder_ == null) {
return chunkReferences_.size();
} else {
return chunkReferencesBuilder_.getCount();
}
}
/**
* <code>repeated .ChunkReference chunk_references = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference getChunkReferences(int index) {
if (chunkReferencesBuilder_ == null) {
return chunkReferences_.get(index);
} else {
return chunkReferencesBuilder_.getMessage(index);
}
}
/**
* <code>repeated .ChunkReference chunk_references = 2;</code>
*/
public Builder setChunkReferences(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference value) {
if (chunkReferencesBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureChunkReferencesIsMutable();
chunkReferences_.set(index, value);
onChanged();
} else {
chunkReferencesBuilder_.setMessage(index, value);
}
return this;
}
/**
* <code>repeated .ChunkReference chunk_references = 2;</code>
*/
public Builder setChunkReferences(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference.Builder builderForValue) {
if (chunkReferencesBuilder_ == null) {
ensureChunkReferencesIsMutable();
chunkReferences_.set(index, builderForValue.build());
onChanged();
} else {
chunkReferencesBuilder_.setMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .ChunkReference chunk_references = 2;</code>
*/
public Builder addChunkReferences(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference value) {
if (chunkReferencesBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureChunkReferencesIsMutable();
chunkReferences_.add(value);
onChanged();
} else {
chunkReferencesBuilder_.addMessage(value);
}
return this;
}
/**
* <code>repeated .ChunkReference chunk_references = 2;</code>
*/
public Builder addChunkReferences(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference value) {
if (chunkReferencesBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureChunkReferencesIsMutable();
chunkReferences_.add(index, value);
onChanged();
} else {
chunkReferencesBuilder_.addMessage(index, value);
}
return this;
}
/**
* <code>repeated .ChunkReference chunk_references = 2;</code>
*/
public Builder addChunkReferences(
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference.Builder builderForValue) {
if (chunkReferencesBuilder_ == null) {
ensureChunkReferencesIsMutable();
chunkReferences_.add(builderForValue.build());
onChanged();
} else {
chunkReferencesBuilder_.addMessage(builderForValue.build());
}
return this;
}
/**
* <code>repeated .ChunkReference chunk_references = 2;</code>
*/
public Builder addChunkReferences(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference.Builder builderForValue) {
if (chunkReferencesBuilder_ == null) {
ensureChunkReferencesIsMutable();
chunkReferences_.add(index, builderForValue.build());
onChanged();
} else {
chunkReferencesBuilder_.addMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .ChunkReference chunk_references = 2;</code>
*/
public Builder addAllChunkReferences(
java.lang.Iterable<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference> values) {
if (chunkReferencesBuilder_ == null) {
ensureChunkReferencesIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, chunkReferences_);
onChanged();
} else {
chunkReferencesBuilder_.addAllMessages(values);
}
return this;
}
/**
* <code>repeated .ChunkReference chunk_references = 2;</code>
*/
public Builder clearChunkReferences() {
if (chunkReferencesBuilder_ == null) {
chunkReferences_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000002);
onChanged();
} else {
chunkReferencesBuilder_.clear();
}
return this;
}
/**
* <code>repeated .ChunkReference chunk_references = 2;</code>
*/
public Builder removeChunkReferences(int index) {
if (chunkReferencesBuilder_ == null) {
ensureChunkReferencesIsMutable();
chunkReferences_.remove(index);
onChanged();
} else {
chunkReferencesBuilder_.remove(index);
}
return this;
}
/**
* <code>repeated .ChunkReference chunk_references = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference.Builder getChunkReferencesBuilder(
int index) {
return getChunkReferencesFieldBuilder().getBuilder(index);
}
/**
* <code>repeated .ChunkReference chunk_references = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReferenceOrBuilder getChunkReferencesOrBuilder(
int index) {
if (chunkReferencesBuilder_ == null) {
return chunkReferences_.get(index); } else {
return chunkReferencesBuilder_.getMessageOrBuilder(index);
}
}
/**
* <code>repeated .ChunkReference chunk_references = 2;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReferenceOrBuilder>
getChunkReferencesOrBuilderList() {
if (chunkReferencesBuilder_ != null) {
return chunkReferencesBuilder_.getMessageOrBuilderList();
} else {
return java.util.Collections.unmodifiableList(chunkReferences_);
}
}
/**
* <code>repeated .ChunkReference chunk_references = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference.Builder addChunkReferencesBuilder() {
return getChunkReferencesFieldBuilder().addBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference.getDefaultInstance());
}
/**
* <code>repeated .ChunkReference chunk_references = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference.Builder addChunkReferencesBuilder(
int index) {
return getChunkReferencesFieldBuilder().addBuilder(index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference.getDefaultInstance());
}
/**
* <code>repeated .ChunkReference chunk_references = 2;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference.Builder>
getChunkReferencesBuilderList() {
return getChunkReferencesFieldBuilder().getBuilderList();
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReferenceOrBuilder>
getChunkReferencesFieldBuilder() {
if (chunkReferencesBuilder_ == null) {
chunkReferencesBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReference.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkReferenceOrBuilder>(
chunkReferences_,
((bitField0_ & 0x00000002) == 0x00000002),
getParentForChildren(),
isClean());
chunkReferences_ = null;
}
return chunkReferencesBuilder_;
}
private com.google.protobuf.ByteString fileSignature_ = com.google.protobuf.ByteString.EMPTY;
/**
* <code>optional bytes file_signature = 3;</code>
*/
public boolean hasFileSignature() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>optional bytes file_signature = 3;</code>
*/
public com.google.protobuf.ByteString getFileSignature() {
return fileSignature_;
}
/**
* <code>optional bytes file_signature = 3;</code>
*/
public Builder setFileSignature(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000004;
fileSignature_ = value;
onChanged();
return this;
}
/**
* <code>optional bytes file_signature = 3;</code>
*/
public Builder clearFileSignature() {
bitField0_ = (bitField0_ & ~0x00000004);
fileSignature_ = getDefaultInstance().getFileSignature();
onChanged();
return this;
}
// @@protoc_insertion_point(builder_scope:FileChecksumChunkReferences)
}
static {
defaultInstance = new FileChecksumChunkReferences(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:FileChecksumChunkReferences)
}
public interface FileChecksumStorageHostChunkListsOrBuilder extends
// @@protoc_insertion_point(interface_extends:FileChecksumStorageHostChunkLists)
com.google.protobuf.MessageOrBuilder {
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList>
getStorageHostChunkListList();
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList getStorageHostChunkList(int index);
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
int getStorageHostChunkListCount();
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkListOrBuilder>
getStorageHostChunkListOrBuilderList();
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkListOrBuilder getStorageHostChunkListOrBuilder(
int index);
/**
* <code>repeated .FileChecksumChunkReferences file_checksum_chunk_references = 2;</code>
*/
java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences>
getFileChecksumChunkReferencesList();
/**
* <code>repeated .FileChecksumChunkReferences file_checksum_chunk_references = 2;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences getFileChecksumChunkReferences(int index);
/**
* <code>repeated .FileChecksumChunkReferences file_checksum_chunk_references = 2;</code>
*/
int getFileChecksumChunkReferencesCount();
/**
* <code>repeated .FileChecksumChunkReferences file_checksum_chunk_references = 2;</code>
*/
java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferencesOrBuilder>
getFileChecksumChunkReferencesOrBuilderList();
/**
* <code>repeated .FileChecksumChunkReferences file_checksum_chunk_references = 2;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferencesOrBuilder getFileChecksumChunkReferencesOrBuilder(
int index);
}
/**
* Protobuf type {@code FileChecksumStorageHostChunkLists}
*/
public static final class FileChecksumStorageHostChunkLists extends
com.google.protobuf.GeneratedMessage implements
// @@protoc_insertion_point(message_implements:FileChecksumStorageHostChunkLists)
FileChecksumStorageHostChunkListsOrBuilder {
// Use FileChecksumStorageHostChunkLists.newBuilder() to construct.
private FileChecksumStorageHostChunkLists(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private FileChecksumStorageHostChunkLists(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final FileChecksumStorageHostChunkLists defaultInstance;
public static FileChecksumStorageHostChunkLists getDefaultInstance() {
return defaultInstance;
}
public FileChecksumStorageHostChunkLists getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private FileChecksumStorageHostChunkLists(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
storageHostChunkList_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList>();
mutable_bitField0_ |= 0x00000001;
}
storageHostChunkList_.add(input.readMessage(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList.PARSER, extensionRegistry));
break;
}
case 18: {
if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
fileChecksumChunkReferences_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences>();
mutable_bitField0_ |= 0x00000002;
}
fileChecksumChunkReferences_.add(input.readMessage(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences.PARSER, extensionRegistry));
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
storageHostChunkList_ = java.util.Collections.unmodifiableList(storageHostChunkList_);
}
if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
fileChecksumChunkReferences_ = java.util.Collections.unmodifiableList(fileChecksumChunkReferences_);
}
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileChecksumStorageHostChunkLists_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileChecksumStorageHostChunkLists_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists.Builder.class);
}
public static com.google.protobuf.Parser<FileChecksumStorageHostChunkLists> PARSER =
new com.google.protobuf.AbstractParser<FileChecksumStorageHostChunkLists>() {
public FileChecksumStorageHostChunkLists parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new FileChecksumStorageHostChunkLists(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<FileChecksumStorageHostChunkLists> getParserForType() {
return PARSER;
}
public static final int STORAGE_HOST_CHUNK_LIST_FIELD_NUMBER = 1;
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList> storageHostChunkList_;
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList> getStorageHostChunkListList() {
return storageHostChunkList_;
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkListOrBuilder>
getStorageHostChunkListOrBuilderList() {
return storageHostChunkList_;
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public int getStorageHostChunkListCount() {
return storageHostChunkList_.size();
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList getStorageHostChunkList(int index) {
return storageHostChunkList_.get(index);
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkListOrBuilder getStorageHostChunkListOrBuilder(
int index) {
return storageHostChunkList_.get(index);
}
public static final int FILE_CHECKSUM_CHUNK_REFERENCES_FIELD_NUMBER = 2;
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences> fileChecksumChunkReferences_;
/**
* <code>repeated .FileChecksumChunkReferences file_checksum_chunk_references = 2;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences> getFileChecksumChunkReferencesList() {
return fileChecksumChunkReferences_;
}
/**
* <code>repeated .FileChecksumChunkReferences file_checksum_chunk_references = 2;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferencesOrBuilder>
getFileChecksumChunkReferencesOrBuilderList() {
return fileChecksumChunkReferences_;
}
/**
* <code>repeated .FileChecksumChunkReferences file_checksum_chunk_references = 2;</code>
*/
public int getFileChecksumChunkReferencesCount() {
return fileChecksumChunkReferences_.size();
}
/**
* <code>repeated .FileChecksumChunkReferences file_checksum_chunk_references = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences getFileChecksumChunkReferences(int index) {
return fileChecksumChunkReferences_.get(index);
}
/**
* <code>repeated .FileChecksumChunkReferences file_checksum_chunk_references = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferencesOrBuilder getFileChecksumChunkReferencesOrBuilder(
int index) {
return fileChecksumChunkReferences_.get(index);
}
private void initFields() {
storageHostChunkList_ = java.util.Collections.emptyList();
fileChecksumChunkReferences_ = java.util.Collections.emptyList();
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
for (int i = 0; i < getStorageHostChunkListCount(); i++) {
if (!getStorageHostChunkList(i).isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
for (int i = 0; i < getFileChecksumChunkReferencesCount(); i++) {
if (!getFileChecksumChunkReferences(i).isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
for (int i = 0; i < storageHostChunkList_.size(); i++) {
output.writeMessage(1, storageHostChunkList_.get(i));
}
for (int i = 0; i < fileChecksumChunkReferences_.size(); i++) {
output.writeMessage(2, fileChecksumChunkReferences_.get(i));
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
for (int i = 0; i < storageHostChunkList_.size(); i++) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(1, storageHostChunkList_.get(i));
}
for (int i = 0; i < fileChecksumChunkReferences_.size(); i++) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(2, fileChecksumChunkReferences_.get(i));
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code FileChecksumStorageHostChunkLists}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:FileChecksumStorageHostChunkLists)
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkListsOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileChecksumStorageHostChunkLists_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileChecksumStorageHostChunkLists_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists.Builder.class);
}
// Construct using com.github.horrorho.inflatabledonkey.protocol.ChunkServer.FileChecksumStorageHostChunkLists.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
getStorageHostChunkListFieldBuilder();
getFileChecksumChunkReferencesFieldBuilder();
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
if (storageHostChunkListBuilder_ == null) {
storageHostChunkList_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
} else {
storageHostChunkListBuilder_.clear();
}
if (fileChecksumChunkReferencesBuilder_ == null) {
fileChecksumChunkReferences_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000002);
} else {
fileChecksumChunkReferencesBuilder_.clear();
}
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileChecksumStorageHostChunkLists_descriptor;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists getDefaultInstanceForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists.getDefaultInstance();
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists build() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists buildPartial() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists result = new com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists(this);
int from_bitField0_ = bitField0_;
if (storageHostChunkListBuilder_ == null) {
if (((bitField0_ & 0x00000001) == 0x00000001)) {
storageHostChunkList_ = java.util.Collections.unmodifiableList(storageHostChunkList_);
bitField0_ = (bitField0_ & ~0x00000001);
}
result.storageHostChunkList_ = storageHostChunkList_;
} else {
result.storageHostChunkList_ = storageHostChunkListBuilder_.build();
}
if (fileChecksumChunkReferencesBuilder_ == null) {
if (((bitField0_ & 0x00000002) == 0x00000002)) {
fileChecksumChunkReferences_ = java.util.Collections.unmodifiableList(fileChecksumChunkReferences_);
bitField0_ = (bitField0_ & ~0x00000002);
}
result.fileChecksumChunkReferences_ = fileChecksumChunkReferences_;
} else {
result.fileChecksumChunkReferences_ = fileChecksumChunkReferencesBuilder_.build();
}
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists) {
return mergeFrom((com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists other) {
if (other == com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists.getDefaultInstance()) return this;
if (storageHostChunkListBuilder_ == null) {
if (!other.storageHostChunkList_.isEmpty()) {
if (storageHostChunkList_.isEmpty()) {
storageHostChunkList_ = other.storageHostChunkList_;
bitField0_ = (bitField0_ & ~0x00000001);
} else {
ensureStorageHostChunkListIsMutable();
storageHostChunkList_.addAll(other.storageHostChunkList_);
}
onChanged();
}
} else {
if (!other.storageHostChunkList_.isEmpty()) {
if (storageHostChunkListBuilder_.isEmpty()) {
storageHostChunkListBuilder_.dispose();
storageHostChunkListBuilder_ = null;
storageHostChunkList_ = other.storageHostChunkList_;
bitField0_ = (bitField0_ & ~0x00000001);
storageHostChunkListBuilder_ =
com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
getStorageHostChunkListFieldBuilder() : null;
} else {
storageHostChunkListBuilder_.addAllMessages(other.storageHostChunkList_);
}
}
}
if (fileChecksumChunkReferencesBuilder_ == null) {
if (!other.fileChecksumChunkReferences_.isEmpty()) {
if (fileChecksumChunkReferences_.isEmpty()) {
fileChecksumChunkReferences_ = other.fileChecksumChunkReferences_;
bitField0_ = (bitField0_ & ~0x00000002);
} else {
ensureFileChecksumChunkReferencesIsMutable();
fileChecksumChunkReferences_.addAll(other.fileChecksumChunkReferences_);
}
onChanged();
}
} else {
if (!other.fileChecksumChunkReferences_.isEmpty()) {
if (fileChecksumChunkReferencesBuilder_.isEmpty()) {
fileChecksumChunkReferencesBuilder_.dispose();
fileChecksumChunkReferencesBuilder_ = null;
fileChecksumChunkReferences_ = other.fileChecksumChunkReferences_;
bitField0_ = (bitField0_ & ~0x00000002);
fileChecksumChunkReferencesBuilder_ =
com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
getFileChecksumChunkReferencesFieldBuilder() : null;
} else {
fileChecksumChunkReferencesBuilder_.addAllMessages(other.fileChecksumChunkReferences_);
}
}
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
for (int i = 0; i < getStorageHostChunkListCount(); i++) {
if (!getStorageHostChunkList(i).isInitialized()) {
return false;
}
}
for (int i = 0; i < getFileChecksumChunkReferencesCount(); i++) {
if (!getFileChecksumChunkReferences(i).isInitialized()) {
return false;
}
}
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList> storageHostChunkList_ =
java.util.Collections.emptyList();
private void ensureStorageHostChunkListIsMutable() {
if (!((bitField0_ & 0x00000001) == 0x00000001)) {
storageHostChunkList_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList>(storageHostChunkList_);
bitField0_ |= 0x00000001;
}
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkListOrBuilder> storageHostChunkListBuilder_;
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList> getStorageHostChunkListList() {
if (storageHostChunkListBuilder_ == null) {
return java.util.Collections.unmodifiableList(storageHostChunkList_);
} else {
return storageHostChunkListBuilder_.getMessageList();
}
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public int getStorageHostChunkListCount() {
if (storageHostChunkListBuilder_ == null) {
return storageHostChunkList_.size();
} else {
return storageHostChunkListBuilder_.getCount();
}
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList getStorageHostChunkList(int index) {
if (storageHostChunkListBuilder_ == null) {
return storageHostChunkList_.get(index);
} else {
return storageHostChunkListBuilder_.getMessage(index);
}
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public Builder setStorageHostChunkList(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList value) {
if (storageHostChunkListBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureStorageHostChunkListIsMutable();
storageHostChunkList_.set(index, value);
onChanged();
} else {
storageHostChunkListBuilder_.setMessage(index, value);
}
return this;
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public Builder setStorageHostChunkList(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList.Builder builderForValue) {
if (storageHostChunkListBuilder_ == null) {
ensureStorageHostChunkListIsMutable();
storageHostChunkList_.set(index, builderForValue.build());
onChanged();
} else {
storageHostChunkListBuilder_.setMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public Builder addStorageHostChunkList(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList value) {
if (storageHostChunkListBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureStorageHostChunkListIsMutable();
storageHostChunkList_.add(value);
onChanged();
} else {
storageHostChunkListBuilder_.addMessage(value);
}
return this;
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public Builder addStorageHostChunkList(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList value) {
if (storageHostChunkListBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureStorageHostChunkListIsMutable();
storageHostChunkList_.add(index, value);
onChanged();
} else {
storageHostChunkListBuilder_.addMessage(index, value);
}
return this;
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public Builder addStorageHostChunkList(
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList.Builder builderForValue) {
if (storageHostChunkListBuilder_ == null) {
ensureStorageHostChunkListIsMutable();
storageHostChunkList_.add(builderForValue.build());
onChanged();
} else {
storageHostChunkListBuilder_.addMessage(builderForValue.build());
}
return this;
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public Builder addStorageHostChunkList(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList.Builder builderForValue) {
if (storageHostChunkListBuilder_ == null) {
ensureStorageHostChunkListIsMutable();
storageHostChunkList_.add(index, builderForValue.build());
onChanged();
} else {
storageHostChunkListBuilder_.addMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public Builder addAllStorageHostChunkList(
java.lang.Iterable<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList> values) {
if (storageHostChunkListBuilder_ == null) {
ensureStorageHostChunkListIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, storageHostChunkList_);
onChanged();
} else {
storageHostChunkListBuilder_.addAllMessages(values);
}
return this;
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public Builder clearStorageHostChunkList() {
if (storageHostChunkListBuilder_ == null) {
storageHostChunkList_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
onChanged();
} else {
storageHostChunkListBuilder_.clear();
}
return this;
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public Builder removeStorageHostChunkList(int index) {
if (storageHostChunkListBuilder_ == null) {
ensureStorageHostChunkListIsMutable();
storageHostChunkList_.remove(index);
onChanged();
} else {
storageHostChunkListBuilder_.remove(index);
}
return this;
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList.Builder getStorageHostChunkListBuilder(
int index) {
return getStorageHostChunkListFieldBuilder().getBuilder(index);
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkListOrBuilder getStorageHostChunkListOrBuilder(
int index) {
if (storageHostChunkListBuilder_ == null) {
return storageHostChunkList_.get(index); } else {
return storageHostChunkListBuilder_.getMessageOrBuilder(index);
}
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkListOrBuilder>
getStorageHostChunkListOrBuilderList() {
if (storageHostChunkListBuilder_ != null) {
return storageHostChunkListBuilder_.getMessageOrBuilderList();
} else {
return java.util.Collections.unmodifiableList(storageHostChunkList_);
}
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList.Builder addStorageHostChunkListBuilder() {
return getStorageHostChunkListFieldBuilder().addBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList.getDefaultInstance());
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList.Builder addStorageHostChunkListBuilder(
int index) {
return getStorageHostChunkListFieldBuilder().addBuilder(index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList.getDefaultInstance());
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList.Builder>
getStorageHostChunkListBuilderList() {
return getStorageHostChunkListFieldBuilder().getBuilderList();
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkListOrBuilder>
getStorageHostChunkListFieldBuilder() {
if (storageHostChunkListBuilder_ == null) {
storageHostChunkListBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkListOrBuilder>(
storageHostChunkList_,
((bitField0_ & 0x00000001) == 0x00000001),
getParentForChildren(),
isClean());
storageHostChunkList_ = null;
}
return storageHostChunkListBuilder_;
}
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences> fileChecksumChunkReferences_ =
java.util.Collections.emptyList();
private void ensureFileChecksumChunkReferencesIsMutable() {
if (!((bitField0_ & 0x00000002) == 0x00000002)) {
fileChecksumChunkReferences_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences>(fileChecksumChunkReferences_);
bitField0_ |= 0x00000002;
}
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferencesOrBuilder> fileChecksumChunkReferencesBuilder_;
/**
* <code>repeated .FileChecksumChunkReferences file_checksum_chunk_references = 2;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences> getFileChecksumChunkReferencesList() {
if (fileChecksumChunkReferencesBuilder_ == null) {
return java.util.Collections.unmodifiableList(fileChecksumChunkReferences_);
} else {
return fileChecksumChunkReferencesBuilder_.getMessageList();
}
}
/**
* <code>repeated .FileChecksumChunkReferences file_checksum_chunk_references = 2;</code>
*/
public int getFileChecksumChunkReferencesCount() {
if (fileChecksumChunkReferencesBuilder_ == null) {
return fileChecksumChunkReferences_.size();
} else {
return fileChecksumChunkReferencesBuilder_.getCount();
}
}
/**
* <code>repeated .FileChecksumChunkReferences file_checksum_chunk_references = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences getFileChecksumChunkReferences(int index) {
if (fileChecksumChunkReferencesBuilder_ == null) {
return fileChecksumChunkReferences_.get(index);
} else {
return fileChecksumChunkReferencesBuilder_.getMessage(index);
}
}
/**
* <code>repeated .FileChecksumChunkReferences file_checksum_chunk_references = 2;</code>
*/
public Builder setFileChecksumChunkReferences(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences value) {
if (fileChecksumChunkReferencesBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureFileChecksumChunkReferencesIsMutable();
fileChecksumChunkReferences_.set(index, value);
onChanged();
} else {
fileChecksumChunkReferencesBuilder_.setMessage(index, value);
}
return this;
}
/**
* <code>repeated .FileChecksumChunkReferences file_checksum_chunk_references = 2;</code>
*/
public Builder setFileChecksumChunkReferences(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences.Builder builderForValue) {
if (fileChecksumChunkReferencesBuilder_ == null) {
ensureFileChecksumChunkReferencesIsMutable();
fileChecksumChunkReferences_.set(index, builderForValue.build());
onChanged();
} else {
fileChecksumChunkReferencesBuilder_.setMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .FileChecksumChunkReferences file_checksum_chunk_references = 2;</code>
*/
public Builder addFileChecksumChunkReferences(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences value) {
if (fileChecksumChunkReferencesBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureFileChecksumChunkReferencesIsMutable();
fileChecksumChunkReferences_.add(value);
onChanged();
} else {
fileChecksumChunkReferencesBuilder_.addMessage(value);
}
return this;
}
/**
* <code>repeated .FileChecksumChunkReferences file_checksum_chunk_references = 2;</code>
*/
public Builder addFileChecksumChunkReferences(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences value) {
if (fileChecksumChunkReferencesBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureFileChecksumChunkReferencesIsMutable();
fileChecksumChunkReferences_.add(index, value);
onChanged();
} else {
fileChecksumChunkReferencesBuilder_.addMessage(index, value);
}
return this;
}
/**
* <code>repeated .FileChecksumChunkReferences file_checksum_chunk_references = 2;</code>
*/
public Builder addFileChecksumChunkReferences(
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences.Builder builderForValue) {
if (fileChecksumChunkReferencesBuilder_ == null) {
ensureFileChecksumChunkReferencesIsMutable();
fileChecksumChunkReferences_.add(builderForValue.build());
onChanged();
} else {
fileChecksumChunkReferencesBuilder_.addMessage(builderForValue.build());
}
return this;
}
/**
* <code>repeated .FileChecksumChunkReferences file_checksum_chunk_references = 2;</code>
*/
public Builder addFileChecksumChunkReferences(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences.Builder builderForValue) {
if (fileChecksumChunkReferencesBuilder_ == null) {
ensureFileChecksumChunkReferencesIsMutable();
fileChecksumChunkReferences_.add(index, builderForValue.build());
onChanged();
} else {
fileChecksumChunkReferencesBuilder_.addMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .FileChecksumChunkReferences file_checksum_chunk_references = 2;</code>
*/
public Builder addAllFileChecksumChunkReferences(
java.lang.Iterable<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences> values) {
if (fileChecksumChunkReferencesBuilder_ == null) {
ensureFileChecksumChunkReferencesIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, fileChecksumChunkReferences_);
onChanged();
} else {
fileChecksumChunkReferencesBuilder_.addAllMessages(values);
}
return this;
}
/**
* <code>repeated .FileChecksumChunkReferences file_checksum_chunk_references = 2;</code>
*/
public Builder clearFileChecksumChunkReferences() {
if (fileChecksumChunkReferencesBuilder_ == null) {
fileChecksumChunkReferences_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000002);
onChanged();
} else {
fileChecksumChunkReferencesBuilder_.clear();
}
return this;
}
/**
* <code>repeated .FileChecksumChunkReferences file_checksum_chunk_references = 2;</code>
*/
public Builder removeFileChecksumChunkReferences(int index) {
if (fileChecksumChunkReferencesBuilder_ == null) {
ensureFileChecksumChunkReferencesIsMutable();
fileChecksumChunkReferences_.remove(index);
onChanged();
} else {
fileChecksumChunkReferencesBuilder_.remove(index);
}
return this;
}
/**
* <code>repeated .FileChecksumChunkReferences file_checksum_chunk_references = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences.Builder getFileChecksumChunkReferencesBuilder(
int index) {
return getFileChecksumChunkReferencesFieldBuilder().getBuilder(index);
}
/**
* <code>repeated .FileChecksumChunkReferences file_checksum_chunk_references = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferencesOrBuilder getFileChecksumChunkReferencesOrBuilder(
int index) {
if (fileChecksumChunkReferencesBuilder_ == null) {
return fileChecksumChunkReferences_.get(index); } else {
return fileChecksumChunkReferencesBuilder_.getMessageOrBuilder(index);
}
}
/**
* <code>repeated .FileChecksumChunkReferences file_checksum_chunk_references = 2;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferencesOrBuilder>
getFileChecksumChunkReferencesOrBuilderList() {
if (fileChecksumChunkReferencesBuilder_ != null) {
return fileChecksumChunkReferencesBuilder_.getMessageOrBuilderList();
} else {
return java.util.Collections.unmodifiableList(fileChecksumChunkReferences_);
}
}
/**
* <code>repeated .FileChecksumChunkReferences file_checksum_chunk_references = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences.Builder addFileChecksumChunkReferencesBuilder() {
return getFileChecksumChunkReferencesFieldBuilder().addBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences.getDefaultInstance());
}
/**
* <code>repeated .FileChecksumChunkReferences file_checksum_chunk_references = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences.Builder addFileChecksumChunkReferencesBuilder(
int index) {
return getFileChecksumChunkReferencesFieldBuilder().addBuilder(index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences.getDefaultInstance());
}
/**
* <code>repeated .FileChecksumChunkReferences file_checksum_chunk_references = 2;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences.Builder>
getFileChecksumChunkReferencesBuilderList() {
return getFileChecksumChunkReferencesFieldBuilder().getBuilderList();
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferencesOrBuilder>
getFileChecksumChunkReferencesFieldBuilder() {
if (fileChecksumChunkReferencesBuilder_ == null) {
fileChecksumChunkReferencesBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferences.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumChunkReferencesOrBuilder>(
fileChecksumChunkReferences_,
((bitField0_ & 0x00000002) == 0x00000002),
getParentForChildren(),
isClean());
fileChecksumChunkReferences_ = null;
}
return fileChecksumChunkReferencesBuilder_;
}
// @@protoc_insertion_point(builder_scope:FileChecksumStorageHostChunkLists)
}
static {
defaultInstance = new FileChecksumStorageHostChunkLists(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:FileChecksumStorageHostChunkLists)
}
public interface FileGroupsOrBuilder extends
// @@protoc_insertion_point(interface_extends:FileGroups)
com.google.protobuf.MessageOrBuilder {
/**
* <code>repeated .FileChecksumStorageHostChunkLists file_groups = 1;</code>
*/
java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists>
getFileGroupsList();
/**
* <code>repeated .FileChecksumStorageHostChunkLists file_groups = 1;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists getFileGroups(int index);
/**
* <code>repeated .FileChecksumStorageHostChunkLists file_groups = 1;</code>
*/
int getFileGroupsCount();
/**
* <code>repeated .FileChecksumStorageHostChunkLists file_groups = 1;</code>
*/
java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkListsOrBuilder>
getFileGroupsOrBuilderList();
/**
* <code>repeated .FileChecksumStorageHostChunkLists file_groups = 1;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkListsOrBuilder getFileGroupsOrBuilder(
int index);
/**
* <code>repeated .FileError file_error = 2;</code>
*/
java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError>
getFileErrorList();
/**
* <code>repeated .FileError file_error = 2;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError getFileError(int index);
/**
* <code>repeated .FileError file_error = 2;</code>
*/
int getFileErrorCount();
/**
* <code>repeated .FileError file_error = 2;</code>
*/
java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileErrorOrBuilder>
getFileErrorOrBuilderList();
/**
* <code>repeated .FileError file_error = 2;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileErrorOrBuilder getFileErrorOrBuilder(
int index);
/**
* <code>repeated .FileChunkError file_chunk_error = 3;</code>
*/
java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError>
getFileChunkErrorList();
/**
* <code>repeated .FileChunkError file_chunk_error = 3;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError getFileChunkError(int index);
/**
* <code>repeated .FileChunkError file_chunk_error = 3;</code>
*/
int getFileChunkErrorCount();
/**
* <code>repeated .FileChunkError file_chunk_error = 3;</code>
*/
java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkErrorOrBuilder>
getFileChunkErrorOrBuilderList();
/**
* <code>repeated .FileChunkError file_chunk_error = 3;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkErrorOrBuilder getFileChunkErrorOrBuilder(
int index);
/**
* <code>optional uint32 verbosity_level = 4;</code>
*/
boolean hasVerbosityLevel();
/**
* <code>optional uint32 verbosity_level = 4;</code>
*/
int getVerbosityLevel();
}
/**
* Protobuf type {@code FileGroups}
*/
public static final class FileGroups extends
com.google.protobuf.GeneratedMessage implements
// @@protoc_insertion_point(message_implements:FileGroups)
FileGroupsOrBuilder {
// Use FileGroups.newBuilder() to construct.
private FileGroups(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private FileGroups(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final FileGroups defaultInstance;
public static FileGroups getDefaultInstance() {
return defaultInstance;
}
public FileGroups getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private FileGroups(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
fileGroups_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists>();
mutable_bitField0_ |= 0x00000001;
}
fileGroups_.add(input.readMessage(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists.PARSER, extensionRegistry));
break;
}
case 18: {
if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
fileError_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError>();
mutable_bitField0_ |= 0x00000002;
}
fileError_.add(input.readMessage(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError.PARSER, extensionRegistry));
break;
}
case 26: {
if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) {
fileChunkError_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError>();
mutable_bitField0_ |= 0x00000004;
}
fileChunkError_.add(input.readMessage(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError.PARSER, extensionRegistry));
break;
}
case 32: {
bitField0_ |= 0x00000001;
verbosityLevel_ = input.readUInt32();
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
fileGroups_ = java.util.Collections.unmodifiableList(fileGroups_);
}
if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
fileError_ = java.util.Collections.unmodifiableList(fileError_);
}
if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) {
fileChunkError_ = java.util.Collections.unmodifiableList(fileChunkError_);
}
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileGroups_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileGroups_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileGroups.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileGroups.Builder.class);
}
public static com.google.protobuf.Parser<FileGroups> PARSER =
new com.google.protobuf.AbstractParser<FileGroups>() {
public FileGroups parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new FileGroups(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<FileGroups> getParserForType() {
return PARSER;
}
private int bitField0_;
public static final int FILE_GROUPS_FIELD_NUMBER = 1;
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists> fileGroups_;
/**
* <code>repeated .FileChecksumStorageHostChunkLists file_groups = 1;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists> getFileGroupsList() {
return fileGroups_;
}
/**
* <code>repeated .FileChecksumStorageHostChunkLists file_groups = 1;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkListsOrBuilder>
getFileGroupsOrBuilderList() {
return fileGroups_;
}
/**
* <code>repeated .FileChecksumStorageHostChunkLists file_groups = 1;</code>
*/
public int getFileGroupsCount() {
return fileGroups_.size();
}
/**
* <code>repeated .FileChecksumStorageHostChunkLists file_groups = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists getFileGroups(int index) {
return fileGroups_.get(index);
}
/**
* <code>repeated .FileChecksumStorageHostChunkLists file_groups = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkListsOrBuilder getFileGroupsOrBuilder(
int index) {
return fileGroups_.get(index);
}
public static final int FILE_ERROR_FIELD_NUMBER = 2;
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError> fileError_;
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError> getFileErrorList() {
return fileError_;
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileErrorOrBuilder>
getFileErrorOrBuilderList() {
return fileError_;
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public int getFileErrorCount() {
return fileError_.size();
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError getFileError(int index) {
return fileError_.get(index);
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileErrorOrBuilder getFileErrorOrBuilder(
int index) {
return fileError_.get(index);
}
public static final int FILE_CHUNK_ERROR_FIELD_NUMBER = 3;
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError> fileChunkError_;
/**
* <code>repeated .FileChunkError file_chunk_error = 3;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError> getFileChunkErrorList() {
return fileChunkError_;
}
/**
* <code>repeated .FileChunkError file_chunk_error = 3;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkErrorOrBuilder>
getFileChunkErrorOrBuilderList() {
return fileChunkError_;
}
/**
* <code>repeated .FileChunkError file_chunk_error = 3;</code>
*/
public int getFileChunkErrorCount() {
return fileChunkError_.size();
}
/**
* <code>repeated .FileChunkError file_chunk_error = 3;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError getFileChunkError(int index) {
return fileChunkError_.get(index);
}
/**
* <code>repeated .FileChunkError file_chunk_error = 3;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkErrorOrBuilder getFileChunkErrorOrBuilder(
int index) {
return fileChunkError_.get(index);
}
public static final int VERBOSITY_LEVEL_FIELD_NUMBER = 4;
private int verbosityLevel_;
/**
* <code>optional uint32 verbosity_level = 4;</code>
*/
public boolean hasVerbosityLevel() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>optional uint32 verbosity_level = 4;</code>
*/
public int getVerbosityLevel() {
return verbosityLevel_;
}
private void initFields() {
fileGroups_ = java.util.Collections.emptyList();
fileError_ = java.util.Collections.emptyList();
fileChunkError_ = java.util.Collections.emptyList();
verbosityLevel_ = 0;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
for (int i = 0; i < getFileGroupsCount(); i++) {
if (!getFileGroups(i).isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
for (int i = 0; i < getFileErrorCount(); i++) {
if (!getFileError(i).isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
for (int i = 0; i < getFileChunkErrorCount(); i++) {
if (!getFileChunkError(i).isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
for (int i = 0; i < fileGroups_.size(); i++) {
output.writeMessage(1, fileGroups_.get(i));
}
for (int i = 0; i < fileError_.size(); i++) {
output.writeMessage(2, fileError_.get(i));
}
for (int i = 0; i < fileChunkError_.size(); i++) {
output.writeMessage(3, fileChunkError_.get(i));
}
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeUInt32(4, verbosityLevel_);
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
for (int i = 0; i < fileGroups_.size(); i++) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(1, fileGroups_.get(i));
}
for (int i = 0; i < fileError_.size(); i++) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(2, fileError_.get(i));
}
for (int i = 0; i < fileChunkError_.size(); i++) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(3, fileChunkError_.get(i));
}
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream
.computeUInt32Size(4, verbosityLevel_);
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileGroups parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileGroups parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileGroups parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileGroups parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileGroups parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileGroups parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileGroups parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileGroups parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileGroups parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileGroups parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileGroups prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code FileGroups}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:FileGroups)
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileGroupsOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileGroups_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileGroups_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileGroups.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileGroups.Builder.class);
}
// Construct using com.github.horrorho.inflatabledonkey.protocol.ChunkServer.FileGroups.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
getFileGroupsFieldBuilder();
getFileErrorFieldBuilder();
getFileChunkErrorFieldBuilder();
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
if (fileGroupsBuilder_ == null) {
fileGroups_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
} else {
fileGroupsBuilder_.clear();
}
if (fileErrorBuilder_ == null) {
fileError_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000002);
} else {
fileErrorBuilder_.clear();
}
if (fileChunkErrorBuilder_ == null) {
fileChunkError_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000004);
} else {
fileChunkErrorBuilder_.clear();
}
verbosityLevel_ = 0;
bitField0_ = (bitField0_ & ~0x00000008);
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_FileGroups_descriptor;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileGroups getDefaultInstanceForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileGroups.getDefaultInstance();
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileGroups build() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileGroups result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileGroups buildPartial() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileGroups result = new com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileGroups(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (fileGroupsBuilder_ == null) {
if (((bitField0_ & 0x00000001) == 0x00000001)) {
fileGroups_ = java.util.Collections.unmodifiableList(fileGroups_);
bitField0_ = (bitField0_ & ~0x00000001);
}
result.fileGroups_ = fileGroups_;
} else {
result.fileGroups_ = fileGroupsBuilder_.build();
}
if (fileErrorBuilder_ == null) {
if (((bitField0_ & 0x00000002) == 0x00000002)) {
fileError_ = java.util.Collections.unmodifiableList(fileError_);
bitField0_ = (bitField0_ & ~0x00000002);
}
result.fileError_ = fileError_;
} else {
result.fileError_ = fileErrorBuilder_.build();
}
if (fileChunkErrorBuilder_ == null) {
if (((bitField0_ & 0x00000004) == 0x00000004)) {
fileChunkError_ = java.util.Collections.unmodifiableList(fileChunkError_);
bitField0_ = (bitField0_ & ~0x00000004);
}
result.fileChunkError_ = fileChunkError_;
} else {
result.fileChunkError_ = fileChunkErrorBuilder_.build();
}
if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
to_bitField0_ |= 0x00000001;
}
result.verbosityLevel_ = verbosityLevel_;
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileGroups) {
return mergeFrom((com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileGroups)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileGroups other) {
if (other == com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileGroups.getDefaultInstance()) return this;
if (fileGroupsBuilder_ == null) {
if (!other.fileGroups_.isEmpty()) {
if (fileGroups_.isEmpty()) {
fileGroups_ = other.fileGroups_;
bitField0_ = (bitField0_ & ~0x00000001);
} else {
ensureFileGroupsIsMutable();
fileGroups_.addAll(other.fileGroups_);
}
onChanged();
}
} else {
if (!other.fileGroups_.isEmpty()) {
if (fileGroupsBuilder_.isEmpty()) {
fileGroupsBuilder_.dispose();
fileGroupsBuilder_ = null;
fileGroups_ = other.fileGroups_;
bitField0_ = (bitField0_ & ~0x00000001);
fileGroupsBuilder_ =
com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
getFileGroupsFieldBuilder() : null;
} else {
fileGroupsBuilder_.addAllMessages(other.fileGroups_);
}
}
}
if (fileErrorBuilder_ == null) {
if (!other.fileError_.isEmpty()) {
if (fileError_.isEmpty()) {
fileError_ = other.fileError_;
bitField0_ = (bitField0_ & ~0x00000002);
} else {
ensureFileErrorIsMutable();
fileError_.addAll(other.fileError_);
}
onChanged();
}
} else {
if (!other.fileError_.isEmpty()) {
if (fileErrorBuilder_.isEmpty()) {
fileErrorBuilder_.dispose();
fileErrorBuilder_ = null;
fileError_ = other.fileError_;
bitField0_ = (bitField0_ & ~0x00000002);
fileErrorBuilder_ =
com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
getFileErrorFieldBuilder() : null;
} else {
fileErrorBuilder_.addAllMessages(other.fileError_);
}
}
}
if (fileChunkErrorBuilder_ == null) {
if (!other.fileChunkError_.isEmpty()) {
if (fileChunkError_.isEmpty()) {
fileChunkError_ = other.fileChunkError_;
bitField0_ = (bitField0_ & ~0x00000004);
} else {
ensureFileChunkErrorIsMutable();
fileChunkError_.addAll(other.fileChunkError_);
}
onChanged();
}
} else {
if (!other.fileChunkError_.isEmpty()) {
if (fileChunkErrorBuilder_.isEmpty()) {
fileChunkErrorBuilder_.dispose();
fileChunkErrorBuilder_ = null;
fileChunkError_ = other.fileChunkError_;
bitField0_ = (bitField0_ & ~0x00000004);
fileChunkErrorBuilder_ =
com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
getFileChunkErrorFieldBuilder() : null;
} else {
fileChunkErrorBuilder_.addAllMessages(other.fileChunkError_);
}
}
}
if (other.hasVerbosityLevel()) {
setVerbosityLevel(other.getVerbosityLevel());
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
for (int i = 0; i < getFileGroupsCount(); i++) {
if (!getFileGroups(i).isInitialized()) {
return false;
}
}
for (int i = 0; i < getFileErrorCount(); i++) {
if (!getFileError(i).isInitialized()) {
return false;
}
}
for (int i = 0; i < getFileChunkErrorCount(); i++) {
if (!getFileChunkError(i).isInitialized()) {
return false;
}
}
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileGroups parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileGroups) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists> fileGroups_ =
java.util.Collections.emptyList();
private void ensureFileGroupsIsMutable() {
if (!((bitField0_ & 0x00000001) == 0x00000001)) {
fileGroups_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists>(fileGroups_);
bitField0_ |= 0x00000001;
}
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkListsOrBuilder> fileGroupsBuilder_;
/**
* <code>repeated .FileChecksumStorageHostChunkLists file_groups = 1;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists> getFileGroupsList() {
if (fileGroupsBuilder_ == null) {
return java.util.Collections.unmodifiableList(fileGroups_);
} else {
return fileGroupsBuilder_.getMessageList();
}
}
/**
* <code>repeated .FileChecksumStorageHostChunkLists file_groups = 1;</code>
*/
public int getFileGroupsCount() {
if (fileGroupsBuilder_ == null) {
return fileGroups_.size();
} else {
return fileGroupsBuilder_.getCount();
}
}
/**
* <code>repeated .FileChecksumStorageHostChunkLists file_groups = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists getFileGroups(int index) {
if (fileGroupsBuilder_ == null) {
return fileGroups_.get(index);
} else {
return fileGroupsBuilder_.getMessage(index);
}
}
/**
* <code>repeated .FileChecksumStorageHostChunkLists file_groups = 1;</code>
*/
public Builder setFileGroups(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists value) {
if (fileGroupsBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureFileGroupsIsMutable();
fileGroups_.set(index, value);
onChanged();
} else {
fileGroupsBuilder_.setMessage(index, value);
}
return this;
}
/**
* <code>repeated .FileChecksumStorageHostChunkLists file_groups = 1;</code>
*/
public Builder setFileGroups(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists.Builder builderForValue) {
if (fileGroupsBuilder_ == null) {
ensureFileGroupsIsMutable();
fileGroups_.set(index, builderForValue.build());
onChanged();
} else {
fileGroupsBuilder_.setMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .FileChecksumStorageHostChunkLists file_groups = 1;</code>
*/
public Builder addFileGroups(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists value) {
if (fileGroupsBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureFileGroupsIsMutable();
fileGroups_.add(value);
onChanged();
} else {
fileGroupsBuilder_.addMessage(value);
}
return this;
}
/**
* <code>repeated .FileChecksumStorageHostChunkLists file_groups = 1;</code>
*/
public Builder addFileGroups(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists value) {
if (fileGroupsBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureFileGroupsIsMutable();
fileGroups_.add(index, value);
onChanged();
} else {
fileGroupsBuilder_.addMessage(index, value);
}
return this;
}
/**
* <code>repeated .FileChecksumStorageHostChunkLists file_groups = 1;</code>
*/
public Builder addFileGroups(
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists.Builder builderForValue) {
if (fileGroupsBuilder_ == null) {
ensureFileGroupsIsMutable();
fileGroups_.add(builderForValue.build());
onChanged();
} else {
fileGroupsBuilder_.addMessage(builderForValue.build());
}
return this;
}
/**
* <code>repeated .FileChecksumStorageHostChunkLists file_groups = 1;</code>
*/
public Builder addFileGroups(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists.Builder builderForValue) {
if (fileGroupsBuilder_ == null) {
ensureFileGroupsIsMutable();
fileGroups_.add(index, builderForValue.build());
onChanged();
} else {
fileGroupsBuilder_.addMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .FileChecksumStorageHostChunkLists file_groups = 1;</code>
*/
public Builder addAllFileGroups(
java.lang.Iterable<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists> values) {
if (fileGroupsBuilder_ == null) {
ensureFileGroupsIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, fileGroups_);
onChanged();
} else {
fileGroupsBuilder_.addAllMessages(values);
}
return this;
}
/**
* <code>repeated .FileChecksumStorageHostChunkLists file_groups = 1;</code>
*/
public Builder clearFileGroups() {
if (fileGroupsBuilder_ == null) {
fileGroups_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
onChanged();
} else {
fileGroupsBuilder_.clear();
}
return this;
}
/**
* <code>repeated .FileChecksumStorageHostChunkLists file_groups = 1;</code>
*/
public Builder removeFileGroups(int index) {
if (fileGroupsBuilder_ == null) {
ensureFileGroupsIsMutable();
fileGroups_.remove(index);
onChanged();
} else {
fileGroupsBuilder_.remove(index);
}
return this;
}
/**
* <code>repeated .FileChecksumStorageHostChunkLists file_groups = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists.Builder getFileGroupsBuilder(
int index) {
return getFileGroupsFieldBuilder().getBuilder(index);
}
/**
* <code>repeated .FileChecksumStorageHostChunkLists file_groups = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkListsOrBuilder getFileGroupsOrBuilder(
int index) {
if (fileGroupsBuilder_ == null) {
return fileGroups_.get(index); } else {
return fileGroupsBuilder_.getMessageOrBuilder(index);
}
}
/**
* <code>repeated .FileChecksumStorageHostChunkLists file_groups = 1;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkListsOrBuilder>
getFileGroupsOrBuilderList() {
if (fileGroupsBuilder_ != null) {
return fileGroupsBuilder_.getMessageOrBuilderList();
} else {
return java.util.Collections.unmodifiableList(fileGroups_);
}
}
/**
* <code>repeated .FileChecksumStorageHostChunkLists file_groups = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists.Builder addFileGroupsBuilder() {
return getFileGroupsFieldBuilder().addBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists.getDefaultInstance());
}
/**
* <code>repeated .FileChecksumStorageHostChunkLists file_groups = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists.Builder addFileGroupsBuilder(
int index) {
return getFileGroupsFieldBuilder().addBuilder(index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists.getDefaultInstance());
}
/**
* <code>repeated .FileChecksumStorageHostChunkLists file_groups = 1;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists.Builder>
getFileGroupsBuilderList() {
return getFileGroupsFieldBuilder().getBuilderList();
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkListsOrBuilder>
getFileGroupsFieldBuilder() {
if (fileGroupsBuilder_ == null) {
fileGroupsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkLists.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChecksumStorageHostChunkListsOrBuilder>(
fileGroups_,
((bitField0_ & 0x00000001) == 0x00000001),
getParentForChildren(),
isClean());
fileGroups_ = null;
}
return fileGroupsBuilder_;
}
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError> fileError_ =
java.util.Collections.emptyList();
private void ensureFileErrorIsMutable() {
if (!((bitField0_ & 0x00000002) == 0x00000002)) {
fileError_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError>(fileError_);
bitField0_ |= 0x00000002;
}
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileErrorOrBuilder> fileErrorBuilder_;
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError> getFileErrorList() {
if (fileErrorBuilder_ == null) {
return java.util.Collections.unmodifiableList(fileError_);
} else {
return fileErrorBuilder_.getMessageList();
}
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public int getFileErrorCount() {
if (fileErrorBuilder_ == null) {
return fileError_.size();
} else {
return fileErrorBuilder_.getCount();
}
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError getFileError(int index) {
if (fileErrorBuilder_ == null) {
return fileError_.get(index);
} else {
return fileErrorBuilder_.getMessage(index);
}
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public Builder setFileError(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError value) {
if (fileErrorBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureFileErrorIsMutable();
fileError_.set(index, value);
onChanged();
} else {
fileErrorBuilder_.setMessage(index, value);
}
return this;
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public Builder setFileError(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError.Builder builderForValue) {
if (fileErrorBuilder_ == null) {
ensureFileErrorIsMutable();
fileError_.set(index, builderForValue.build());
onChanged();
} else {
fileErrorBuilder_.setMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public Builder addFileError(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError value) {
if (fileErrorBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureFileErrorIsMutable();
fileError_.add(value);
onChanged();
} else {
fileErrorBuilder_.addMessage(value);
}
return this;
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public Builder addFileError(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError value) {
if (fileErrorBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureFileErrorIsMutable();
fileError_.add(index, value);
onChanged();
} else {
fileErrorBuilder_.addMessage(index, value);
}
return this;
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public Builder addFileError(
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError.Builder builderForValue) {
if (fileErrorBuilder_ == null) {
ensureFileErrorIsMutable();
fileError_.add(builderForValue.build());
onChanged();
} else {
fileErrorBuilder_.addMessage(builderForValue.build());
}
return this;
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public Builder addFileError(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError.Builder builderForValue) {
if (fileErrorBuilder_ == null) {
ensureFileErrorIsMutable();
fileError_.add(index, builderForValue.build());
onChanged();
} else {
fileErrorBuilder_.addMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public Builder addAllFileError(
java.lang.Iterable<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError> values) {
if (fileErrorBuilder_ == null) {
ensureFileErrorIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, fileError_);
onChanged();
} else {
fileErrorBuilder_.addAllMessages(values);
}
return this;
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public Builder clearFileError() {
if (fileErrorBuilder_ == null) {
fileError_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000002);
onChanged();
} else {
fileErrorBuilder_.clear();
}
return this;
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public Builder removeFileError(int index) {
if (fileErrorBuilder_ == null) {
ensureFileErrorIsMutable();
fileError_.remove(index);
onChanged();
} else {
fileErrorBuilder_.remove(index);
}
return this;
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError.Builder getFileErrorBuilder(
int index) {
return getFileErrorFieldBuilder().getBuilder(index);
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileErrorOrBuilder getFileErrorOrBuilder(
int index) {
if (fileErrorBuilder_ == null) {
return fileError_.get(index); } else {
return fileErrorBuilder_.getMessageOrBuilder(index);
}
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileErrorOrBuilder>
getFileErrorOrBuilderList() {
if (fileErrorBuilder_ != null) {
return fileErrorBuilder_.getMessageOrBuilderList();
} else {
return java.util.Collections.unmodifiableList(fileError_);
}
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError.Builder addFileErrorBuilder() {
return getFileErrorFieldBuilder().addBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError.getDefaultInstance());
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError.Builder addFileErrorBuilder(
int index) {
return getFileErrorFieldBuilder().addBuilder(index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError.getDefaultInstance());
}
/**
* <code>repeated .FileError file_error = 2;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError.Builder>
getFileErrorBuilderList() {
return getFileErrorFieldBuilder().getBuilderList();
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileErrorOrBuilder>
getFileErrorFieldBuilder() {
if (fileErrorBuilder_ == null) {
fileErrorBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileError.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileErrorOrBuilder>(
fileError_,
((bitField0_ & 0x00000002) == 0x00000002),
getParentForChildren(),
isClean());
fileError_ = null;
}
return fileErrorBuilder_;
}
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError> fileChunkError_ =
java.util.Collections.emptyList();
private void ensureFileChunkErrorIsMutable() {
if (!((bitField0_ & 0x00000004) == 0x00000004)) {
fileChunkError_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError>(fileChunkError_);
bitField0_ |= 0x00000004;
}
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkErrorOrBuilder> fileChunkErrorBuilder_;
/**
* <code>repeated .FileChunkError file_chunk_error = 3;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError> getFileChunkErrorList() {
if (fileChunkErrorBuilder_ == null) {
return java.util.Collections.unmodifiableList(fileChunkError_);
} else {
return fileChunkErrorBuilder_.getMessageList();
}
}
/**
* <code>repeated .FileChunkError file_chunk_error = 3;</code>
*/
public int getFileChunkErrorCount() {
if (fileChunkErrorBuilder_ == null) {
return fileChunkError_.size();
} else {
return fileChunkErrorBuilder_.getCount();
}
}
/**
* <code>repeated .FileChunkError file_chunk_error = 3;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError getFileChunkError(int index) {
if (fileChunkErrorBuilder_ == null) {
return fileChunkError_.get(index);
} else {
return fileChunkErrorBuilder_.getMessage(index);
}
}
/**
* <code>repeated .FileChunkError file_chunk_error = 3;</code>
*/
public Builder setFileChunkError(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError value) {
if (fileChunkErrorBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureFileChunkErrorIsMutable();
fileChunkError_.set(index, value);
onChanged();
} else {
fileChunkErrorBuilder_.setMessage(index, value);
}
return this;
}
/**
* <code>repeated .FileChunkError file_chunk_error = 3;</code>
*/
public Builder setFileChunkError(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError.Builder builderForValue) {
if (fileChunkErrorBuilder_ == null) {
ensureFileChunkErrorIsMutable();
fileChunkError_.set(index, builderForValue.build());
onChanged();
} else {
fileChunkErrorBuilder_.setMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .FileChunkError file_chunk_error = 3;</code>
*/
public Builder addFileChunkError(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError value) {
if (fileChunkErrorBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureFileChunkErrorIsMutable();
fileChunkError_.add(value);
onChanged();
} else {
fileChunkErrorBuilder_.addMessage(value);
}
return this;
}
/**
* <code>repeated .FileChunkError file_chunk_error = 3;</code>
*/
public Builder addFileChunkError(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError value) {
if (fileChunkErrorBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureFileChunkErrorIsMutable();
fileChunkError_.add(index, value);
onChanged();
} else {
fileChunkErrorBuilder_.addMessage(index, value);
}
return this;
}
/**
* <code>repeated .FileChunkError file_chunk_error = 3;</code>
*/
public Builder addFileChunkError(
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError.Builder builderForValue) {
if (fileChunkErrorBuilder_ == null) {
ensureFileChunkErrorIsMutable();
fileChunkError_.add(builderForValue.build());
onChanged();
} else {
fileChunkErrorBuilder_.addMessage(builderForValue.build());
}
return this;
}
/**
* <code>repeated .FileChunkError file_chunk_error = 3;</code>
*/
public Builder addFileChunkError(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError.Builder builderForValue) {
if (fileChunkErrorBuilder_ == null) {
ensureFileChunkErrorIsMutable();
fileChunkError_.add(index, builderForValue.build());
onChanged();
} else {
fileChunkErrorBuilder_.addMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .FileChunkError file_chunk_error = 3;</code>
*/
public Builder addAllFileChunkError(
java.lang.Iterable<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError> values) {
if (fileChunkErrorBuilder_ == null) {
ensureFileChunkErrorIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, fileChunkError_);
onChanged();
} else {
fileChunkErrorBuilder_.addAllMessages(values);
}
return this;
}
/**
* <code>repeated .FileChunkError file_chunk_error = 3;</code>
*/
public Builder clearFileChunkError() {
if (fileChunkErrorBuilder_ == null) {
fileChunkError_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000004);
onChanged();
} else {
fileChunkErrorBuilder_.clear();
}
return this;
}
/**
* <code>repeated .FileChunkError file_chunk_error = 3;</code>
*/
public Builder removeFileChunkError(int index) {
if (fileChunkErrorBuilder_ == null) {
ensureFileChunkErrorIsMutable();
fileChunkError_.remove(index);
onChanged();
} else {
fileChunkErrorBuilder_.remove(index);
}
return this;
}
/**
* <code>repeated .FileChunkError file_chunk_error = 3;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError.Builder getFileChunkErrorBuilder(
int index) {
return getFileChunkErrorFieldBuilder().getBuilder(index);
}
/**
* <code>repeated .FileChunkError file_chunk_error = 3;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkErrorOrBuilder getFileChunkErrorOrBuilder(
int index) {
if (fileChunkErrorBuilder_ == null) {
return fileChunkError_.get(index); } else {
return fileChunkErrorBuilder_.getMessageOrBuilder(index);
}
}
/**
* <code>repeated .FileChunkError file_chunk_error = 3;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkErrorOrBuilder>
getFileChunkErrorOrBuilderList() {
if (fileChunkErrorBuilder_ != null) {
return fileChunkErrorBuilder_.getMessageOrBuilderList();
} else {
return java.util.Collections.unmodifiableList(fileChunkError_);
}
}
/**
* <code>repeated .FileChunkError file_chunk_error = 3;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError.Builder addFileChunkErrorBuilder() {
return getFileChunkErrorFieldBuilder().addBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError.getDefaultInstance());
}
/**
* <code>repeated .FileChunkError file_chunk_error = 3;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError.Builder addFileChunkErrorBuilder(
int index) {
return getFileChunkErrorFieldBuilder().addBuilder(index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError.getDefaultInstance());
}
/**
* <code>repeated .FileChunkError file_chunk_error = 3;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError.Builder>
getFileChunkErrorBuilderList() {
return getFileChunkErrorFieldBuilder().getBuilderList();
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkErrorOrBuilder>
getFileChunkErrorFieldBuilder() {
if (fileChunkErrorBuilder_ == null) {
fileChunkErrorBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkError.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.FileChunkErrorOrBuilder>(
fileChunkError_,
((bitField0_ & 0x00000004) == 0x00000004),
getParentForChildren(),
isClean());
fileChunkError_ = null;
}
return fileChunkErrorBuilder_;
}
private int verbosityLevel_ ;
/**
* <code>optional uint32 verbosity_level = 4;</code>
*/
public boolean hasVerbosityLevel() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>optional uint32 verbosity_level = 4;</code>
*/
public int getVerbosityLevel() {
return verbosityLevel_;
}
/**
* <code>optional uint32 verbosity_level = 4;</code>
*/
public Builder setVerbosityLevel(int value) {
bitField0_ |= 0x00000008;
verbosityLevel_ = value;
onChanged();
return this;
}
/**
* <code>optional uint32 verbosity_level = 4;</code>
*/
public Builder clearVerbosityLevel() {
bitField0_ = (bitField0_ & ~0x00000008);
verbosityLevel_ = 0;
onChanged();
return this;
}
// @@protoc_insertion_point(builder_scope:FileGroups)
}
static {
defaultInstance = new FileGroups(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:FileGroups)
}
public interface ChunkChecksumListOrBuilder extends
// @@protoc_insertion_point(interface_extends:ChunkChecksumList)
com.google.protobuf.MessageOrBuilder {
/**
* <code>repeated bytes chunk_checksum = 1;</code>
*/
java.util.List<com.google.protobuf.ByteString> getChunkChecksumList();
/**
* <code>repeated bytes chunk_checksum = 1;</code>
*/
int getChunkChecksumCount();
/**
* <code>repeated bytes chunk_checksum = 1;</code>
*/
com.google.protobuf.ByteString getChunkChecksum(int index);
}
/**
* Protobuf type {@code ChunkChecksumList}
*/
public static final class ChunkChecksumList extends
com.google.protobuf.GeneratedMessage implements
// @@protoc_insertion_point(message_implements:ChunkChecksumList)
ChunkChecksumListOrBuilder {
// Use ChunkChecksumList.newBuilder() to construct.
private ChunkChecksumList(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private ChunkChecksumList(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final ChunkChecksumList defaultInstance;
public static ChunkChecksumList getDefaultInstance() {
return defaultInstance;
}
public ChunkChecksumList getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private ChunkChecksumList(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
chunkChecksum_ = new java.util.ArrayList<com.google.protobuf.ByteString>();
mutable_bitField0_ |= 0x00000001;
}
chunkChecksum_.add(input.readBytes());
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
chunkChecksum_ = java.util.Collections.unmodifiableList(chunkChecksum_);
}
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_ChunkChecksumList_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_ChunkChecksumList_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkChecksumList.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkChecksumList.Builder.class);
}
public static com.google.protobuf.Parser<ChunkChecksumList> PARSER =
new com.google.protobuf.AbstractParser<ChunkChecksumList>() {
public ChunkChecksumList parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new ChunkChecksumList(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<ChunkChecksumList> getParserForType() {
return PARSER;
}
public static final int CHUNK_CHECKSUM_FIELD_NUMBER = 1;
private java.util.List<com.google.protobuf.ByteString> chunkChecksum_;
/**
* <code>repeated bytes chunk_checksum = 1;</code>
*/
public java.util.List<com.google.protobuf.ByteString>
getChunkChecksumList() {
return chunkChecksum_;
}
/**
* <code>repeated bytes chunk_checksum = 1;</code>
*/
public int getChunkChecksumCount() {
return chunkChecksum_.size();
}
/**
* <code>repeated bytes chunk_checksum = 1;</code>
*/
public com.google.protobuf.ByteString getChunkChecksum(int index) {
return chunkChecksum_.get(index);
}
private void initFields() {
chunkChecksum_ = java.util.Collections.emptyList();
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
for (int i = 0; i < chunkChecksum_.size(); i++) {
output.writeBytes(1, chunkChecksum_.get(i));
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
{
int dataSize = 0;
for (int i = 0; i < chunkChecksum_.size(); i++) {
dataSize += com.google.protobuf.CodedOutputStream
.computeBytesSizeNoTag(chunkChecksum_.get(i));
}
size += dataSize;
size += 1 * getChunkChecksumList().size();
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkChecksumList parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkChecksumList parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkChecksumList parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkChecksumList parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkChecksumList parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkChecksumList parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkChecksumList parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkChecksumList parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkChecksumList parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkChecksumList parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkChecksumList prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code ChunkChecksumList}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:ChunkChecksumList)
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkChecksumListOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_ChunkChecksumList_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_ChunkChecksumList_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkChecksumList.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkChecksumList.Builder.class);
}
// Construct using com.github.horrorho.inflatabledonkey.protocol.ChunkServer.ChunkChecksumList.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
chunkChecksum_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_ChunkChecksumList_descriptor;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkChecksumList getDefaultInstanceForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkChecksumList.getDefaultInstance();
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkChecksumList build() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkChecksumList result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkChecksumList buildPartial() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkChecksumList result = new com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkChecksumList(this);
int from_bitField0_ = bitField0_;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
chunkChecksum_ = java.util.Collections.unmodifiableList(chunkChecksum_);
bitField0_ = (bitField0_ & ~0x00000001);
}
result.chunkChecksum_ = chunkChecksum_;
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkChecksumList) {
return mergeFrom((com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkChecksumList)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkChecksumList other) {
if (other == com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkChecksumList.getDefaultInstance()) return this;
if (!other.chunkChecksum_.isEmpty()) {
if (chunkChecksum_.isEmpty()) {
chunkChecksum_ = other.chunkChecksum_;
bitField0_ = (bitField0_ & ~0x00000001);
} else {
ensureChunkChecksumIsMutable();
chunkChecksum_.addAll(other.chunkChecksum_);
}
onChanged();
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkChecksumList parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkChecksumList) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private java.util.List<com.google.protobuf.ByteString> chunkChecksum_ = java.util.Collections.emptyList();
private void ensureChunkChecksumIsMutable() {
if (!((bitField0_ & 0x00000001) == 0x00000001)) {
chunkChecksum_ = new java.util.ArrayList<com.google.protobuf.ByteString>(chunkChecksum_);
bitField0_ |= 0x00000001;
}
}
/**
* <code>repeated bytes chunk_checksum = 1;</code>
*/
public java.util.List<com.google.protobuf.ByteString>
getChunkChecksumList() {
return java.util.Collections.unmodifiableList(chunkChecksum_);
}
/**
* <code>repeated bytes chunk_checksum = 1;</code>
*/
public int getChunkChecksumCount() {
return chunkChecksum_.size();
}
/**
* <code>repeated bytes chunk_checksum = 1;</code>
*/
public com.google.protobuf.ByteString getChunkChecksum(int index) {
return chunkChecksum_.get(index);
}
/**
* <code>repeated bytes chunk_checksum = 1;</code>
*/
public Builder setChunkChecksum(
int index, com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
ensureChunkChecksumIsMutable();
chunkChecksum_.set(index, value);
onChanged();
return this;
}
/**
* <code>repeated bytes chunk_checksum = 1;</code>
*/
public Builder addChunkChecksum(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
ensureChunkChecksumIsMutable();
chunkChecksum_.add(value);
onChanged();
return this;
}
/**
* <code>repeated bytes chunk_checksum = 1;</code>
*/
public Builder addAllChunkChecksum(
java.lang.Iterable<? extends com.google.protobuf.ByteString> values) {
ensureChunkChecksumIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, chunkChecksum_);
onChanged();
return this;
}
/**
* <code>repeated bytes chunk_checksum = 1;</code>
*/
public Builder clearChunkChecksum() {
chunkChecksum_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
onChanged();
return this;
}
// @@protoc_insertion_point(builder_scope:ChunkChecksumList)
}
static {
defaultInstance = new ChunkChecksumList(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:ChunkChecksumList)
}
public interface StorageHostChunkListOrBuilder extends
// @@protoc_insertion_point(interface_extends:StorageHostChunkList)
com.google.protobuf.MessageOrBuilder {
/**
* <code>required .HostInfo host_info = 1;</code>
*/
boolean hasHostInfo();
/**
* <code>required .HostInfo host_info = 1;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo getHostInfo();
/**
* <code>required .HostInfo host_info = 1;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfoOrBuilder getHostInfoOrBuilder();
/**
* <code>repeated .ChunkInfo chunk_info = 2;</code>
*/
java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo>
getChunkInfoList();
/**
* <code>repeated .ChunkInfo chunk_info = 2;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo getChunkInfo(int index);
/**
* <code>repeated .ChunkInfo chunk_info = 2;</code>
*/
int getChunkInfoCount();
/**
* <code>repeated .ChunkInfo chunk_info = 2;</code>
*/
java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfoOrBuilder>
getChunkInfoOrBuilderList();
/**
* <code>repeated .ChunkInfo chunk_info = 2;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfoOrBuilder getChunkInfoOrBuilder(
int index);
/**
* <code>required string storage_container_key = 3;</code>
*/
boolean hasStorageContainerKey();
/**
* <code>required string storage_container_key = 3;</code>
*/
java.lang.String getStorageContainerKey();
/**
* <code>required string storage_container_key = 3;</code>
*/
com.google.protobuf.ByteString
getStorageContainerKeyBytes();
/**
* <code>required string storage_container_authorization_token = 4;</code>
*/
boolean hasStorageContainerAuthorizationToken();
/**
* <code>required string storage_container_authorization_token = 4;</code>
*/
java.lang.String getStorageContainerAuthorizationToken();
/**
* <code>required string storage_container_authorization_token = 4;</code>
*/
com.google.protobuf.ByteString
getStorageContainerAuthorizationTokenBytes();
}
/**
* Protobuf type {@code StorageHostChunkList}
*/
public static final class StorageHostChunkList extends
com.google.protobuf.GeneratedMessage implements
// @@protoc_insertion_point(message_implements:StorageHostChunkList)
StorageHostChunkListOrBuilder {
// Use StorageHostChunkList.newBuilder() to construct.
private StorageHostChunkList(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private StorageHostChunkList(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final StorageHostChunkList defaultInstance;
public static StorageHostChunkList getDefaultInstance() {
return defaultInstance;
}
public StorageHostChunkList getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private StorageHostChunkList(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo.Builder subBuilder = null;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
subBuilder = hostInfo_.toBuilder();
}
hostInfo_ = input.readMessage(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(hostInfo_);
hostInfo_ = subBuilder.buildPartial();
}
bitField0_ |= 0x00000001;
break;
}
case 18: {
if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
chunkInfo_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo>();
mutable_bitField0_ |= 0x00000002;
}
chunkInfo_.add(input.readMessage(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo.PARSER, extensionRegistry));
break;
}
case 26: {
com.google.protobuf.ByteString bs = input.readBytes();
bitField0_ |= 0x00000002;
storageContainerKey_ = bs;
break;
}
case 34: {
com.google.protobuf.ByteString bs = input.readBytes();
bitField0_ |= 0x00000004;
storageContainerAuthorizationToken_ = bs;
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
chunkInfo_ = java.util.Collections.unmodifiableList(chunkInfo_);
}
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_StorageHostChunkList_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_StorageHostChunkList_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList.Builder.class);
}
public static com.google.protobuf.Parser<StorageHostChunkList> PARSER =
new com.google.protobuf.AbstractParser<StorageHostChunkList>() {
public StorageHostChunkList parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new StorageHostChunkList(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<StorageHostChunkList> getParserForType() {
return PARSER;
}
private int bitField0_;
public static final int HOST_INFO_FIELD_NUMBER = 1;
private com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo hostInfo_;
/**
* <code>required .HostInfo host_info = 1;</code>
*/
public boolean hasHostInfo() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required .HostInfo host_info = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo getHostInfo() {
return hostInfo_;
}
/**
* <code>required .HostInfo host_info = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfoOrBuilder getHostInfoOrBuilder() {
return hostInfo_;
}
public static final int CHUNK_INFO_FIELD_NUMBER = 2;
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo> chunkInfo_;
/**
* <code>repeated .ChunkInfo chunk_info = 2;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo> getChunkInfoList() {
return chunkInfo_;
}
/**
* <code>repeated .ChunkInfo chunk_info = 2;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfoOrBuilder>
getChunkInfoOrBuilderList() {
return chunkInfo_;
}
/**
* <code>repeated .ChunkInfo chunk_info = 2;</code>
*/
public int getChunkInfoCount() {
return chunkInfo_.size();
}
/**
* <code>repeated .ChunkInfo chunk_info = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo getChunkInfo(int index) {
return chunkInfo_.get(index);
}
/**
* <code>repeated .ChunkInfo chunk_info = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfoOrBuilder getChunkInfoOrBuilder(
int index) {
return chunkInfo_.get(index);
}
public static final int STORAGE_CONTAINER_KEY_FIELD_NUMBER = 3;
private java.lang.Object storageContainerKey_;
/**
* <code>required string storage_container_key = 3;</code>
*/
public boolean hasStorageContainerKey() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required string storage_container_key = 3;</code>
*/
public java.lang.String getStorageContainerKey() {
java.lang.Object ref = storageContainerKey_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
storageContainerKey_ = s;
}
return s;
}
}
/**
* <code>required string storage_container_key = 3;</code>
*/
public com.google.protobuf.ByteString
getStorageContainerKeyBytes() {
java.lang.Object ref = storageContainerKey_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
storageContainerKey_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int STORAGE_CONTAINER_AUTHORIZATION_TOKEN_FIELD_NUMBER = 4;
private java.lang.Object storageContainerAuthorizationToken_;
/**
* <code>required string storage_container_authorization_token = 4;</code>
*/
public boolean hasStorageContainerAuthorizationToken() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>required string storage_container_authorization_token = 4;</code>
*/
public java.lang.String getStorageContainerAuthorizationToken() {
java.lang.Object ref = storageContainerAuthorizationToken_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
storageContainerAuthorizationToken_ = s;
}
return s;
}
}
/**
* <code>required string storage_container_authorization_token = 4;</code>
*/
public com.google.protobuf.ByteString
getStorageContainerAuthorizationTokenBytes() {
java.lang.Object ref = storageContainerAuthorizationToken_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
storageContainerAuthorizationToken_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
private void initFields() {
hostInfo_ = com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo.getDefaultInstance();
chunkInfo_ = java.util.Collections.emptyList();
storageContainerKey_ = "";
storageContainerAuthorizationToken_ = "";
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
if (!hasHostInfo()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasStorageContainerKey()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasStorageContainerAuthorizationToken()) {
memoizedIsInitialized = 0;
return false;
}
if (!getHostInfo().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
for (int i = 0; i < getChunkInfoCount(); i++) {
if (!getChunkInfo(i).isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeMessage(1, hostInfo_);
}
for (int i = 0; i < chunkInfo_.size(); i++) {
output.writeMessage(2, chunkInfo_.get(i));
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeBytes(3, getStorageContainerKeyBytes());
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
output.writeBytes(4, getStorageContainerAuthorizationTokenBytes());
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(1, hostInfo_);
}
for (int i = 0; i < chunkInfo_.size(); i++) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(2, chunkInfo_.get(i));
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(3, getStorageContainerKeyBytes());
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(4, getStorageContainerAuthorizationTokenBytes());
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code StorageHostChunkList}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:StorageHostChunkList)
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkListOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_StorageHostChunkList_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_StorageHostChunkList_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList.Builder.class);
}
// Construct using com.github.horrorho.inflatabledonkey.protocol.ChunkServer.StorageHostChunkList.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
getHostInfoFieldBuilder();
getChunkInfoFieldBuilder();
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
if (hostInfoBuilder_ == null) {
hostInfo_ = com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo.getDefaultInstance();
} else {
hostInfoBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00000001);
if (chunkInfoBuilder_ == null) {
chunkInfo_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000002);
} else {
chunkInfoBuilder_.clear();
}
storageContainerKey_ = "";
bitField0_ = (bitField0_ & ~0x00000004);
storageContainerAuthorizationToken_ = "";
bitField0_ = (bitField0_ & ~0x00000008);
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_StorageHostChunkList_descriptor;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList getDefaultInstanceForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList.getDefaultInstance();
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList build() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList buildPartial() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList result = new com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
if (hostInfoBuilder_ == null) {
result.hostInfo_ = hostInfo_;
} else {
result.hostInfo_ = hostInfoBuilder_.build();
}
if (chunkInfoBuilder_ == null) {
if (((bitField0_ & 0x00000002) == 0x00000002)) {
chunkInfo_ = java.util.Collections.unmodifiableList(chunkInfo_);
bitField0_ = (bitField0_ & ~0x00000002);
}
result.chunkInfo_ = chunkInfo_;
} else {
result.chunkInfo_ = chunkInfoBuilder_.build();
}
if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
to_bitField0_ |= 0x00000002;
}
result.storageContainerKey_ = storageContainerKey_;
if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
to_bitField0_ |= 0x00000004;
}
result.storageContainerAuthorizationToken_ = storageContainerAuthorizationToken_;
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList) {
return mergeFrom((com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList other) {
if (other == com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList.getDefaultInstance()) return this;
if (other.hasHostInfo()) {
mergeHostInfo(other.getHostInfo());
}
if (chunkInfoBuilder_ == null) {
if (!other.chunkInfo_.isEmpty()) {
if (chunkInfo_.isEmpty()) {
chunkInfo_ = other.chunkInfo_;
bitField0_ = (bitField0_ & ~0x00000002);
} else {
ensureChunkInfoIsMutable();
chunkInfo_.addAll(other.chunkInfo_);
}
onChanged();
}
} else {
if (!other.chunkInfo_.isEmpty()) {
if (chunkInfoBuilder_.isEmpty()) {
chunkInfoBuilder_.dispose();
chunkInfoBuilder_ = null;
chunkInfo_ = other.chunkInfo_;
bitField0_ = (bitField0_ & ~0x00000002);
chunkInfoBuilder_ =
com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
getChunkInfoFieldBuilder() : null;
} else {
chunkInfoBuilder_.addAllMessages(other.chunkInfo_);
}
}
}
if (other.hasStorageContainerKey()) {
bitField0_ |= 0x00000004;
storageContainerKey_ = other.storageContainerKey_;
onChanged();
}
if (other.hasStorageContainerAuthorizationToken()) {
bitField0_ |= 0x00000008;
storageContainerAuthorizationToken_ = other.storageContainerAuthorizationToken_;
onChanged();
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
if (!hasHostInfo()) {
return false;
}
if (!hasStorageContainerKey()) {
return false;
}
if (!hasStorageContainerAuthorizationToken()) {
return false;
}
if (!getHostInfo().isInitialized()) {
return false;
}
for (int i = 0; i < getChunkInfoCount(); i++) {
if (!getChunkInfo(i).isInitialized()) {
return false;
}
}
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo hostInfo_ = com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo.getDefaultInstance();
private com.google.protobuf.SingleFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfoOrBuilder> hostInfoBuilder_;
/**
* <code>required .HostInfo host_info = 1;</code>
*/
public boolean hasHostInfo() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required .HostInfo host_info = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo getHostInfo() {
if (hostInfoBuilder_ == null) {
return hostInfo_;
} else {
return hostInfoBuilder_.getMessage();
}
}
/**
* <code>required .HostInfo host_info = 1;</code>
*/
public Builder setHostInfo(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo value) {
if (hostInfoBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
hostInfo_ = value;
onChanged();
} else {
hostInfoBuilder_.setMessage(value);
}
bitField0_ |= 0x00000001;
return this;
}
/**
* <code>required .HostInfo host_info = 1;</code>
*/
public Builder setHostInfo(
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo.Builder builderForValue) {
if (hostInfoBuilder_ == null) {
hostInfo_ = builderForValue.build();
onChanged();
} else {
hostInfoBuilder_.setMessage(builderForValue.build());
}
bitField0_ |= 0x00000001;
return this;
}
/**
* <code>required .HostInfo host_info = 1;</code>
*/
public Builder mergeHostInfo(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo value) {
if (hostInfoBuilder_ == null) {
if (((bitField0_ & 0x00000001) == 0x00000001) &&
hostInfo_ != com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo.getDefaultInstance()) {
hostInfo_ =
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo.newBuilder(hostInfo_).mergeFrom(value).buildPartial();
} else {
hostInfo_ = value;
}
onChanged();
} else {
hostInfoBuilder_.mergeFrom(value);
}
bitField0_ |= 0x00000001;
return this;
}
/**
* <code>required .HostInfo host_info = 1;</code>
*/
public Builder clearHostInfo() {
if (hostInfoBuilder_ == null) {
hostInfo_ = com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo.getDefaultInstance();
onChanged();
} else {
hostInfoBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00000001);
return this;
}
/**
* <code>required .HostInfo host_info = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo.Builder getHostInfoBuilder() {
bitField0_ |= 0x00000001;
onChanged();
return getHostInfoFieldBuilder().getBuilder();
}
/**
* <code>required .HostInfo host_info = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfoOrBuilder getHostInfoOrBuilder() {
if (hostInfoBuilder_ != null) {
return hostInfoBuilder_.getMessageOrBuilder();
} else {
return hostInfo_;
}
}
/**
* <code>required .HostInfo host_info = 1;</code>
*/
private com.google.protobuf.SingleFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfoOrBuilder>
getHostInfoFieldBuilder() {
if (hostInfoBuilder_ == null) {
hostInfoBuilder_ = new com.google.protobuf.SingleFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfo.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.HostInfoOrBuilder>(
getHostInfo(),
getParentForChildren(),
isClean());
hostInfo_ = null;
}
return hostInfoBuilder_;
}
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo> chunkInfo_ =
java.util.Collections.emptyList();
private void ensureChunkInfoIsMutable() {
if (!((bitField0_ & 0x00000002) == 0x00000002)) {
chunkInfo_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo>(chunkInfo_);
bitField0_ |= 0x00000002;
}
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfoOrBuilder> chunkInfoBuilder_;
/**
* <code>repeated .ChunkInfo chunk_info = 2;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo> getChunkInfoList() {
if (chunkInfoBuilder_ == null) {
return java.util.Collections.unmodifiableList(chunkInfo_);
} else {
return chunkInfoBuilder_.getMessageList();
}
}
/**
* <code>repeated .ChunkInfo chunk_info = 2;</code>
*/
public int getChunkInfoCount() {
if (chunkInfoBuilder_ == null) {
return chunkInfo_.size();
} else {
return chunkInfoBuilder_.getCount();
}
}
/**
* <code>repeated .ChunkInfo chunk_info = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo getChunkInfo(int index) {
if (chunkInfoBuilder_ == null) {
return chunkInfo_.get(index);
} else {
return chunkInfoBuilder_.getMessage(index);
}
}
/**
* <code>repeated .ChunkInfo chunk_info = 2;</code>
*/
public Builder setChunkInfo(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo value) {
if (chunkInfoBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureChunkInfoIsMutable();
chunkInfo_.set(index, value);
onChanged();
} else {
chunkInfoBuilder_.setMessage(index, value);
}
return this;
}
/**
* <code>repeated .ChunkInfo chunk_info = 2;</code>
*/
public Builder setChunkInfo(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo.Builder builderForValue) {
if (chunkInfoBuilder_ == null) {
ensureChunkInfoIsMutable();
chunkInfo_.set(index, builderForValue.build());
onChanged();
} else {
chunkInfoBuilder_.setMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .ChunkInfo chunk_info = 2;</code>
*/
public Builder addChunkInfo(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo value) {
if (chunkInfoBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureChunkInfoIsMutable();
chunkInfo_.add(value);
onChanged();
} else {
chunkInfoBuilder_.addMessage(value);
}
return this;
}
/**
* <code>repeated .ChunkInfo chunk_info = 2;</code>
*/
public Builder addChunkInfo(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo value) {
if (chunkInfoBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureChunkInfoIsMutable();
chunkInfo_.add(index, value);
onChanged();
} else {
chunkInfoBuilder_.addMessage(index, value);
}
return this;
}
/**
* <code>repeated .ChunkInfo chunk_info = 2;</code>
*/
public Builder addChunkInfo(
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo.Builder builderForValue) {
if (chunkInfoBuilder_ == null) {
ensureChunkInfoIsMutable();
chunkInfo_.add(builderForValue.build());
onChanged();
} else {
chunkInfoBuilder_.addMessage(builderForValue.build());
}
return this;
}
/**
* <code>repeated .ChunkInfo chunk_info = 2;</code>
*/
public Builder addChunkInfo(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo.Builder builderForValue) {
if (chunkInfoBuilder_ == null) {
ensureChunkInfoIsMutable();
chunkInfo_.add(index, builderForValue.build());
onChanged();
} else {
chunkInfoBuilder_.addMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .ChunkInfo chunk_info = 2;</code>
*/
public Builder addAllChunkInfo(
java.lang.Iterable<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo> values) {
if (chunkInfoBuilder_ == null) {
ensureChunkInfoIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, chunkInfo_);
onChanged();
} else {
chunkInfoBuilder_.addAllMessages(values);
}
return this;
}
/**
* <code>repeated .ChunkInfo chunk_info = 2;</code>
*/
public Builder clearChunkInfo() {
if (chunkInfoBuilder_ == null) {
chunkInfo_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000002);
onChanged();
} else {
chunkInfoBuilder_.clear();
}
return this;
}
/**
* <code>repeated .ChunkInfo chunk_info = 2;</code>
*/
public Builder removeChunkInfo(int index) {
if (chunkInfoBuilder_ == null) {
ensureChunkInfoIsMutable();
chunkInfo_.remove(index);
onChanged();
} else {
chunkInfoBuilder_.remove(index);
}
return this;
}
/**
* <code>repeated .ChunkInfo chunk_info = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo.Builder getChunkInfoBuilder(
int index) {
return getChunkInfoFieldBuilder().getBuilder(index);
}
/**
* <code>repeated .ChunkInfo chunk_info = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfoOrBuilder getChunkInfoOrBuilder(
int index) {
if (chunkInfoBuilder_ == null) {
return chunkInfo_.get(index); } else {
return chunkInfoBuilder_.getMessageOrBuilder(index);
}
}
/**
* <code>repeated .ChunkInfo chunk_info = 2;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfoOrBuilder>
getChunkInfoOrBuilderList() {
if (chunkInfoBuilder_ != null) {
return chunkInfoBuilder_.getMessageOrBuilderList();
} else {
return java.util.Collections.unmodifiableList(chunkInfo_);
}
}
/**
* <code>repeated .ChunkInfo chunk_info = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo.Builder addChunkInfoBuilder() {
return getChunkInfoFieldBuilder().addBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo.getDefaultInstance());
}
/**
* <code>repeated .ChunkInfo chunk_info = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo.Builder addChunkInfoBuilder(
int index) {
return getChunkInfoFieldBuilder().addBuilder(index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo.getDefaultInstance());
}
/**
* <code>repeated .ChunkInfo chunk_info = 2;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo.Builder>
getChunkInfoBuilderList() {
return getChunkInfoFieldBuilder().getBuilderList();
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfoOrBuilder>
getChunkInfoFieldBuilder() {
if (chunkInfoBuilder_ == null) {
chunkInfoBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfo.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkInfoOrBuilder>(
chunkInfo_,
((bitField0_ & 0x00000002) == 0x00000002),
getParentForChildren(),
isClean());
chunkInfo_ = null;
}
return chunkInfoBuilder_;
}
private java.lang.Object storageContainerKey_ = "";
/**
* <code>required string storage_container_key = 3;</code>
*/
public boolean hasStorageContainerKey() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>required string storage_container_key = 3;</code>
*/
public java.lang.String getStorageContainerKey() {
java.lang.Object ref = storageContainerKey_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
storageContainerKey_ = s;
}
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>required string storage_container_key = 3;</code>
*/
public com.google.protobuf.ByteString
getStorageContainerKeyBytes() {
java.lang.Object ref = storageContainerKey_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
storageContainerKey_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>required string storage_container_key = 3;</code>
*/
public Builder setStorageContainerKey(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000004;
storageContainerKey_ = value;
onChanged();
return this;
}
/**
* <code>required string storage_container_key = 3;</code>
*/
public Builder clearStorageContainerKey() {
bitField0_ = (bitField0_ & ~0x00000004);
storageContainerKey_ = getDefaultInstance().getStorageContainerKey();
onChanged();
return this;
}
/**
* <code>required string storage_container_key = 3;</code>
*/
public Builder setStorageContainerKeyBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000004;
storageContainerKey_ = value;
onChanged();
return this;
}
private java.lang.Object storageContainerAuthorizationToken_ = "";
/**
* <code>required string storage_container_authorization_token = 4;</code>
*/
public boolean hasStorageContainerAuthorizationToken() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>required string storage_container_authorization_token = 4;</code>
*/
public java.lang.String getStorageContainerAuthorizationToken() {
java.lang.Object ref = storageContainerAuthorizationToken_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
storageContainerAuthorizationToken_ = s;
}
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>required string storage_container_authorization_token = 4;</code>
*/
public com.google.protobuf.ByteString
getStorageContainerAuthorizationTokenBytes() {
java.lang.Object ref = storageContainerAuthorizationToken_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
storageContainerAuthorizationToken_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>required string storage_container_authorization_token = 4;</code>
*/
public Builder setStorageContainerAuthorizationToken(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000008;
storageContainerAuthorizationToken_ = value;
onChanged();
return this;
}
/**
* <code>required string storage_container_authorization_token = 4;</code>
*/
public Builder clearStorageContainerAuthorizationToken() {
bitField0_ = (bitField0_ & ~0x00000008);
storageContainerAuthorizationToken_ = getDefaultInstance().getStorageContainerAuthorizationToken();
onChanged();
return this;
}
/**
* <code>required string storage_container_authorization_token = 4;</code>
*/
public Builder setStorageContainerAuthorizationTokenBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000008;
storageContainerAuthorizationToken_ = value;
onChanged();
return this;
}
// @@protoc_insertion_point(builder_scope:StorageHostChunkList)
}
static {
defaultInstance = new StorageHostChunkList(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:StorageHostChunkList)
}
public interface StorageHostChunkListsOrBuilder extends
// @@protoc_insertion_point(interface_extends:StorageHostChunkLists)
com.google.protobuf.MessageOrBuilder {
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList>
getStorageHostChunkListList();
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList getStorageHostChunkList(int index);
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
int getStorageHostChunkListCount();
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkListOrBuilder>
getStorageHostChunkListOrBuilderList();
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkListOrBuilder getStorageHostChunkListOrBuilder(
int index);
/**
* <code>repeated .ChunkError chunk_error = 2;</code>
*/
java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError>
getChunkErrorList();
/**
* <code>repeated .ChunkError chunk_error = 2;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError getChunkError(int index);
/**
* <code>repeated .ChunkError chunk_error = 2;</code>
*/
int getChunkErrorCount();
/**
* <code>repeated .ChunkError chunk_error = 2;</code>
*/
java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorOrBuilder>
getChunkErrorOrBuilderList();
/**
* <code>repeated .ChunkError chunk_error = 2;</code>
*/
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorOrBuilder getChunkErrorOrBuilder(
int index);
}
/**
* Protobuf type {@code StorageHostChunkLists}
*/
public static final class StorageHostChunkLists extends
com.google.protobuf.GeneratedMessage implements
// @@protoc_insertion_point(message_implements:StorageHostChunkLists)
StorageHostChunkListsOrBuilder {
// Use StorageHostChunkLists.newBuilder() to construct.
private StorageHostChunkLists(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private StorageHostChunkLists(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final StorageHostChunkLists defaultInstance;
public static StorageHostChunkLists getDefaultInstance() {
return defaultInstance;
}
public StorageHostChunkLists getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private StorageHostChunkLists(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
storageHostChunkList_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList>();
mutable_bitField0_ |= 0x00000001;
}
storageHostChunkList_.add(input.readMessage(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList.PARSER, extensionRegistry));
break;
}
case 18: {
if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
chunkError_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError>();
mutable_bitField0_ |= 0x00000002;
}
chunkError_.add(input.readMessage(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError.PARSER, extensionRegistry));
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
storageHostChunkList_ = java.util.Collections.unmodifiableList(storageHostChunkList_);
}
if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
chunkError_ = java.util.Collections.unmodifiableList(chunkError_);
}
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_StorageHostChunkLists_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_StorageHostChunkLists_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkLists.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkLists.Builder.class);
}
public static com.google.protobuf.Parser<StorageHostChunkLists> PARSER =
new com.google.protobuf.AbstractParser<StorageHostChunkLists>() {
public StorageHostChunkLists parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new StorageHostChunkLists(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<StorageHostChunkLists> getParserForType() {
return PARSER;
}
public static final int STORAGE_HOST_CHUNK_LIST_FIELD_NUMBER = 1;
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList> storageHostChunkList_;
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList> getStorageHostChunkListList() {
return storageHostChunkList_;
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkListOrBuilder>
getStorageHostChunkListOrBuilderList() {
return storageHostChunkList_;
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public int getStorageHostChunkListCount() {
return storageHostChunkList_.size();
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList getStorageHostChunkList(int index) {
return storageHostChunkList_.get(index);
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkListOrBuilder getStorageHostChunkListOrBuilder(
int index) {
return storageHostChunkList_.get(index);
}
public static final int CHUNK_ERROR_FIELD_NUMBER = 2;
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError> chunkError_;
/**
* <code>repeated .ChunkError chunk_error = 2;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError> getChunkErrorList() {
return chunkError_;
}
/**
* <code>repeated .ChunkError chunk_error = 2;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorOrBuilder>
getChunkErrorOrBuilderList() {
return chunkError_;
}
/**
* <code>repeated .ChunkError chunk_error = 2;</code>
*/
public int getChunkErrorCount() {
return chunkError_.size();
}
/**
* <code>repeated .ChunkError chunk_error = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError getChunkError(int index) {
return chunkError_.get(index);
}
/**
* <code>repeated .ChunkError chunk_error = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorOrBuilder getChunkErrorOrBuilder(
int index) {
return chunkError_.get(index);
}
private void initFields() {
storageHostChunkList_ = java.util.Collections.emptyList();
chunkError_ = java.util.Collections.emptyList();
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
for (int i = 0; i < getStorageHostChunkListCount(); i++) {
if (!getStorageHostChunkList(i).isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
for (int i = 0; i < getChunkErrorCount(); i++) {
if (!getChunkError(i).isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
for (int i = 0; i < storageHostChunkList_.size(); i++) {
output.writeMessage(1, storageHostChunkList_.get(i));
}
for (int i = 0; i < chunkError_.size(); i++) {
output.writeMessage(2, chunkError_.get(i));
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
for (int i = 0; i < storageHostChunkList_.size(); i++) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(1, storageHostChunkList_.get(i));
}
for (int i = 0; i < chunkError_.size(); i++) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(2, chunkError_.get(i));
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkLists parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkLists parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkLists parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkLists parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkLists parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkLists parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkLists parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkLists parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkLists parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkLists parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkLists prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code StorageHostChunkLists}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:StorageHostChunkLists)
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkListsOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_StorageHostChunkLists_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_StorageHostChunkLists_fieldAccessorTable
.ensureFieldAccessorsInitialized(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkLists.class, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkLists.Builder.class);
}
// Construct using com.github.horrorho.inflatabledonkey.protocol.ChunkServer.StorageHostChunkLists.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
getStorageHostChunkListFieldBuilder();
getChunkErrorFieldBuilder();
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
if (storageHostChunkListBuilder_ == null) {
storageHostChunkList_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
} else {
storageHostChunkListBuilder_.clear();
}
if (chunkErrorBuilder_ == null) {
chunkError_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000002);
} else {
chunkErrorBuilder_.clear();
}
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.internal_static_StorageHostChunkLists_descriptor;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkLists getDefaultInstanceForType() {
return com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkLists.getDefaultInstance();
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkLists build() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkLists result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkLists buildPartial() {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkLists result = new com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkLists(this);
int from_bitField0_ = bitField0_;
if (storageHostChunkListBuilder_ == null) {
if (((bitField0_ & 0x00000001) == 0x00000001)) {
storageHostChunkList_ = java.util.Collections.unmodifiableList(storageHostChunkList_);
bitField0_ = (bitField0_ & ~0x00000001);
}
result.storageHostChunkList_ = storageHostChunkList_;
} else {
result.storageHostChunkList_ = storageHostChunkListBuilder_.build();
}
if (chunkErrorBuilder_ == null) {
if (((bitField0_ & 0x00000002) == 0x00000002)) {
chunkError_ = java.util.Collections.unmodifiableList(chunkError_);
bitField0_ = (bitField0_ & ~0x00000002);
}
result.chunkError_ = chunkError_;
} else {
result.chunkError_ = chunkErrorBuilder_.build();
}
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkLists) {
return mergeFrom((com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkLists)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkLists other) {
if (other == com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkLists.getDefaultInstance()) return this;
if (storageHostChunkListBuilder_ == null) {
if (!other.storageHostChunkList_.isEmpty()) {
if (storageHostChunkList_.isEmpty()) {
storageHostChunkList_ = other.storageHostChunkList_;
bitField0_ = (bitField0_ & ~0x00000001);
} else {
ensureStorageHostChunkListIsMutable();
storageHostChunkList_.addAll(other.storageHostChunkList_);
}
onChanged();
}
} else {
if (!other.storageHostChunkList_.isEmpty()) {
if (storageHostChunkListBuilder_.isEmpty()) {
storageHostChunkListBuilder_.dispose();
storageHostChunkListBuilder_ = null;
storageHostChunkList_ = other.storageHostChunkList_;
bitField0_ = (bitField0_ & ~0x00000001);
storageHostChunkListBuilder_ =
com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
getStorageHostChunkListFieldBuilder() : null;
} else {
storageHostChunkListBuilder_.addAllMessages(other.storageHostChunkList_);
}
}
}
if (chunkErrorBuilder_ == null) {
if (!other.chunkError_.isEmpty()) {
if (chunkError_.isEmpty()) {
chunkError_ = other.chunkError_;
bitField0_ = (bitField0_ & ~0x00000002);
} else {
ensureChunkErrorIsMutable();
chunkError_.addAll(other.chunkError_);
}
onChanged();
}
} else {
if (!other.chunkError_.isEmpty()) {
if (chunkErrorBuilder_.isEmpty()) {
chunkErrorBuilder_.dispose();
chunkErrorBuilder_ = null;
chunkError_ = other.chunkError_;
bitField0_ = (bitField0_ & ~0x00000002);
chunkErrorBuilder_ =
com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
getChunkErrorFieldBuilder() : null;
} else {
chunkErrorBuilder_.addAllMessages(other.chunkError_);
}
}
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
for (int i = 0; i < getStorageHostChunkListCount(); i++) {
if (!getStorageHostChunkList(i).isInitialized()) {
return false;
}
}
for (int i = 0; i < getChunkErrorCount(); i++) {
if (!getChunkError(i).isInitialized()) {
return false;
}
}
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkLists parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkLists) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList> storageHostChunkList_ =
java.util.Collections.emptyList();
private void ensureStorageHostChunkListIsMutable() {
if (!((bitField0_ & 0x00000001) == 0x00000001)) {
storageHostChunkList_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList>(storageHostChunkList_);
bitField0_ |= 0x00000001;
}
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkListOrBuilder> storageHostChunkListBuilder_;
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList> getStorageHostChunkListList() {
if (storageHostChunkListBuilder_ == null) {
return java.util.Collections.unmodifiableList(storageHostChunkList_);
} else {
return storageHostChunkListBuilder_.getMessageList();
}
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public int getStorageHostChunkListCount() {
if (storageHostChunkListBuilder_ == null) {
return storageHostChunkList_.size();
} else {
return storageHostChunkListBuilder_.getCount();
}
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList getStorageHostChunkList(int index) {
if (storageHostChunkListBuilder_ == null) {
return storageHostChunkList_.get(index);
} else {
return storageHostChunkListBuilder_.getMessage(index);
}
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public Builder setStorageHostChunkList(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList value) {
if (storageHostChunkListBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureStorageHostChunkListIsMutable();
storageHostChunkList_.set(index, value);
onChanged();
} else {
storageHostChunkListBuilder_.setMessage(index, value);
}
return this;
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public Builder setStorageHostChunkList(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList.Builder builderForValue) {
if (storageHostChunkListBuilder_ == null) {
ensureStorageHostChunkListIsMutable();
storageHostChunkList_.set(index, builderForValue.build());
onChanged();
} else {
storageHostChunkListBuilder_.setMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public Builder addStorageHostChunkList(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList value) {
if (storageHostChunkListBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureStorageHostChunkListIsMutable();
storageHostChunkList_.add(value);
onChanged();
} else {
storageHostChunkListBuilder_.addMessage(value);
}
return this;
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public Builder addStorageHostChunkList(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList value) {
if (storageHostChunkListBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureStorageHostChunkListIsMutable();
storageHostChunkList_.add(index, value);
onChanged();
} else {
storageHostChunkListBuilder_.addMessage(index, value);
}
return this;
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public Builder addStorageHostChunkList(
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList.Builder builderForValue) {
if (storageHostChunkListBuilder_ == null) {
ensureStorageHostChunkListIsMutable();
storageHostChunkList_.add(builderForValue.build());
onChanged();
} else {
storageHostChunkListBuilder_.addMessage(builderForValue.build());
}
return this;
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public Builder addStorageHostChunkList(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList.Builder builderForValue) {
if (storageHostChunkListBuilder_ == null) {
ensureStorageHostChunkListIsMutable();
storageHostChunkList_.add(index, builderForValue.build());
onChanged();
} else {
storageHostChunkListBuilder_.addMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public Builder addAllStorageHostChunkList(
java.lang.Iterable<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList> values) {
if (storageHostChunkListBuilder_ == null) {
ensureStorageHostChunkListIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, storageHostChunkList_);
onChanged();
} else {
storageHostChunkListBuilder_.addAllMessages(values);
}
return this;
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public Builder clearStorageHostChunkList() {
if (storageHostChunkListBuilder_ == null) {
storageHostChunkList_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
onChanged();
} else {
storageHostChunkListBuilder_.clear();
}
return this;
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public Builder removeStorageHostChunkList(int index) {
if (storageHostChunkListBuilder_ == null) {
ensureStorageHostChunkListIsMutable();
storageHostChunkList_.remove(index);
onChanged();
} else {
storageHostChunkListBuilder_.remove(index);
}
return this;
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList.Builder getStorageHostChunkListBuilder(
int index) {
return getStorageHostChunkListFieldBuilder().getBuilder(index);
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkListOrBuilder getStorageHostChunkListOrBuilder(
int index) {
if (storageHostChunkListBuilder_ == null) {
return storageHostChunkList_.get(index); } else {
return storageHostChunkListBuilder_.getMessageOrBuilder(index);
}
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkListOrBuilder>
getStorageHostChunkListOrBuilderList() {
if (storageHostChunkListBuilder_ != null) {
return storageHostChunkListBuilder_.getMessageOrBuilderList();
} else {
return java.util.Collections.unmodifiableList(storageHostChunkList_);
}
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList.Builder addStorageHostChunkListBuilder() {
return getStorageHostChunkListFieldBuilder().addBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList.getDefaultInstance());
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList.Builder addStorageHostChunkListBuilder(
int index) {
return getStorageHostChunkListFieldBuilder().addBuilder(index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList.getDefaultInstance());
}
/**
* <code>repeated .StorageHostChunkList storage_host_chunk_list = 1;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList.Builder>
getStorageHostChunkListBuilderList() {
return getStorageHostChunkListFieldBuilder().getBuilderList();
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkListOrBuilder>
getStorageHostChunkListFieldBuilder() {
if (storageHostChunkListBuilder_ == null) {
storageHostChunkListBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkList.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.StorageHostChunkListOrBuilder>(
storageHostChunkList_,
((bitField0_ & 0x00000001) == 0x00000001),
getParentForChildren(),
isClean());
storageHostChunkList_ = null;
}
return storageHostChunkListBuilder_;
}
private java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError> chunkError_ =
java.util.Collections.emptyList();
private void ensureChunkErrorIsMutable() {
if (!((bitField0_ & 0x00000002) == 0x00000002)) {
chunkError_ = new java.util.ArrayList<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError>(chunkError_);
bitField0_ |= 0x00000002;
}
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorOrBuilder> chunkErrorBuilder_;
/**
* <code>repeated .ChunkError chunk_error = 2;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError> getChunkErrorList() {
if (chunkErrorBuilder_ == null) {
return java.util.Collections.unmodifiableList(chunkError_);
} else {
return chunkErrorBuilder_.getMessageList();
}
}
/**
* <code>repeated .ChunkError chunk_error = 2;</code>
*/
public int getChunkErrorCount() {
if (chunkErrorBuilder_ == null) {
return chunkError_.size();
} else {
return chunkErrorBuilder_.getCount();
}
}
/**
* <code>repeated .ChunkError chunk_error = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError getChunkError(int index) {
if (chunkErrorBuilder_ == null) {
return chunkError_.get(index);
} else {
return chunkErrorBuilder_.getMessage(index);
}
}
/**
* <code>repeated .ChunkError chunk_error = 2;</code>
*/
public Builder setChunkError(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError value) {
if (chunkErrorBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureChunkErrorIsMutable();
chunkError_.set(index, value);
onChanged();
} else {
chunkErrorBuilder_.setMessage(index, value);
}
return this;
}
/**
* <code>repeated .ChunkError chunk_error = 2;</code>
*/
public Builder setChunkError(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError.Builder builderForValue) {
if (chunkErrorBuilder_ == null) {
ensureChunkErrorIsMutable();
chunkError_.set(index, builderForValue.build());
onChanged();
} else {
chunkErrorBuilder_.setMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .ChunkError chunk_error = 2;</code>
*/
public Builder addChunkError(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError value) {
if (chunkErrorBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureChunkErrorIsMutable();
chunkError_.add(value);
onChanged();
} else {
chunkErrorBuilder_.addMessage(value);
}
return this;
}
/**
* <code>repeated .ChunkError chunk_error = 2;</code>
*/
public Builder addChunkError(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError value) {
if (chunkErrorBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureChunkErrorIsMutable();
chunkError_.add(index, value);
onChanged();
} else {
chunkErrorBuilder_.addMessage(index, value);
}
return this;
}
/**
* <code>repeated .ChunkError chunk_error = 2;</code>
*/
public Builder addChunkError(
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError.Builder builderForValue) {
if (chunkErrorBuilder_ == null) {
ensureChunkErrorIsMutable();
chunkError_.add(builderForValue.build());
onChanged();
} else {
chunkErrorBuilder_.addMessage(builderForValue.build());
}
return this;
}
/**
* <code>repeated .ChunkError chunk_error = 2;</code>
*/
public Builder addChunkError(
int index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError.Builder builderForValue) {
if (chunkErrorBuilder_ == null) {
ensureChunkErrorIsMutable();
chunkError_.add(index, builderForValue.build());
onChanged();
} else {
chunkErrorBuilder_.addMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .ChunkError chunk_error = 2;</code>
*/
public Builder addAllChunkError(
java.lang.Iterable<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError> values) {
if (chunkErrorBuilder_ == null) {
ensureChunkErrorIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, chunkError_);
onChanged();
} else {
chunkErrorBuilder_.addAllMessages(values);
}
return this;
}
/**
* <code>repeated .ChunkError chunk_error = 2;</code>
*/
public Builder clearChunkError() {
if (chunkErrorBuilder_ == null) {
chunkError_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000002);
onChanged();
} else {
chunkErrorBuilder_.clear();
}
return this;
}
/**
* <code>repeated .ChunkError chunk_error = 2;</code>
*/
public Builder removeChunkError(int index) {
if (chunkErrorBuilder_ == null) {
ensureChunkErrorIsMutable();
chunkError_.remove(index);
onChanged();
} else {
chunkErrorBuilder_.remove(index);
}
return this;
}
/**
* <code>repeated .ChunkError chunk_error = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError.Builder getChunkErrorBuilder(
int index) {
return getChunkErrorFieldBuilder().getBuilder(index);
}
/**
* <code>repeated .ChunkError chunk_error = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorOrBuilder getChunkErrorOrBuilder(
int index) {
if (chunkErrorBuilder_ == null) {
return chunkError_.get(index); } else {
return chunkErrorBuilder_.getMessageOrBuilder(index);
}
}
/**
* <code>repeated .ChunkError chunk_error = 2;</code>
*/
public java.util.List<? extends com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorOrBuilder>
getChunkErrorOrBuilderList() {
if (chunkErrorBuilder_ != null) {
return chunkErrorBuilder_.getMessageOrBuilderList();
} else {
return java.util.Collections.unmodifiableList(chunkError_);
}
}
/**
* <code>repeated .ChunkError chunk_error = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError.Builder addChunkErrorBuilder() {
return getChunkErrorFieldBuilder().addBuilder(com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError.getDefaultInstance());
}
/**
* <code>repeated .ChunkError chunk_error = 2;</code>
*/
public com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError.Builder addChunkErrorBuilder(
int index) {
return getChunkErrorFieldBuilder().addBuilder(index, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError.getDefaultInstance());
}
/**
* <code>repeated .ChunkError chunk_error = 2;</code>
*/
public java.util.List<com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError.Builder>
getChunkErrorBuilderList() {
return getChunkErrorFieldBuilder().getBuilderList();
}
private com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorOrBuilder>
getChunkErrorFieldBuilder() {
if (chunkErrorBuilder_ == null) {
chunkErrorBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkError.Builder, com.github.horrorho.inflatabledonkey.protobuf.ChunkServer.ChunkErrorOrBuilder>(
chunkError_,
((bitField0_ & 0x00000002) == 0x00000002),
getParentForChildren(),
isClean());
chunkError_ = null;
}
return chunkErrorBuilder_;
}
// @@protoc_insertion_point(builder_scope:StorageHostChunkLists)
}
static {
defaultInstance = new StorageHostChunkLists(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:StorageHostChunkLists)
}
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_ChunkInfo_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_ChunkInfo_fieldAccessorTable;
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_NameValuePair_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_NameValuePair_fieldAccessorTable;
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_HostInfo_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_HostInfo_fieldAccessorTable;
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_ErrorResponse_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_ErrorResponse_fieldAccessorTable;
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_FileError_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_FileError_fieldAccessorTable;
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_ChunkError_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_ChunkError_fieldAccessorTable;
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_ChunkErrorIndex_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_ChunkErrorIndex_fieldAccessorTable;
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_FileChunkError_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_FileChunkError_fieldAccessorTable;
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_StorageContainerError_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_StorageContainerError_fieldAccessorTable;
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_MethodCompletionInfo_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_MethodCompletionInfo_fieldAccessorTable;
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_MethodCompletionInfoList_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_MethodCompletionInfoList_fieldAccessorTable;
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_FileChunkList_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_FileChunkList_fieldAccessorTable;
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_FileChunkLists_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_FileChunkLists_fieldAccessorTable;
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_StorageContainerChunkList_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_StorageContainerChunkList_fieldAccessorTable;
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_StorageContainerChunkLists_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_StorageContainerChunkLists_fieldAccessorTable;
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_StorageContainerErrorList_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_StorageContainerErrorList_fieldAccessorTable;
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_FileChecksumAuthorization_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_FileChecksumAuthorization_fieldAccessorTable;
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_FileChecksumAuthorizationList_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_FileChecksumAuthorizationList_fieldAccessorTable;
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_ChunkReference_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_ChunkReference_fieldAccessorTable;
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_FileChecksumChunkReferences_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_FileChecksumChunkReferences_fieldAccessorTable;
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_FileChecksumStorageHostChunkLists_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_FileChecksumStorageHostChunkLists_fieldAccessorTable;
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_FileGroups_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_FileGroups_fieldAccessorTable;
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_ChunkChecksumList_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_ChunkChecksumList_fieldAccessorTable;
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_StorageHostChunkList_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_StorageHostChunkList_fieldAccessorTable;
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_StorageHostChunkLists_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_StorageHostChunkLists_fieldAccessorTable;
public static com.google.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static com.google.protobuf.Descriptors.FileDescriptor
descriptor;
static {
java.lang.String[] descriptorData = {
"\n\022chunk_server.proto\"m\n\tChunkInfo\022\026\n\016chu" +
"nk_checksum\030\001 \002(\014\022\034\n\024chunk_encryption_ke" +
"y\030\002 \001(\014\022\024\n\014chunk_length\030\003 \002(\r\022\024\n\014chunk_o" +
"ffset\030\004 \001(\r\",\n\rNameValuePair\022\014\n\004name\030\001 \002" +
"(\t\022\r\n\005value\030\002 \002(\t\"\334\001\n\010HostInfo\022\020\n\010hostna" +
"me\030\001 \002(\t\022\014\n\004port\030\002 \002(\r\022\016\n\006method\030\003 \002(\t\022\013" +
"\n\003uri\030\004 \002(\t\022\032\n\022transport_protocol\030\005 \002(\t\022" +
"\"\n\032transport_protocol_version\030\006 \002(\t\022\016\n\006s" +
"cheme\030\007 \002(\t\022\037\n\007headers\030\010 \003(\0132\016.NameValue" +
"Pair\022\022\n\ndatacenter\030\t \001(\t\022\016\n\006expiry\030\013 \001(\004",
"\"\242\001\n\rErrorResponse\022\016\n\006domain\030\001 \002(\t\022\022\n\ner" +
"ror_code\030\002 \002(\005\022\031\n\021error_description\030\003 \001(" +
"\t\022)\n\021underlying_errors\030\004 \003(\0132\016.ErrorResp" +
"onse\022\'\n\017name_value_pair\030\005 \003(\0132\016.NameValu" +
"ePair\"J\n\tFileError\022\025\n\rfile_checksum\030\001 \002(" +
"\014\022&\n\016error_response\030\002 \002(\0132\016.ErrorRespons" +
"e\"L\n\nChunkError\022\026\n\016chunk_checksum\030\001 \002(\014\022" +
"&\n\016error_response\030\002 \002(\0132\016.ErrorResponse\"" +
"f\n\017ChunkErrorIndex\022\026\n\016chunk_checksum\030\001 \002" +
"(\014\022&\n\016error_response\030\002 \002(\0132\016.ErrorRespon",
"se\022\023\n\013chunk_index\030\003 \002(\r\"N\n\016FileChunkErro" +
"r\022\025\n\rfile_checksum\030\001 \002(\014\022%\n\013chunk_error\030" +
"\002 \003(\0132\020.ChunkErrorIndex\"^\n\025StorageContai" +
"nerError\022\035\n\025storage_container_key\030\001 \002(\t\022" +
"&\n\016error_response\030\002 \002(\0132\016.ErrorResponse\"" +
"\344\002\n\024MethodCompletionInfo\022\013\n\003url\030\001 \002(\t\022\034\n" +
"\024response_status_code\030\002 \002(\r\022\034\n\024response_" +
"status_line\030\003 \001(\t\022/\n\027vendor_response_hea" +
"ders\030\004 \003(\0132\016.NameValuePair\022\025\n\rresponse_b" +
"ody\030\005 \001(\014\022\035\n\005error\030\006 \001(\0132\016.ErrorResponse",
"\022\033\n\023client_computed_md5\030\007 \001(\014\022\'\n\017vendor_" +
"nv_pairs\030\010 \003(\0132\016.NameValuePair\022\'\n\017client" +
"_nv_pairs\030\t \003(\0132\016.NameValuePair\022-\n%stora" +
"ge_container_authorization_token\030\n \002(\t\"Q" +
"\n\030MethodCompletionInfoList\0225\n\026method_com" +
"pletion_info\030\001 \003(\0132\025.MethodCompletionInf" +
"o\"]\n\rFileChunkList\022\025\n\rfile_checksum\030\001 \002(" +
"\014\022\025\n\rauthorization\030\002 \002(\t\022\036\n\nchunk_info\030\003" +
" \003(\0132\n.ChunkInfo\"9\n\016FileChunkLists\022\'\n\017fi" +
"le_chunk_list\030\001 \003(\0132\016.FileChunkList\"\237\001\n\031",
"StorageContainerChunkList\022\035\n\025storage_con" +
"tainer_key\030\001 \002(\014\022\034\n\thost_info\030\002 \002(\0132\t.Ho" +
"stInfo\022\026\n\016chunk_checksum\030\003 \003(\014\022-\n%storag" +
"e_container_authorization_token\030\004 \002(\t\"\227\001" +
"\n\032StorageContainerChunkLists\022@\n\034storage_" +
"container_chunk_list\030\001 \003(\0132\032.StorageCont" +
"ainerChunkList\022\036\n\nfile_error\030\002 \003(\0132\n.Fil" +
"eError\022\027\n\017verbosity_level\030\003 \001(\r\"T\n\031Stora" +
"geContainerErrorList\0227\n\027storage_containe" +
"r_error\030\001 \003(\0132\026.StorageContainerError\"b\n",
"\031FileChecksumAuthorization\022\025\n\rfile_check" +
"sum\030\001 \002(\014\022\025\n\rauthorization\030\002 \002(\t\022\027\n\017chun" +
"k_checksums\030\003 \003(\014\"`\n\035FileChecksumAuthori" +
"zationList\022?\n\033file_checksum_authorizatio" +
"n\030\001 \003(\0132\032.FileChecksumAuthorization\">\n\016C" +
"hunkReference\022\027\n\017container_index\030\001 \002(\004\022\023" +
"\n\013chunk_index\030\002 \002(\004\"w\n\033FileChecksumChunk" +
"References\022\025\n\rfile_checksum\030\001 \002(\014\022)\n\020chu" +
"nk_references\030\002 \003(\0132\017.ChunkReference\022\026\n\016" +
"file_signature\030\003 \001(\014\"\241\001\n!FileChecksumSto",
"rageHostChunkLists\0226\n\027storage_host_chunk" +
"_list\030\001 \003(\0132\025.StorageHostChunkList\022D\n\036fi" +
"le_checksum_chunk_references\030\002 \003(\0132\034.Fil" +
"eChecksumChunkReferences\"\251\001\n\nFileGroups\022" +
"7\n\013file_groups\030\001 \003(\0132\".FileChecksumStora" +
"geHostChunkLists\022\036\n\nfile_error\030\002 \003(\0132\n.F" +
"ileError\022)\n\020file_chunk_error\030\003 \003(\0132\017.Fil" +
"eChunkError\022\027\n\017verbosity_level\030\004 \001(\r\"+\n\021" +
"ChunkChecksumList\022\026\n\016chunk_checksum\030\001 \003(" +
"\014\"\242\001\n\024StorageHostChunkList\022\034\n\thost_info\030",
"\001 \002(\0132\t.HostInfo\022\036\n\nchunk_info\030\002 \003(\0132\n.C" +
"hunkInfo\022\035\n\025storage_container_key\030\003 \002(\t\022" +
"-\n%storage_container_authorization_token" +
"\030\004 \002(\t\"q\n\025StorageHostChunkLists\0226\n\027stora" +
"ge_host_chunk_list\030\001 \003(\0132\025.StorageHostCh" +
"unkList\022 \n\013chunk_error\030\002 \003(\0132\013.ChunkErro" +
"rB<\n-com.github.horrorho.inflatabledonke" +
"y.protocolB\013ChunkServer"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
public com.google.protobuf.ExtensionRegistry assignDescriptors(
com.google.protobuf.Descriptors.FileDescriptor root) {
descriptor = root;
return null;
}
};
com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
}, assigner);
internal_static_ChunkInfo_descriptor =
getDescriptor().getMessageTypes().get(0);
internal_static_ChunkInfo_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_ChunkInfo_descriptor,
new java.lang.String[] { "ChunkChecksum", "ChunkEncryptionKey", "ChunkLength", "ChunkOffset", });
internal_static_NameValuePair_descriptor =
getDescriptor().getMessageTypes().get(1);
internal_static_NameValuePair_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_NameValuePair_descriptor,
new java.lang.String[] { "Name", "Value", });
internal_static_HostInfo_descriptor =
getDescriptor().getMessageTypes().get(2);
internal_static_HostInfo_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_HostInfo_descriptor,
new java.lang.String[] { "Hostname", "Port", "Method", "Uri", "TransportProtocol", "TransportProtocolVersion", "Scheme", "Headers", "Datacenter", "Expiry", });
internal_static_ErrorResponse_descriptor =
getDescriptor().getMessageTypes().get(3);
internal_static_ErrorResponse_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_ErrorResponse_descriptor,
new java.lang.String[] { "Domain", "ErrorCode", "ErrorDescription", "UnderlyingErrors", "NameValuePair", });
internal_static_FileError_descriptor =
getDescriptor().getMessageTypes().get(4);
internal_static_FileError_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_FileError_descriptor,
new java.lang.String[] { "FileChecksum", "ErrorResponse", });
internal_static_ChunkError_descriptor =
getDescriptor().getMessageTypes().get(5);
internal_static_ChunkError_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_ChunkError_descriptor,
new java.lang.String[] { "ChunkChecksum", "ErrorResponse", });
internal_static_ChunkErrorIndex_descriptor =
getDescriptor().getMessageTypes().get(6);
internal_static_ChunkErrorIndex_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_ChunkErrorIndex_descriptor,
new java.lang.String[] { "ChunkChecksum", "ErrorResponse", "ChunkIndex", });
internal_static_FileChunkError_descriptor =
getDescriptor().getMessageTypes().get(7);
internal_static_FileChunkError_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_FileChunkError_descriptor,
new java.lang.String[] { "FileChecksum", "ChunkError", });
internal_static_StorageContainerError_descriptor =
getDescriptor().getMessageTypes().get(8);
internal_static_StorageContainerError_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_StorageContainerError_descriptor,
new java.lang.String[] { "StorageContainerKey", "ErrorResponse", });
internal_static_MethodCompletionInfo_descriptor =
getDescriptor().getMessageTypes().get(9);
internal_static_MethodCompletionInfo_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_MethodCompletionInfo_descriptor,
new java.lang.String[] { "Url", "ResponseStatusCode", "ResponseStatusLine", "VendorResponseHeaders", "ResponseBody", "Error", "ClientComputedMd5", "VendorNvPairs", "ClientNvPairs", "StorageContainerAuthorizationToken", });
internal_static_MethodCompletionInfoList_descriptor =
getDescriptor().getMessageTypes().get(10);
internal_static_MethodCompletionInfoList_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_MethodCompletionInfoList_descriptor,
new java.lang.String[] { "MethodCompletionInfo", });
internal_static_FileChunkList_descriptor =
getDescriptor().getMessageTypes().get(11);
internal_static_FileChunkList_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_FileChunkList_descriptor,
new java.lang.String[] { "FileChecksum", "Authorization", "ChunkInfo", });
internal_static_FileChunkLists_descriptor =
getDescriptor().getMessageTypes().get(12);
internal_static_FileChunkLists_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_FileChunkLists_descriptor,
new java.lang.String[] { "FileChunkList", });
internal_static_StorageContainerChunkList_descriptor =
getDescriptor().getMessageTypes().get(13);
internal_static_StorageContainerChunkList_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_StorageContainerChunkList_descriptor,
new java.lang.String[] { "StorageContainerKey", "HostInfo", "ChunkChecksum", "StorageContainerAuthorizationToken", });
internal_static_StorageContainerChunkLists_descriptor =
getDescriptor().getMessageTypes().get(14);
internal_static_StorageContainerChunkLists_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_StorageContainerChunkLists_descriptor,
new java.lang.String[] { "StorageContainerChunkList", "FileError", "VerbosityLevel", });
internal_static_StorageContainerErrorList_descriptor =
getDescriptor().getMessageTypes().get(15);
internal_static_StorageContainerErrorList_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_StorageContainerErrorList_descriptor,
new java.lang.String[] { "StorageContainerError", });
internal_static_FileChecksumAuthorization_descriptor =
getDescriptor().getMessageTypes().get(16);
internal_static_FileChecksumAuthorization_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_FileChecksumAuthorization_descriptor,
new java.lang.String[] { "FileChecksum", "Authorization", "ChunkChecksums", });
internal_static_FileChecksumAuthorizationList_descriptor =
getDescriptor().getMessageTypes().get(17);
internal_static_FileChecksumAuthorizationList_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_FileChecksumAuthorizationList_descriptor,
new java.lang.String[] { "FileChecksumAuthorization", });
internal_static_ChunkReference_descriptor =
getDescriptor().getMessageTypes().get(18);
internal_static_ChunkReference_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_ChunkReference_descriptor,
new java.lang.String[] { "ContainerIndex", "ChunkIndex", });
internal_static_FileChecksumChunkReferences_descriptor =
getDescriptor().getMessageTypes().get(19);
internal_static_FileChecksumChunkReferences_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_FileChecksumChunkReferences_descriptor,
new java.lang.String[] { "FileChecksum", "ChunkReferences", "FileSignature", });
internal_static_FileChecksumStorageHostChunkLists_descriptor =
getDescriptor().getMessageTypes().get(20);
internal_static_FileChecksumStorageHostChunkLists_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_FileChecksumStorageHostChunkLists_descriptor,
new java.lang.String[] { "StorageHostChunkList", "FileChecksumChunkReferences", });
internal_static_FileGroups_descriptor =
getDescriptor().getMessageTypes().get(21);
internal_static_FileGroups_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_FileGroups_descriptor,
new java.lang.String[] { "FileGroups", "FileError", "FileChunkError", "VerbosityLevel", });
internal_static_ChunkChecksumList_descriptor =
getDescriptor().getMessageTypes().get(22);
internal_static_ChunkChecksumList_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_ChunkChecksumList_descriptor,
new java.lang.String[] { "ChunkChecksum", });
internal_static_StorageHostChunkList_descriptor =
getDescriptor().getMessageTypes().get(23);
internal_static_StorageHostChunkList_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_StorageHostChunkList_descriptor,
new java.lang.String[] { "HostInfo", "ChunkInfo", "StorageContainerKey", "StorageContainerAuthorizationToken", });
internal_static_StorageHostChunkLists_descriptor =
getDescriptor().getMessageTypes().get(24);
internal_static_StorageHostChunkLists_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_StorageHostChunkLists_descriptor,
new java.lang.String[] { "StorageHostChunkList", "ChunkError", });
}
// @@protoc_insertion_point(outer_class_scope)
}
| horrorho/InflatableDonkey | src/main/java/com/github/horrorho/inflatabledonkey/protobuf/ChunkServer.java | Java | mit | 955,026 |
import Grid from './Grid';
import Row from './Row';
import Column from './Column';
export { Grid, Row, Column };
| ParmenionUX/parmenion-library | src/components/Layout/Grid/index.js | JavaScript | mit | 114 |
import os
from coverage_reporter.options import Option, OptionList
DEFAULT_PLUGIN_DIRS = [ os.path.dirname(__file__) + '/collectors/',
os.path.dirname(__file__) + '/filters/',
os.path.dirname(__file__) + '/reports/',
]
DEFAULT_PLUGINS = [ 'figleaf_collector',
'coverage_collector',
'patch',
'exclude',
'minimum',
'summarize',
'annotate',
]
DEFAULT_CONFIG_PATHS = ['/etc/coverage_reporter', os.path.expanduser('~/.coverage_reporter'), '.coverage_reporter']
DEFAULT_OPTIONS = OptionList([ Option('skip_default_config', 'boolean'),
Option('config_file', 'list', default=[]),
Option('plugin_dir', 'list', default=[]),
Option('plugin', 'list', default=[]),
Option('disable_plugin', 'list', default=[]) ])
| dugan/coverage-reporter | coverage_reporter/defaults.py | Python | mit | 1,043 |
using LiveSplit.AutoSplitting.Variables;
using System;
using System.Windows.Forms;
namespace LiveSplit.AutoSplitting.Editors
{
public partial class VariableEditor : Form
{
public Variable EditedVariable { get; protected set; }
AutoSplitEnv _env;
VariableControl _editor;
public VariableEditor(AutoSplitEnv env, Type varType, Variable source)
{
InitializeComponent();
_env = env;
EditedVariable = source?.Clone(env);
var typeName = varType.Name.IndexOf("`") != -1
? varType.Name.Remove(varType.Name.IndexOf("`"))
: varType.Name;
Text = typeName + " Editor";
_editor = (VariableControl)Activator.CreateInstance(_env.GetEditor(varType), env, source);
_editor.Dock = DockStyle.Fill;
_editor.Margin = new Padding(_editor.Margin.Left, _editor.Margin.Top, _editor.Margin.Right, 0);
_editor.TabIndex = 0;
tlpMain.Controls.Add(_editor);
tlpMain.SetRow(_editor, 0);
tlpMain.SetColumn(_editor, 0);
}
void btnOK_Click(object sender, EventArgs e)
{
if (_editor.OnClose())
{
Close();
EditedVariable = _editor.Value;
DialogResult = DialogResult.OK;
}
}
public static Variable ShowEditor(AutoSplitEnv env, Type type, Variable source = null)
{
using (var form = new VariableEditor(env, type, source))
{
if (form.ShowDialog() != DialogResult.Cancel)
return form.EditedVariable;
}
return source;
}
public static Variable ShowEditor(AutoSplitEnv env, Variable source) => ShowEditor(env, source.GetType(), source);
}
public class VariableControl : UserControl
{
public virtual Variable Value { get; protected set; }
public VariableControl(AutoSplitEnv env, Variable source)
{
Value = source?.Clone(env);
}
[Obsolete("Designer only", true)]
public VariableControl() { }
public virtual bool OnClose() => true;
}
}
| Dalet/livesplit-autosplitting | Editors/VariableEditor.cs | C# | mit | 1,912 |
require 'spec_helper'
describe Torganiser do
it 'should have a version number' do
expect(Torganiser::VERSION).not_to be_nil
end
end
| sergei-matheson/torganiser | spec/torganiser_spec.rb | Ruby | mit | 141 |
package main
import (
"fmt"
"github.com/kierdavis/KMail/go"
"net"
"net/http"
"os"
"os/signal"
"sync"
"syscall"
"encoding/xml"
"github.com/kierdavis/zlog"
"regexp"
"strconv"
"strings"
"time"
)
var Logger = zlog.NewLogger("kmailqueue")
var NameEncodeRegexp = regexp.MustCompile("[^a-zA-Z0-9_.-]+")
func NameEncodeReplacer(input string) (output string) {
output = ""
for _, c := range []byte(input) {
output += "$"
output += strconv.FormatUint(uint64(c), 16)
}
return output
}
var NameDecodeRegexp = regexp.MustCompile("\\$[0-9a-fA-F]{2}")
func NameDecodeReplacer(input string) (output string) {
n, _ := strconv.ParseUint(input[1:], 16, 8)
return string(byte(n))
}
type Queue struct {
sync.Mutex `xml:"-"`
XMLName xml.Name `xml:"queue"`
IPAddress string `xml:"ipaddress"`
Messages []*kmail.Message `xml:"messages"`
}
func (q *Queue) Put(msg *kmail.Message) {
q.Lock()
defer q.Unlock()
q.Messages = append(q.Messages, msg)
}
func (q *Queue) Get() (msgs []*kmail.Message) {
q.Lock()
defer q.Unlock()
msgs = q.Messages
q.Messages = nil
return msgs
}
var Queues = make(map[string]*Queue)
var QueuesLock sync.Mutex
func GetQueue(name string) (queue *Queue, ok bool) {
QueuesLock.Lock()
defer QueuesLock.Unlock()
queue, ok = Queues[name]
return queue, ok
}
func NewQueue(name string, ipaddress string) (queue *Queue) {
queue = new(Queue)
queue.IPAddress = ipaddress
queue.Messages = nil
QueuesLock.Lock()
defer QueuesLock.Unlock()
Queues[name] = queue
return queue
}
var Address = kmail.Address{"QUEUE", ""}
func Reply(msg *kmail.Message, body string) {
Logger.Info("Replying to %s with: %s", msg.Dest.String(), body)
go func() {
err := msg.Reply(Address, body)
if err != nil {
Logger.Error("Error sending reply: %s", err.Error())
}
}()
}
func HandleMessage(msg *kmail.Message) {
hostname := msg.Dest.Hostname
queue, ok := GetQueue(hostname)
if !ok {
Reply(msg, fmt.Sprintf("No host named '%s' registered on this queue server.", hostname))
return
}
queue.Put(msg)
}
func GetIP(r *http.Request) (ip string) {
pos := strings.Index(r.RemoteAddr, ":")
if pos < 0 {
return r.RemoteAddr
}
return r.RemoteAddr[:pos]
}
func HandleFetch(w http.ResponseWriter, r *http.Request) {
hostname := r.FormValue("hostname")
if hostname == "" {
Logger.Info("%s %s -> 400 Bad Request: No hostname parameter given.", r.Method, r.RequestURI)
w.WriteHeader(400)
fmt.Fprintf(w, "No hostname parameter given.\r\n")
return
}
queue, ok := GetQueue(hostname)
if !ok {
Logger.Info("%s %s -> 404 Not Found: No host named '%s' registered on this queue server.", r.Method, r.RequestURI, hostname)
w.WriteHeader(404)
fmt.Fprintf(w, "No host named '%s' registered on this queue server.\r\n", hostname)
return
}
if queue.IPAddress != GetIP(r) {
Logger.Info("%s %s -> 403 Forbidden: Once created, a queue may only be accessed by the IP address it was created on.", r.Method, r.RequestURI)
w.WriteHeader(403)
fmt.Fprintf(w, "Once created, a queue may only be accessed by the IP address it was created on.\r\n")
return
}
messages := queue.Get()
Logger.Info("%s %s -> 200 OK: %d messages returned.", r.Method, r.RequestURI, len(messages))
w.WriteHeader(200)
err := kmail.SerializeXML(w, messages)
if err != nil {
Logger.Error("Error serializing messages: %s", err.Error())
return
}
}
func HandleRegister(w http.ResponseWriter, r *http.Request) {
hostname := r.FormValue("hostname")
if hostname == "" {
Logger.Info("%s %s -> 400 Bad Request: No hostname parameter given.", r.Method, r.RequestURI)
w.WriteHeader(400)
fmt.Fprintf(w, "No hostname parameter given.\r\n")
return
}
_, ok := GetQueue(hostname)
if ok {
Logger.Info("%s %s -> 400 Bad Request: Hostname '%s' already registered.", r.Method, r.RequestURI, hostname)
w.WriteHeader(400)
fmt.Fprintf(w, "Hostname '%s' already registered.\r\n", hostname)
return
}
NewQueue(hostname, GetIP(r))
Logger.Info("%s %s -> 200 OK: Queue '%s' created.", r.Method, r.RequestURI, hostname)
w.WriteHeader(200)
}
func RunMailServer(bindaddr string) {
sm := http.NewServeMux()
sm.HandleFunc("/", kmail.HandleMessages(HandleMessage, Logger.SubSource("kmail")))
sm.HandleFunc("/fetch", HandleFetch)
sm.HandleFunc("/register", HandleRegister)
l, err := net.Listen("tcp", bindaddr)
if err != nil {
Logger.Error("Error starting listener: %s", err.Error())
return
}
Logger.Info("Listening on %s", l.Addr().String())
c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGHUP, syscall.SIGINT)
go func() {
<-c
l.Close()
}()
err = http.Serve(l, sm)
if err != nil {
Logger.Error("Error running server: %s", err.Error())
return
}
}
func EncodeName(s string) (r string) {
return NameEncodeRegexp.ReplaceAllStringFunc(s, NameEncodeReplacer)
}
func DecodeName(s string) (r string) {
return NameDecodeRegexp.ReplaceAllStringFunc(s, NameDecodeReplacer)
}
func LoadQueue(filename string) (queue *Queue) {
f, err := os.Open(filename)
if err != nil {
Logger.Error("Error: %s", err.Error())
return nil
}
defer f.Close()
err = xml.NewDecoder(f).Decode(&queue)
if err != nil {
Logger.Error("Error: %s", err.Error())
return nil
}
return queue
}
func LoadQueues() {
Logger.Info("Loading queues from data/")
QueuesLock.Lock()
defer QueuesLock.Unlock()
Queues = make(map[string]*Queue)
f, err := os.Open("data")
if err != nil {
Logger.Error("Error: %s", err.Error())
return
}
defer f.Close()
filenames, err := f.Readdirnames(0)
if err != nil {
Logger.Error("Error: %s", err.Error())
return
}
for _, filename := range filenames {
if !strings.HasSuffix(filename, ".xml") {
continue
}
name := DecodeName(filename[:len(filename) - 4])
queue := LoadQueue("data/" + filename)
if queue != nil {
Queues[name] = queue
}
}
}
func SaveQueue(name string, queue *Queue) {
Logger.Info("Saving queues to data/")
f, err := os.Create("data/" + EncodeName(name) + ".xml")
if err != nil {
Logger.Error("Error: %s", err.Error())
return
}
defer f.Close()
queue.Lock()
defer queue.Unlock()
err = xml.NewEncoder(f).Encode(queue)
if err != nil {
Logger.Error("Error: %s", err.Error())
return
}
}
func SaveQueues() {
err := os.MkdirAll("data", 0755)
if err != nil {
Logger.Error("Error: %s", err.Error())
return
}
QueuesLock.Lock()
defer QueuesLock.Unlock()
for name, queue := range Queues {
SaveQueue(name, queue)
}
}
func main() {
// Initialise logger
Logger.AddOutput(zlog.NewConsoleOutput())
go Logger.DispatchAll()
// Load queues
LoadQueues()
// Check command line
if len(os.Args) < 3 {
fmt.Fprintf(os.Stderr, "Usage: %s <mailhostname> <bindaddr>\n", os.Args[0])
return
}
Address.Hostname = os.Args[1]
// Run server
RunMailServer(os.Args[2])
// Save queues
SaveQueues()
// Yield to allow logging to complete
time.Sleep(time.Millisecond)
}
| kierdavis/KMail | go/kmailqueue/kmailqueue.go | GO | mit | 6,986 |
<?php
namespace Boilerplate;
use PDO;
class Database extends PDO {
private $database, $host, $user, $pass;
private $attributes = [];
public function __construct () {
$this->database = 'slim_boilerplate'; // Change
$this->user = 'root'; // Change
$this->pass = 'root'; // Change
$this->host = 'mysql:host=localhost;dbname=' . $this->database . ';';
$this->attributes = [
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'
];
parent::__construct($this->host, $this->user, $this->pass, $this->attributes);
}
public function getUsernames () {
$sql = 'SELECT user_name FROM users';
try {
$stmt = $this->prepare($sql);
$stmt->execute();
$data = $stmt->fetchAll();
print_r($data);
} catch (PDOException $exception) {
return $exception;
}
}
}
| miloroot/slim-boilerplate | db/db.php | PHP | mit | 936 |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Gwen.Net Ex OpenTK XML Designer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Gwen.Net Ex OpenTK XML Designer")]
[assembly: AssemblyCopyright("Copyright © 2016 Kimmo Palosaari")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a0497842-4a71-45a6-928f-2bc2467da544")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| kpalosaa/gwen-net-ex | Gwen.XmlDesigner.OpenTK/Properties/AssemblyInfo.cs | C# | mit | 1,453 |
package com.bitdubai.fermat_osa_addon.layer.android.device_conectivity.developer.bitdubai.version_1.exceptions;
/**
* Created by Natalia on 07/05/2015.
*/
public class CantGetActiveConnectionException extends Exception {
/**
*
*/
private static final long serialVersionUID = 1040284501010116568L;
}
| fvasquezjatar/fermat-unused | OSA/addon/android/fermat-osa-addon-android-device-connectivity-bitdubai/src/main/java/com/bitdubai/fermat_osa_addon/layer/android/device_conectivity/developer/bitdubai/version_1/exceptions/CantGetActiveConnectionException.java | Java | mit | 310 |
package com.bitdubai.fermat_dmp_plugin.layer.network_service.intra_user.developer.bitdubai.version_1.exceptions;
import com.bitdubai.fermat_api.FermatException;
/**
* Created by natalia on 04/09/15.
*/
public class CantPersistProfileImageException extends FermatException {
public CantPersistProfileImageException(final String message, final Exception cause, final String context, final String possibleReason) {
super(message, cause, context, possibleReason);
}
} | fvasquezjatar/fermat-unused | DMP/plugin/network_service/fermat-dmp-plugin-network-service-intra-user-bitdubai/src/main/java/com/bitdubai/fermat_dmp_plugin/layer/network_service/intra_user/developer/bitdubai/version_1/exceptions/CantPersistProfileImageException.java | Java | mit | 487 |
# flake8: noqa
"""
Tools for object-modeling OSC responses received from ``scsynth``.
"""
from .bases import Request, RequestBundle, Requestable, Response
from .buffers import (
BufferAllocateReadChannelRequest,
BufferAllocateReadRequest,
BufferAllocateRequest,
BufferCloseRequest,
BufferCopyRequest,
BufferFillRequest,
BufferFreeRequest,
BufferGenerateRequest,
BufferGetContiguousRequest,
BufferGetRequest,
BufferInfoResponse,
BufferNormalizeRequest,
BufferQueryRequest,
BufferReadChannelRequest,
BufferReadRequest,
BufferSetContiguousRequest,
BufferSetContiguousResponse,
BufferSetRequest,
BufferSetResponse,
BufferWriteRequest,
BufferZeroRequest,
)
from .buses import (
ControlBusFillRequest,
ControlBusGetContiguousRequest,
ControlBusGetRequest,
ControlBusSetContiguousRequest,
ControlBusSetContiguousResponse,
ControlBusSetRequest,
ControlBusSetResponse,
)
from .groups import (
GroupDeepFreeRequest,
GroupFreeAllRequest,
GroupNewRequest,
GroupQueryTreeRequest,
ParallelGroupNewRequest,
QueryTreeResponse,
)
from .movement import (
GroupHeadRequest,
GroupTailRequest,
MoveRequest,
NodeAfterRequest,
NodeBeforeRequest,
)
from .nodes import (
NodeFreeRequest,
NodeInfoResponse,
NodeMapToAudioBusRequest,
NodeMapToControlBusRequest,
NodeQueryRequest,
NodeRunRequest,
NodeSetContiguousResponse,
NodeSetRequest,
NodeSetResponse,
)
from .server import (
ClearScheduleRequest,
DoneResponse,
DumpOscRequest,
FailResponse,
NothingRequest,
NotifyRequest,
QuitRequest,
StatusRequest,
StatusResponse,
SyncRequest,
SyncedResponse,
)
from .synthdefs import (
SynthDefFreeAllRequest,
SynthDefFreeRequest,
SynthDefLoadDirectoryRequest,
SynthDefLoadRequest,
SynthDefReceiveRequest,
SynthDefRemovedResponse,
)
from .synths import SynthNewRequest, TriggerResponse
__all__ = [
"BufferAllocateReadChannelRequest",
"BufferAllocateReadRequest",
"BufferAllocateRequest",
"BufferCloseRequest",
"BufferCopyRequest",
"BufferFillRequest",
"BufferFreeRequest",
"BufferGenerateRequest",
"BufferGetContiguousRequest",
"BufferGetRequest",
"BufferInfoResponse",
"BufferNormalizeRequest",
"BufferQueryRequest",
"BufferReadChannelRequest",
"BufferReadRequest",
"BufferSetContiguousRequest",
"BufferSetContiguousResponse",
"BufferSetRequest",
"BufferSetResponse",
"BufferWriteRequest",
"BufferZeroRequest",
"ClearScheduleRequest",
"ControlBusFillRequest",
"ControlBusGetContiguousRequest",
"ControlBusGetRequest",
"ControlBusSetContiguousRequest",
"ControlBusSetContiguousResponse",
"ControlBusSetRequest",
"ControlBusSetResponse",
"DoneResponse",
"DumpOscRequest",
"FailResponse",
"GroupDeepFreeRequest",
"GroupDumpTreeRequest",
"GroupFreeAllRequest",
"GroupHeadRequest",
"GroupNewRequest",
"GroupQueryTreeRequest",
"GroupTailRequest",
"MoveRequest",
"NodeAfterRequest",
"NodeBeforeRequest",
"NodeCommandRequest",
"NodeFillRequest",
"NodeFreeRequest",
"NodeInfoResponse",
"NodeMapToAudioBusRequest",
"NodeMapToControlBusRequest",
"NodeOrderRequest",
"NodeQueryRequest",
"NodeRunRequest",
"NodeSetContiguousRequest",
"NodeSetContiguousResponse",
"NodeSetRequest",
"NodeSetResponse",
"NodeTraceRequest",
"NothingRequest",
"NotifyRequest",
"ParallelGroupNewRequest",
"QueryTreeResponse",
"QuitRequest",
"Request",
"RequestBundle",
"Requestable",
"Response",
"StatusRequest",
"StatusResponse",
"SyncRequest",
"SyncedResponse",
"SynthDefFreeAllRequest",
"SynthDefFreeRequest",
"SynthDefLoadDirectoryRequest",
"SynthDefLoadRequest",
"SynthDefReceiveRequest",
"SynthDefRemovedResponse",
"SynthNewRequest",
"TriggerResponse",
]
| josiah-wolf-oberholtzer/supriya | supriya/commands/__init__.py | Python | mit | 4,060 |
/*
* Copyright (c) 2007 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockito.plugins;
import org.mockito.Incubating;
import org.mockito.invocation.MockHandler;
import org.mockito.mock.MockCreationSettings;
/**
* The facility to create mocks.
*
* <p>By default, an internal cglib/asm/objenesis based implementation is used.</p>
*
* <p>{@code MockMaker} is an extension point that makes it possible to use custom dynamic proxies
* and avoid using the default cglib/asm/objenesis implementation.
* For example, the android users can use a MockMaker that can work with Dalvik virtual machine
* and hence bring Mockito to android apps developers.</p>
*
* <h3>Using the extension point</h3>
*
* <p>Suppose you wrote an extension to create mocks with some <em>Awesome</em> library, in order to tell
* Mockito to use it you need to put in your <strong>classpath</strong>:
* <ol style="list-style-type: lower-alpha">
* <li>The implementation itself, for example <code>org.awesome.mockito.AwesomeMockMaker</code> that extends the <code>MockMaker</code>.</li>
* <li>A file "<code>mockito-extensions/org.mockito.plugins.MockMaker</code>". The content of this file is
* exactly a <strong>one</strong> line with the qualified name: <code>org.awesome.mockito.AwesomeMockMaker</code>.</li>
* </ol></p>
*
* <p>Note that if several <code>mockito-extensions/org.mockito.plugins.MockMaker</code> files exists in the classpath
* Mockito will only use the first returned by the standard {@link ClassLoader#getResource} mechanism.
*
* @see org.mockito.mock.MockCreationSettings
* @see org.mockito.invocation.MockHandler
* @since 1.9.5
*/
@Incubating
public interface MockMaker {
/**
* If you want to provide your own implementation of {@code MockMaker} this method should:
* <ul>
* <li>Create a proxy object that implements {@code settings.typeToMock} and potentially also {@code settings.extraInterfaces}.</li>
* <li>You may use the information from {@code settings} to create/configure your proxy object.</li>
* <li>Your proxy object should carry the {@code hander} with it. For example, if you generate byte code
* to create the proxy you could generate an extra field to keep the {@code handler} with the generated object.
* Your implementation of {@code MockMaker} is required to provide this instance of {@code handler} when
* {@link #getHandler(Object)} is called.
* </li>
* </ul>
*
* @param settings - mock creation settings like type to mock, extra interfaces and so on.
* @param handler See {@link org.mockito.invocation.MockHandler}.
* <b>Do not</b> provide your own implementation at this time. Make sure your implementation of
* {@link #getHandler(Object)} will return this instance.
* @param <T> Type of the mock to return, actually the <code>settings.getTypeToMock</code>.
* @return The mock instance.
* @since 1.9.5
*/
<T> T createMock(
MockCreationSettings<T> settings,
MockHandler handler
);
/**
* Returns the handler for the {@code mock}. <b>Do not</b> provide your own implementations at this time
* because the work on the {@link MockHandler} api is not completed.
* Use the instance provided to you by Mockito at {@link #createMock} or {@link #resetMock}.
*
* @param mock The mock instance.
* @return may return null - it means that there is no handler attached to provided object.
* This means the passed object is not really a Mockito mock.
* @since 1.9.5
*/
MockHandler getHandler(Object mock);
/**
* Replaces the existing handler on {@code mock} with {@code newHandler}.
*
* <p>The invocation handler actually store invocations to achieve
* stubbing and verification. In order to reset the mock, we pass
* a new instance of the invocation handler.</p>
*
* <p>Your implementation should make sure the {@code newHandler} is correctly associated to passed {@code mock}</p>
*
* @param mock The mock instance whose invocation handler is to be replaced.
* @param newHandler The new invocation handler instance.
* @param settings The mock settings - should you need to access some of the mock creation details.
* @since 1.9.5
*/
void resetMock(
Object mock,
MockHandler newHandler,
MockCreationSettings settings
);
} | CyanogenMod/android_external_mockito | src/org/mockito/plugins/MockMaker.java | Java | mit | 4,575 |
package iglo
import (
"bytes"
"reflect"
"strings"
"testing"
)
func TestParse(t *testing.T) {
data, err := ParseMarkdown(strings.NewReader(dummyMarkdown))
if err != nil {
t.Errorf("ParseMarkdown() returned an error %s", err)
}
a, err := ParseJSON(bytes.NewBuffer(data))
if err == nil {
if !reflect.DeepEqual(a, dummyAPI) {
t.Errorf("ParseJSON() returned %+v, want %+v", a, dummyAPI)
}
}
}
| subosito/iglo | parser_test.go | GO | mit | 410 |
<?php
namespace Tsbc\Ptk\Helper;
class Text
{
private static $easy_chars = '2345679ACDEFGHJKMNPRSTUVWXYZ';
private static $hard_chars = 'AbCdEfGhIjKlMnOpQrStUvWxYz0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ';
public static function decodeInteger($input)
{
$out = 0;
$len = strlen($input);
$data = array_flip(str_split(self::$hard_chars));
$base = strlen(self::$hard_chars);
foreach (str_split($input) as $k => $v) {
$out = $out + $data[$v] * pow($base, $len - ($k + 1));
}
return $out;
}
public static function encodeInteger($input)
{
$out = array();
$data = self::$hard_chars;
$base = strlen(self::$hard_chars);
if (0 == $input) {
$out[] = $data[$input];
}
while (0 < $input) {
$rest = $input % $base;
$input = (int) ($input / $base);
$out[] = $data[$rest];
}
return implode(array_reverse($out));
}
public static function glueOrphans($input, $glue=' ')
{
return preg_replace('/\s([\dwuioaz]{1})\s/', ' \1' . $glue, $input);
}
public static function random($length=40, $easy=false)
{
$chars = ($easy) ? self::$easy_chars : self::$hard_chars;
$value = '';
$slen = strlen($chars) - 1;
while (strlen($value) < $length) {
$value .= $chars[mt_rand(0, $slen)];
}
return $value;
}
public static function truncate($input, $limit, $full_words=true, $trailing='...')
{
if(mb_strlen($input, 'UTF-8') <= $limit) {
return $input;
}
$out = mb_substr($input, 0, $limit, 'UTF-8');
if($full_words && $end = mb_strrpos($out, ' ', 0, 'UTF-8')) {
$out = mb_substr($out, 0, $end, 'UTF-8');
}
return $out . $trailing;
}
}
| mattstauffer/phptoolkit | src/Tsbc/Ptk/Helper/Text.php | PHP | mit | 1,903 |
from Qt import QtWidgets, QtCore, QtGui
import math
from . import resource
from .exc import *
class ControlLayout(QtWidgets.QGridLayout):
def __init__(self, columns=1, parent=None):
super(ControlLayout, self).__init__(parent)
self._columns = columns
self.setContentsMargins(20, 20, 20, 20)
self.setHorizontalSpacing(20)
self.setRowStretch(1000, 1)
self.widgets = []
@property
def columns(self):
return self._columns
@columns.setter
def columns(self, value):
self._columns = value
widgets = list(self.widgets)
for w in widgets:
self.takeWidget(w)
for w in widgets:
self.addWidget(w)
@property
def count(self):
return len(self.widgets)
def takeWidget(self, widget):
if widget not in self.widgets:
return None
self.widgets.pop(self.widgets.index(widget))
self.takeAt(self.indexOf(widget))
return widget
def addWidget(self, widget):
count = self.count
row = math.floor(count / self.columns)
column = (count % self.columns)
super(ControlLayout, self).addWidget(widget, row, column)
self.widgets.append(widget)
class FormWidget(QtWidgets.QWidget):
def __init__(self, name, columns=1, layout_horizontal=False, parent=None):
super(FormWidget, self).__init__(parent)
self.name = name
self.controls = {}
self.forms = {}
self.parent = parent
self.layout = QtWidgets.QVBoxLayout()
self.layout.setContentsMargins(0, 0, 0, 0)
self.layout.setSpacing(0)
self.setLayout(self.layout)
if layout_horizontal:
self.form_layout = QtWidgets.QBoxLayout(
QtWidgets.QBoxLayout.LeftToRight
)
else:
self.form_layout = QtWidgets.QBoxLayout(
QtWidgets.QBoxLayout.TopToBottom
)
self.form_layout.setContentsMargins(0, 0, 0, 0)
self.form_layout.setSpacing(0)
self.control_layout = ControlLayout(columns=columns)
self.form_layout.addLayout(self.control_layout)
self.layout.addLayout(self.form_layout)
self.setProperty('form', True)
self.setAttribute(QtCore.Qt.WA_StyledBackground, True)
@property
def valid(self):
is_valid = []
for name, control in self.controls.iteritems():
control.validate()
is_valid.append(control.valid)
for name, form in self.forms.iteritems():
is_valid.append(form.valid)
return all(is_valid)
def get_value(self, flatten=False):
'''Get the value of this forms fields and subforms fields.
:param flatten: If set to True, return a flattened dict
'''
form_data = {}
for name, control in self.controls.iteritems():
form_data[name] = control.get_value()
for name, form in self.forms.iteritems():
form_value = form.get_value(flatten=flatten)
if flatten:
form_data.update(form_value)
else:
form_data[name] = form_value
return form_data
def set_value(self, strict=True, **data):
'''Set the value of all the forms subforms and fields. You can pass
an additional keyword argument strict to False to ignore mismatched
names and subforms.
:param strict: raise exceptions for any invalid names in data
:param data: Field data used to set the values of the form
usage::
myform.set_value(
strict=True,
**{
'strfield': 'ABCDEFG',
'intfield': 1,
'subform': {
'subform_strfield': 'BCDEFGH',
'subform_intfield': 2,}},
)
'''
for name, value in data.iteritems():
if isinstance(value, dict):
try:
self.forms[name].set_value(**value)
except KeyError:
if strict:
raise FormNotFound(name + ' does not exist')
continue
try:
self.controls[name].set_value(value)
except KeyError:
if strict:
raise FieldNotFound(name + ' does not exist')
def add_header(self, title, description=None, icon=None):
'''Add a header'''
self.header = Header(title, description, icon, self)
self.layout.insertWidget(0, self.header)
def add_form(self, name, form):
'''Add a subform'''
self.form_layout.addWidget(form)
self.forms[name] = form
setattr(self, name, form)
def add_control(self, name, control):
'''Add a control'''
self.control_layout.addWidget(control.main_widget)
self.controls[name] = control
setattr(self, name, control)
class FormDialog(QtWidgets.QDialog):
def __init__(self, widget, *args, **kwargs):
super(FormDialog, self).__init__(*args, **kwargs)
self.widget = widget
self.cancel_button = QtWidgets.QPushButton('&cancel')
self.accept_button = QtWidgets.QPushButton('&accept')
self.cancel_button.clicked.connect(self.reject)
self.accept_button.clicked.connect(self.on_accept)
self.layout = QtWidgets.QGridLayout()
self.layout.setContentsMargins(0, 0, 0, 0)
self.layout.setRowStretch(1, 1)
self.setLayout(self.layout)
self.button_layout = QtWidgets.QHBoxLayout()
self.button_layout.setContentsMargins(20, 20, 20, 20)
self.button_layout.addWidget(self.cancel_button)
self.button_layout.addWidget(self.accept_button)
self.layout.addWidget(self.widget, 0, 0)
self.layout.addLayout(self.button_layout, 2, 0)
def __getattr__(self, attr):
try:
return getattr(self.widget, attr)
except AttributeError:
raise AttributeError('FormDialog has no attr: {}'.format(attr))
def on_accept(self):
if self.widget.valid:
self.accept()
return
class FormGroup(QtWidgets.QWidget):
toggled = QtCore.Signal(bool)
def __init__(self, widget, *args, **kwargs):
super(FormGroup, self).__init__(*args, **kwargs)
self.widget = widget
self.widget.setProperty('groupwidget', True)
self.layout = QtWidgets.QVBoxLayout()
self.layout.setContentsMargins(0, 0, 0, 0)
self.layout.setStretch(1, 0)
self.layout.setSpacing(0)
self.setLayout(self.layout)
self.title = QtWidgets.QPushButton(self.widget.name)
icon = QtGui.QIcon()
icon.addPixmap(
QtGui.QPixmap(':/icons/plus'),
QtGui.QIcon.Normal,
QtGui.QIcon.Off
)
icon.addPixmap(
QtGui.QPixmap(':/icons/minus'),
QtGui.QIcon.Normal,
QtGui.QIcon.On
)
self.title.setIcon(icon)
self.title.setProperty('grouptitle', True)
self.title.setCheckable(True)
self.title.setChecked(True)
self.title.toggled.connect(self.toggle_collapsed)
self.layout.addWidget(self.title)
self.layout.addWidget(self.widget)
def set_enabled(self, value):
self.title.blockSignals(True)
self.title.setChecked(value)
self.widget.setVisible(value)
self.title.blockSignals(False)
def toggle_collapsed(self, collapsed):
self.toggled.emit(collapsed)
self.widget.setVisible(self.title.isChecked())
def __getattr__(self, attr):
try:
return getattr(self.widget, attr)
except AttributeError:
raise AttributeError('FormDialog has no attr: {}'.format(attr))
class Header(QtWidgets.QWidget):
def __init__(self, title, description=None, icon=None, parent=None):
super(Header, self).__init__(parent)
self.grid = QtWidgets.QGridLayout()
self.setLayout(self.grid)
self.title = QtWidgets.QLabel(title)
self.title.setProperty('title', True)
if description:
self.descr = QtWidgets.QLabel(description)
self.descr.setProperty('description', True)
self.descr.setAlignment(QtCore.Qt.AlignCenter)
if icon:
self.icon = QtWidgets.QLabel()
self.icon.setPixmap(icon)
self.grid.addWidget(self.icon, 0, 0)
self.grid.addWidget(self.title, 0, 1)
self.grid.addWidget(self.descr, 1, 0, 1, 2)
else:
self.grid.addWidget(self.title, 0, 0)
self.grid.addWidget(self.descr, 1, 0)
self.title.setAlignment(QtCore.Qt.AlignCenter)
self.setProperty('header', True)
self.setAttribute(QtCore.Qt.WA_StyledBackground, True)
self._mouse_button = None
self._mouse_last_pos = None
def mousePressEvent(self, event):
self._mouse_button = event.button()
super(Header, self).mousePressEvent(event)
self._window = self.window()
def mouseMoveEvent(self, event):
'''Click + Dragging moves window'''
if self._mouse_button == QtCore.Qt.LeftButton:
if self._mouse_last_pos:
p = self._window.pos()
v = event.globalPos() - self._mouse_last_pos
self._window.move(p + v)
self._mouse_last_pos = event.globalPos()
super(Header, self).mouseMoveEvent(event)
def mouseReleaseEvent(self, event):
self._mouse_button = None
self._mouse_last_pos = None
self._window = None
super(Header, self).mouseReleaseEvent(event)
class ScalingImage(QtWidgets.QLabel):
__images = {}
def __init__(self, image=None, parent=None):
super(ScalingImage, self).__init__(parent)
self.images = self.__images
if not image:
image = ':/images/noimg'
self.set_image(image)
self.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
QtWidgets.QSizePolicy.Expanding)
def set_image(self, image):
if image not in self.images:
if not isinstance(image, QtGui.QImage):
if not QtCore.QFile.exists(image):
return
self.img = QtGui.QImage(image)
self.images[image] = self.img
else:
self.img = self.images[image]
self.setMinimumSize(227, 128)
self.scale_pixmap()
self.repaint()
def scale_pixmap(self):
scaled_image = self.img.scaled(
self.width(),
self.height(),
QtCore.Qt.KeepAspectRatioByExpanding,
QtCore.Qt.FastTransformation)
self.pixmap = QtGui.QPixmap(scaled_image)
def resizeEvent(self, event):
self.do_resize = True
super(ScalingImage, self).resizeEvent(event)
def paintEvent(self, event):
if self.do_resize:
self.scale_pixmap()
self.do_resize = False
offsetX = -((self.pixmap.width() - self.width()) * 0.5)
offsetY = -((self.pixmap.height() - self.height()) * 0.5)
painter = QtGui.QPainter(self)
painter.drawPixmap(offsetX, offsetY, self.pixmap)
class IconButton(QtWidgets.QPushButton):
'''A button with an icon.
:param icon: path to icon file or resource
:param tip: tooltip text
:param name: object name
:param size: width, height tuple (default: (32, 32))
'''
def __init__(self, icon, tip, name, size=(32, 32), *args, **kwargs):
super(IconButton, self).__init__(*args, **kwargs)
self.setObjectName(name)
self.setIcon(QtGui.QIcon(icon))
self.setIconSize(QtCore.QSize(*size))
self.setSizePolicy(
QtWidgets.QSizePolicy.Fixed,
QtWidgets.QSizePolicy.Fixed)
self.setFixedHeight(size[0])
self.setFixedWidth(size[1])
self.setToolTip(tip)
| danbradham/psforms | psforms/widgets.py | Python | mit | 12,100 |
import React from 'react';
import Home from '../../../src/routes/Home/';
import Search from '../../../src/containers/SearchContainer/';
import Repositories from '../../../src/containers/RepositoriesContainer/';
import { shallow } from 'enzyme';
describe('(Route) Home', () => {
let wrapper;
beforeEach(() => {
wrapper = shallow(<Home />);
});
it('renders successfully', () => {
expect(wrapper).to.have.length(1);
});
it('renders a SearchContainer', () => {
expect(wrapper.find(Search)).to.have.length(1);
});
it('renders a RepositoriesContainer', () => {
expect(wrapper.find(Repositories)).to.have.length(1);
});
});
| DeloitteDigitalUK/react-redux-starter-app | tests/routes/Home/Home.spec.js | JavaScript | mit | 656 |
#!/usr/bin/env node
'use strict';
var dot = require('dot');
var defaults = require('defaults');
var fs = require('fs');
var path = require('path');
var rat = require('rat');
var options = defaults({
strip: false,
selfcontained: true
}, dot.templateSettings);
var licenses = {};
rat.ls(path.resolve(__dirname, './licenses'), function(err, files) {
if (err) { return; }
var expected = files.length - 1;
files.forEach(function(file) {
var license = path.basename(file.path, '.txt');
fs.readFile(file.path, 'utf8', function(err, data) {
if (err) { return; }
licenses[license] = dot.template(data, options).toString().replace('anonymous', license);
if (--expected <= 0) {
var out = 'module.exports = {';
Object.keys(licenses).forEach(function(license, idx, array) {
out += license + ':' + licenses[license];
if (idx < array.length - 1) {
out += ',';
}
});
out += '}';
fs.writeFile(path.resolve(__dirname, './lib/licenses.js'), out, 'utf8', function(err) {
if (err) { return; }
});
}
});
});
});
| adoyle-h/gulp-license | build.js | JavaScript | mit | 1,069 |
webpackJsonp([0,1],[
/* 0 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
__webpack_require__(1);
__webpack_require__(3);
__webpack_require__(13);
__webpack_require__(15);
__webpack_require__(28);
__webpack_require__(30);
__webpack_require__(32);
console.log('src');
/***/ },
/* 1 */
/***/ function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ },
/* 2 */,
/* 3 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
__webpack_require__(4);
__webpack_require__(5);
__webpack_require__(7);
__webpack_require__(9);
__webpack_require__(11);
/***/ },
/* 4 */
/***/ function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ },
/* 5 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
__webpack_require__(6);
/***/ },
/* 6 */
/***/ function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ },
/* 7 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
__webpack_require__(8);
/***/ },
/* 8 */
/***/ function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ },
/* 9 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
__webpack_require__(10);
/***/ },
/* 10 */
/***/ function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ },
/* 11 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
__webpack_require__(12);
/***/ },
/* 12 */
/***/ function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ },
/* 13 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
__webpack_require__(14);
console.log('data');
/***/ },
/* 14 */
/***/ function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ },
/* 15 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
__webpack_require__(16);
__webpack_require__(17);
__webpack_require__(19);
__webpack_require__(21);
__webpack_require__(23);
__webpack_require__(26);
console.log('form');
/***/ },
/* 16 */
/***/ function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ },
/* 17 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
__webpack_require__(18);
/***/ },
/* 18 */
/***/ function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ },
/* 19 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
__webpack_require__(20);
/***/ },
/* 20 */
/***/ function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ },
/* 21 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
__webpack_require__(22);
/***/ },
/* 22 */
/***/ function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ },
/* 23 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
__webpack_require__(24);
var _basic = __webpack_require__(25);
var _basic2 = _interopRequireDefault(_basic);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var $ = _basic2.default.$;
var $$ = _basic2.default.$$;
var inputNum = $$('.g-input--num');
var input = $('input', inputNum);
var min = $('.min', inputNum);
var plus = $('.plus', inputNum);
input.forEach(function (item) {
item.dataset.counter = item.value = 0;
item.addEventListener('input', function () {
var oldVal = item.value;
item.value = parseInt(oldVal.replace(/[^\d]/g, ''), 10) || 0;
});
item.addEventListener('keyup', function (e) {
var keyCode = e.keyCode;
if (keyCode != _basic2.default.keyCode.up && keyCode != _basic2.default.keyCode.down) {
return;
}
var curCounter = parseInt(item.dataset.counter, 10);
var maxValue = item.dataset.max || 0;
var max = parseInt(maxValue, 10);
var stepValue = item.dataset.step || 1;
var step = parseInt(stepValue, 10);
if (keyCode == _basic2.default.keyCode.up) {
if (max > 0 && curCounter >= max) {
return;
}
var newVal = curCounter + step;
if (max > 0 && newVal > max) {
newVal = max;
}
item.dataset.counter = item.value = newVal;
} else if (keyCode == _basic2.default.keyCode.down) {
if (curCounter !== 0) {
var _newVal = curCounter - step;
if (_newVal < 0) {
_newVal = 0;
}
item.dataset.counter = item.value = _newVal;
}
}
});
});
min.forEach(function (item) {
var parent = item.parentNode;
var input = $('input', parent);
item.addEventListener('click', function () {
var curCounter = parseInt(input.dataset.counter, 10);
var stepValue = input.dataset.step || 1;
var step = parseInt(stepValue, 10);
if (curCounter !== 0) {
var newVal = curCounter - step;
if (newVal < 0) {
newVal = 0;
}
input.dataset.counter = input.value = newVal;
}
});
});
plus.forEach(function (item) {
var parent = item.parentNode;
var input = $('input', parent);
item.addEventListener('click', function () {
var curCounter = parseInt(input.dataset.counter, 10);
var maxValue = input.dataset.max || 0;
var max = parseInt(maxValue, 10);
var stepValue = input.dataset.step || 1;
var step = parseInt(stepValue, 10);
if (max > 0 && curCounter >= max) {
return;
}
var newVal = curCounter + step;
if (max > 0 && newVal > max) {
newVal = max;
}
input.dataset.counter = input.value = newVal;
});
});
console.log(inputNum, input, min, plus);
/***/ },
/* 24 */
/***/ function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ },
/* 25 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
exports.default = {
$: function $(selector) {
var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document;
if (context instanceof NodeList) {
return Array.from(context, function (node) {
return node.querySelector(selector);
});
}
return context.querySelector(selector);
},
$$: function $$(selector) {
var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document;
if (context instanceof NodeList) {
return Array.from(context, function (node) {
return node.querySelectorAll(selector);
});
}
return context.querySelectorAll(selector);
},
create: function create() {
var tagName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'div';
var attrs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var node = document.createElement(tagName);
for (var key in attrs) {
node.setAttribute(key, attrs[key]);
}
return node;
},
attr: function attr(node, _attr) {
var newVal = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
if (newVal) {
node.setAttribute(_attr, newVal);
return;
}
return node.getAttribute(_attr);
},
attrs: function attrs(node) {
var attrs = {};
Array.from(node.attributes).forEach(function (attr) {
var attrName = attr.nodeName;
attrs[attrName] = node.getAttribute(attrName);
});
return attrs;
},
class: function _class(node, className) {
var remove = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
if (remove) {
node.classList.remove(className);
return;
}
if (Array.isArray(className)) {
var _node$classList;
(_node$classList = node.classList).add.apply(_node$classList, _toConsumableArray(className));
return;
}
node.classList.add(className);
},
css: function css(node, styles) {
node.style.cssText = node.style.cssText ? node.style.cssText += styles : styles;
},
vdom: function () {
function VDOM() {
var tagName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'div';
var attrs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var children = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
_classCallCheck(this, VDOM);
this.tagName = tagName;
this.attrs = attrs;
this.children = Array.isArray(children) ? children : Array.from(children);
this.event = [];
}
_createClass(VDOM, [{
key: 'render',
value: function render() {
var node = document.createElement(this.tagName);
var attrs = this.attrs;
for (var attr in attrs) {
node.setAttribute(attr, attrs[attr]);
}
if (this.event.length) {
this.event.forEach(function (eachEvent) {
node.addEventListener(eachEvent.eventName, eachEvent.callback);
});
}
var children = this.children;
Array.from(children).forEach(function (child) {
var childEl = child instanceof VDOM ? child.render() : document.createTextNode(child);
node.appendChild(childEl);
});
return node;
}
}, {
key: 'addEvent',
value: function addEvent(eventName, callback) {
this.event.push({
eventName: eventName,
callback: callback
});
}
}]);
return VDOM;
}(),
keyCode: {
'up': 38,
'down': 40
}
};
/***/ },
/* 26 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
__webpack_require__(27);
var _basic = __webpack_require__(25);
var _basic2 = _interopRequireDefault(_basic);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var select = _basic2.default.$$('.g-select');
var vdom = _basic2.default.vdom;
select.forEach(function (item) {
var tmpFragment = document.createDocumentFragment();
var parentNode = item.parentNode;
var nodeAttrs = _basic2.default.attrs(item);
var options = [];
var optionsOriginal = _basic2.default.$$('option', item);
var selected = { value: '', text: '' };
var child = void 0;
optionsOriginal.forEach(function (child) {
var text = child.innerText;
var attrs = _basic2.default.attrs(child);
if ('selected' in attrs) {
selected.text = text;
selected.value = attrs['value'];
}
var listItem = new vdom('li', attrs, [text]);
listItem.addEvent('click', function (e) {
var li = e.target;
var ul = li.parentNode;
var parent = ul.parentNode;
var input = _basic2.default.$('input', parent);
if (_basic2.default.attr(li, 'disabled')) {
return;
}
parent.classList.remove('slideDown');
input.value = li.innerText;
_basic2.default.attr(input, 'data-value', _basic2.default.attr(li, 'value'));
});
options.push(listItem);
});
var selectList = new vdom('ul', {}, options);
if (selected.value === '') {
selected.text = optionsOriginal[0].innerText;
selected.value = optionsOriginal[0].getAttribute('value');
}
var input = new vdom('input', {
type: 'text',
name: nodeAttrs.name,
readonly: true,
value: selected.text,
'data-value': selected.value
});
input.addEvent('click', function (e) {
var parent = e.target.parentNode;
parent.classList.toggle('slideDown');
});
var node = new vdom('div', {
class: 'g-selector'
}, [input, selectList]);
var nodeRendered = node.render();
parentNode.insertBefore(nodeRendered, item);
item.remove();
});
/***/ },
/* 27 */
/***/ function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ },
/* 28 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
__webpack_require__(29);
console.log('navigation');
/***/ },
/* 29 */
/***/ function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ },
/* 30 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
__webpack_require__(31);
console.log('notice');
/***/ },
/* 31 */
/***/ function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ },
/* 32 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
__webpack_require__(33);
console.log('others');
/***/ },
/* 33 */
/***/ function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }
]);
//# sourceMappingURL=index.84d6416787a648d52de3.js.map | gongpeione/gecom | docs/js/index.84d6416787a648d52de3.js | JavaScript | mit | 14,763 |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// needed for filehandling
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
using System;
[Serializable]
public class Para : Character {
public static int paraCount = 0;
public Para(string faction){
paraCount++;
//Display = Resources.Load<CharacterHolder> ("Prefabs/CharacterHolder") as CharacterHolder;
C_ID = paraCount;
C_Name = "Para";
if (faction == "US") {
C_Image = Resources.Load<Texture> ("Images/Characters/US/Para/USPARA");
Faction = C_Faction.US;
} else if (faction == "GERMANY") {
C_Image = Resources.Load<Texture> ("Images/Characters/GERMANY/Para/5portrait");
Faction = C_Faction.GERMANY;
} else if (faction == "SOVIET") {
C_Image = Resources.Load<Texture> ("Images/Characters/SOVIET/Para/30portrait");
Faction = C_Faction.SOVIET;
}
Rank = C_Rank.Private;
Type = C_Type.Para;
//AssaultTeamsDeployed = new List<AssaultTeam> ();
}
// Use this for initialization
void Start () {
}
}
| jengske/HeroesAndGeneralsManager | Scripts/CharacterScripts/Para.cs | C# | mit | 1,056 |
import re
_regex_default = re.compile('\S+')
def parse_save_file(filedata):
detectors, sources = [], []
for line in filedata:
if line.startswith('[SOURCE]'):
data = _regex_default.findall(line[len('[SOURCE]'):])
name, isotope, m, d_cover, mat_cover, pos, activity = data
pos = (0, 0, float(pos))
if m.lower() == 'none':
m = None
activity = float(activity)
else:
activity = None
m = float(m)
d_cover = float(d_cover)
args = name, isotope, m, d_cover, mat_cover, pos, activity
sources.append(args)
elif line.startswith('[DETECTOR]'):
data = _regex_default.findall(line[len('[DETECTOR]'):])
name, pos, q, d, mat, d_cover, mat_cover = data
pos = (0, 0, float(pos))
q = float(q)
d = float(d)
d_cover = float(d_cover)
args = name, pos, q, d, mat, d_cover, mat_cover
detectors.append(args)
return detectors, sources
def parse_isotope_file(filedata):
const_time = {'s': 1., 'm': 60., 'h': 3600., 'd': 86400., 'y': 31577600.}
SPECTRUM = []
try:
header = _regex_default.findall(filedata.pop(0))
NAME, MOLAR, HALF_LIFE = header[:3]
FLAGS = header[3:]
if HALF_LIFE[-1] in const_time:
HALF_LIFE = const_time[HALF_LIFE[-1]] * float(HALF_LIFE[:-1])
else:
HALF_LIFE = float(HALF_LIFE)
for line in filedata:
band = _regex_default.findall(line)
e, p = band[:2]
SPECTRUM.append((float(e) * 0.001, float(p) * 0.01))
return NAME, FLAGS, float(MOLAR), float(HALF_LIFE), SPECTRUM
except Exception as err:
print(err)
return None
def parse_material_file(filedata):
try:
NAME, DENSITY = _regex_default.findall(filedata.pop(0))
ATTENUATIONS = []
k_ph = 0
for line in filedata:
_l = _regex_default.findall(line)
e, k = float(_l[0]), float(_l[1])
if len(_l) > 2:
k_ph = float(_l[2])
ATTENUATIONS.append((e, k, k_ph))
_v1 = (0, ATTENUATIONS[0][1], ATTENUATIONS[0][2])
_v2 = (200000, 0, 0)
ATTENUATIONS = [_v1] + ATTENUATIONS + [_v2]
return NAME, float(DENSITY), ATTENUATIONS
except Exception as err:
print(err)
return None
| industrialsynthfreak/xr3 | nist.py | Python | mit | 2,046 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('app', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='waypoint_event',
name='name',
),
]
| flipjack/misrutas | project/app/migrations/0002_remove_waypoint_event_name.py | Python | mit | 343 |
# import jinja2
import flask as fk
from corrdb.common.core import setup_app
import tarfile
from StringIO import StringIO
from io import BytesIO
import zipfile
import json
import time
import boto3
import traceback
app = setup_app(__name__)
s3 = boto3.resource('s3')
# Templates
# loader = jinja2.PackageLoader('cloud', 'templates')
# template_env = jinja2.Environment(autoescape=True, loader=loader)
# template_env.globals.update(url_for=fk.url_for)
# template_env.globals.update(get_flashed_messages=fk.get_flashed_messages)
#Remove templates
#include admin power everywhere here.
# Stormpath
from flask.ext.stormpath import StormpathManager
stormpath_manager = StormpathManager(app)
from datetime import date, timedelta
from functools import update_wrapper
def get_week_days(year, week):
d = date(year,1,1)
if(d.weekday()>3):
d = d+timedelta(7-d.weekday())
else:
d = d - timedelta(d.weekday())
dlt = timedelta(days = (week-1)*7)
return d + dlt, d + dlt + timedelta(days=6)
def find_week_days(year, current):
index = 1
while True:
if index == 360:
break
interval = get_week_days(year, index)
if current > interval[0] and current < interval[1]:
return interval
index +=1
class InMemoryZip(object):
def __init__(self):
# Create the in-memory file-like object
self.in_memory_zip = StringIO()
def append(self, filename_in_zip, file_contents):
'''Appends a file with name filename_in_zip and contents of
file_contents to the in-memory zip.'''
# Get a handle to the in-memory zip in append mode
zf = zipfile.ZipFile(self.in_memory_zip, "a", zipfile.ZIP_DEFLATED, False)
# Write the file to the in-memory zip
zf.writestr(filename_in_zip, file_contents)
# Mark the files as having been created on Windows so that
# Unix permissions are not inferred as 0000
for zfile in zf.filelist:
zfile.create_system = 0
return self
def read(self):
'''Returns a string with the contents of the in-memory zip.'''
self.in_memory_zip.seek(0)
return self.in_memory_zip.read()
def writetofile(self, filename):
'''Writes the in-memory zip to a file.'''
f = file(filename, "w")
f.write(self.read())
f.close()
def crossdomain(origin=None, methods=None, headers=None,
max_age=21600, attach_to_all=True,
automatic_options=True):
if methods is not None:
methods = ', '.join(sorted(x.upper() for x in methods))
if headers is not None and not isinstance(headers, basestring):
headers = ', '.join(x.upper() for x in headers)
if not isinstance(origin, basestring):
origin = ', '.join(origin)
if isinstance(max_age, timedelta):
max_age = max_age.total_seconds()
def get_methods():
if methods is not None:
return methods
options_resp = app.make_default_options_response()
return options_resp.headers['allow']
def decorator(f):
def wrapped_function(*args, **kwargs):
if automatic_options and fk.request.method == 'OPTIONS':
resp = app.make_default_options_response()
else:
resp = fk.make_response(f(*args, **kwargs))
if not attach_to_all and fk.request.method != 'OPTIONS':
return resp
h = resp.headers
h['Access-Control-Allow-Origin'] = origin
h['Access-Control-Allow-Methods'] = get_methods()
h['Access-Control-Max-Age'] = str(max_age)
if headers is not None:
h['Access-Control-Allow-Headers'] = headers
return resp
f.provide_automatic_options = False
return update_wrapper(wrapped_function, f)
return decorator
def load_bundle(record):
# Include record files later.
memory_file = BytesIO()
with zipfile.ZipFile(memory_file, 'w') as zf:
try:
bundle_buffer = StringIO()
# with open(record.container.image['location'], 'rb') as fh:
# image_buffer.write(fh.read())
# res = key.get_contents_to_filename(record.container.image['location'])
# s3_client = boto3.client('s3')
# res = s3_client.get_object(Bucket='ddsm-bucket', Key=record.container.image['location'])
obj = s3.Object(bucket_name='reproforge-bundles', key=record.environment.bundle['location'])
res = obj.get()
bundle_buffer.write(res['Body'].read())
bundle_buffer.seek(0)
data = zipfile.ZipInfo("%s"%(record.project.name, record.environment.bundle['location'].split('_')))
data.date_time = time.localtime(time.time())[:6]
data.compress_type = zipfile.ZIP_DEFLATED
data.external_attr |= 0777 << 16L # -rwx-rwx-rwx
zf.writestr(data, bundle_buffer.read())
except:
print traceback.print_exc()
try:
json_buffer = StringIO()
json_buffer.write(record.to_json())
json_buffer.seek(0)
data = zipfile.ZipInfo("%s_%s.json"%(record.project.name, str(record.id)))
data.date_time = time.localtime(time.time())[:6]
data.compress_type = zipfile.ZIP_DEFLATED
data.external_attr |= 0777 << 16L # -rwx-rwx-rwx
zf.writestr(data, json_buffer.read())
except:
print traceback.print_exc()
memory_file.seek(0)
# imz.append('record.tar', image_buffer.read()).append("record.json", json_buffer.read())
# print record.container.image['location'].split("/")[-1].split(".")[0]+".zip"
return [memory_file, record.environment.bundle['location'].split("/")[-1].split(".")[0]+".zip"]
def delete_project_files(project):
s3_files = s3.Bucket('reproforge-pictures')
s3_bundles = s3.Bucket('reproforge-bundles')
from corrdb.common.models import ProjectModel
from corrdb.common.models import RecordModel
from corrdb.common.models import EnvironmentModel
from corrdb.common.models import FileModel
for record in project.records:
for _file in record.files:
s3_files.delete_key(_file.location)
for environment_id in project.history:
_environment = EnvironmentModel.objects.with_id(environment_id)
if _environment.bundle["scope"] == "local":
s3_bundles.delete_key(_environment.bundle["location"])
del _environment
def delete_record_files(record):
s3_files = s3.Bucket('reproforge-pictures')
from corrdb.common.models import RecordModel
from corrdb.common.models import FileModel
for record in project.records:
for _file in record.files:
s3_files.delete_key(_file.location)
def delete_record_file(record_file):
s3_files = s3.Bucket('reproforge-pictures')
s3_files.delete_key(record_file.location)
def load_file(file_model):
file_buffer = StringIO()
obj = s3.Object(bucket_name='reproforge-files', key=file_model.location)
res = obj.get()
file_buffer.write(res['Body'].read())
file_buffer.seek(0)
return [file_buffer, file_model.location.split('_')[1]]
def load_picture(profile):
picture_buffer = StringIO()
obj = s3.Object(bucket_name='reproforge-pictures', key=profile.picture['location'])
res = obj.get()
picture_buffer.write(res['Body'].read())
picture_buffer.seek(0)
return [picture_buffer, digest]
def upload_bundle(current_user, environment, file_obj):
dest_filename = str(current_user.id)+"-"+str(environment.id)+"_%s"%file_obj.filename #kind is record| signature
print "About to write..."
try:
s3.Bucket('reproforge-bundles').put_object(Key=str(current_user.id)+"-"+str(environment.id)+"_%s"%file_obj.filename, Body=file_obj.read())
environment.bundle['location'] = dest_filename
environment.bundle['size'] = file_obj.tell()
print "%s saving..."%file_obj.filename
environment.save()
return True
except:
return False
print traceback.print_exc()
def upload_file(current_user, file_model, file_obj):
dest_filename = str(current_user.id)+"-"+str(file_model.record.id)+"_%s"%file_obj.filename #kind is record| signature
print "About to write..."
try:
s3.Bucket('reproforge-files').put_object(Key=str(current_user.id)+"-"+str(record.id)+"_%s"%file_obj.filename, Body=file_obj.read())
file_model.location = dest_filename
file_model.size = file_obj.tell()
print "%s saving..."%file_obj.filename
file_model.save()
return True
except:
return False
print traceback.print_exc()
def upload_picture(current_user, file_obj):
dest_filename = str(current_user.id) #kind is record| signature
print "About to write..."
try:
s3.Bucket('reproforge-pictures').put_object(Key=str(current_user.id)+"."+file_obj.filename.split('.')[-1], Body=file_obj.read())
print "%s saving..."%file_obj.filename
return True
except:
return False
print traceback.print_exc()
CLOUD_VERSION = 1
CLOUD_URL = '/cloud/v{0}'.format(CLOUD_VERSION)
from . import views
from corrdb.common import models
from . import filters
| wd15/corr | corr-cloud/cloud/__init__.py | Python | mit | 9,419 |
// Flow Burp Extension, (c) 2015-2019 Marcin Woloszyn (@hvqzao), Released under MIT license
package hvqzao.flow;
import hvqzao.flow.ui.DialogWrapper;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.WindowEvent;
import java.awt.event.WindowFocusListener;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.regex.Pattern;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.RowFilter;
import javax.swing.ScrollPaneConstants;
import javax.swing.SwingUtilities;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableColumn;
import javax.swing.table.TableModel;
import javax.swing.table.TableRowSorter;
import burp.IBurpExtender;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IExtensionStateListener;
import burp.IHttpListener;
import burp.IHttpRequestResponse;
import burp.IHttpRequestResponsePersisted;
import burp.IHttpService;
import burp.IMessageEditor;
import burp.IMessageEditorController;
import burp.IParameter;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScopeChangeListener;
import burp.ITab;
import hvqzao.flow.ui.BooleanTableCellRenderer;
import hvqzao.flow.ui.ThemeHelper;
import java.awt.Dialog;
import java.io.PrintWriter;
import java.util.List;
import javax.swing.JComponent;
import javax.swing.JMenu;
import javax.swing.RowSorter;
import javax.swing.SortOrder;
import javax.swing.SwingWorker;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.event.RowSorterEvent;
import javax.swing.event.RowSorterListener;
public class FlowExtension implements IBurpExtender, ITab, IHttpListener, IScopeChangeListener, IExtensionStateListener {
private final String version = "Flow v1.25 (2020-12-16)";
//
// Changes in v1.25:
// - fixed support for Dark mode, contribution of Jem Jensen, Thank You!
//
// Changes in v1.24:
// - rows coloring is now disabled on dark theme
// - reflections count display limit introduced
//
// Changes in v1.23:
// - Center "Add new sitemap issue" dialog, resize according to preferred size
// - Filter by search term does not break window anymore when search is too long
// - Displaying path instead of pathQuery in URL column
// - Added out-of-scope filter
//
//private final String versionFull = "<html>" + version + ", <a href=\"https://github.com/hvqzao/burp-flow\">https://github.com/hvqzao/burp-flow</a>, MIT license</html>";
private static IBurpExtenderCallbacks callbacks;
private static IExtensionHelpers helpers;
private JPanel flowComponent;
private JSplitPane flowTab;
private FlowTableModel flowTableModel;
private TableRowSorter<FlowTableModel> flowTableSorter;
private final ArrayList<FlowEntry> flow = new ArrayList<>();
private static final ArrayList<FlowEntry> FLOW_INCOMPLETE = new ArrayList<>();
private FlowTable flowTable;
private FlowEntryEditor flowEntryEditor;
private IMessageEditor flowReqView;
private IMessageEditor flowRespView;
private FlowEntry flowCurrentEntry;
private boolean flowFilterPopupReady;
private JLabel flowFilter;
private JCheckBox flowFilterInscope;
private JCheckBox flowFilterOutofscope;
private JCheckBox flowFilterParametrized;
private JTextField flowFilterSearchField;
private JCheckBox flowFilterSearchCaseSensitive;
private JCheckBox flowFilterSearchNegative;
private JCheckBox flowFilterSearchRegex;
private JCheckBox flowFilterSearchRequest;
private JCheckBox flowFilterSearchResponse;
private JCheckBox flowFilterSourceTarget;
private JCheckBox flowFilterSourceTargetOnly;
private JCheckBox flowFilterSourceProxy;
private JCheckBox flowFilterSourceProxyOnly;
private JCheckBox flowFilterSourceSpider;
private JCheckBox flowFilterSourceSpiderOnly;
private JCheckBox flowFilterSourceScanner;
private JCheckBox flowFilterSourceScannerOnly;
private JCheckBox flowFilterSourceRepeater;
private JCheckBox flowFilterSourceRepeaterOnly;
private JCheckBox flowFilterSourceIntruder;
private JCheckBox flowFilterSourceIntruderOnly;
private JCheckBox flowFilterSourceExtender;
private JCheckBox flowFilterSourceExtenderOnly;
private JPanel flowFilterBottom;
private FlowTablePopup flowTablePopup;
private FlowEntry popupPointedFlowEntry;
private FlowTableCellRenderer flowTableCellRenderer;
private JFrame burpFrame;
private boolean burpFree;
// private boolean flowFilterHelpExtPopupReady;
private boolean flowFilterSourceTargetOnlyOrig;
private boolean flowFilterSourceProxyOnlyOrig;
private boolean flowFilterSourceSpiderOnlyOrig;
private boolean flowFilterSourceScannerOnlyOrig;
private boolean flowFilterSourceRepeaterOnlyOrig;
private boolean flowFilterSourceIntruderOnlyOrig;
private boolean flowFilterSourceExtenderOnlyOrig;
private JCheckBox flowFilterCaptureSourceTarget;
private JCheckBox flowFilterCaptureSourceTargetOnly;
private JCheckBox flowFilterCaptureSourceProxy;
private JCheckBox flowFilterCaptureSourceProxyOnly;
private JCheckBox flowFilterCaptureSourceSpider;
private JCheckBox flowFilterCaptureSourceSpiderOnly;
private JCheckBox flowFilterCaptureSourceScanner;
private JCheckBox flowFilterCaptureSourceScannerOnly;
private JCheckBox flowFilterCaptureSourceRepeater;
private JCheckBox flowFilterCaptureSourceRepeaterOnly;
private JCheckBox flowFilterCaptureSourceIntruder;
private JCheckBox flowFilterCaptureSourceIntruderOnly;
private JCheckBox flowFilterCaptureSourceExtender;
private JCheckBox flowFilterCaptureSourceExtenderOnly;
private boolean flowFilterCaptureSourceTargetOnlyOrig;
private boolean flowFilterCaptureSourceProxyOnlyOrig;
private boolean flowFilterCaptureSourceSpiderOnlyOrig;
private boolean flowFilterCaptureSourceScannerOnlyOrig;
private boolean flowFilterCaptureSourceRepeaterOnlyOrig;
private boolean flowFilterCaptureSourceIntruderOnlyOrig;
private boolean flowFilterCaptureSourceExtenderOnlyOrig;
private final ArrayList<JDialog> dialogs = new ArrayList<>();
// private static final int adHeight = 42;
// private String[] ads = {
// "<html><p style=\"text-align: center\">Generate beautiful, concise, MS Word-templated reports from Burp, HP WebInspect or just manually written yaml/json files in minutes! It is completely cost-free, opensource, solution! Visit <a href=\"http://github.com/hvqzao/report-ng\">http://github.com/hvqzao/report-ng</a> to learn more.</p></html>",
// "<html><p style=\"text-align: center\">Are you tired seeing of too many Burp UI main tabs because of number of extensions Installed? Check out \"Wildcard\" solution <a href=\"http://github.com/hvqzao/burp-wildcard\">http://github.com/hvqzao/burp-wildcard</a> - an extension banned from official BApp Store because of UI *hacking*! :)</p></html>",
// version };
// private int adIndex = 0;
// private JLabel flowFilterAd;
private SeparateViewDialog separateView;
private JButton flowFilterHelpExt;
private ImageIcon iconHelp;
private boolean modalResult;
private int modalMode;
private int mode = 0;
private JScrollPane flowTableScroll;
private boolean autoDelete = false;
private int autoDeleteKeep = 1000;
private boolean autoPopulate = false;
private boolean showReflections = true;
private int showReflectionsCount;
private final int showReflectionsCountMax = 50;
private final int showReflectionsCountDefault = 10;
private boolean modalAutoPopulate;
private boolean modalAutoDelete;
private int modalAutoDeleteKeep;
private boolean modalShowReflections;
private int modalShowReflectionsCount;
private static PrintWriter stderr;
private FilterWorker flowFilterWorker;
private static int sortOrder;
private String flowFilterText = "";
private static FlowExtension instance;
@Override
public void registerExtenderCallbacks(final IBurpExtenderCallbacks callbacks) {
instance = this;
FlowExtension.callbacks = callbacks;
helpers = callbacks.getHelpers();
stderr = new PrintWriter(callbacks.getStderr(), true);
// set extension name
callbacks.setExtensionName("Flow");
// detect burp
burpFree = String.valueOf(callbacks.getBurpVersion()[0]).equals("Burp Suite Free Edition") || String.valueOf(callbacks.getBurpVersion()[0]).equals("Burp Suite Community Edition");
// draw UI
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
// images
iconHelp = new ImageIcon(new ImageIcon(getClass().getResource("/hvqzao/flow/resources/panel_help.png")).getImage().getScaledInstance(13, 13, java.awt.Image.SCALE_SMOOTH));
ImageIcon iconDefaults = new ImageIcon(new ImageIcon(getClass().getResource("/hvqzao/flow/resources/panel_defaults.png")).getImage().getScaledInstance(13, 13, java.awt.Image.SCALE_SMOOTH));
ImageIcon iconNewWindow = new ImageIcon(new ImageIcon(getClass().getResource("/hvqzao/flow/resources/newwindow.png")).getImage().getScaledInstance(13, 13, java.awt.Image.SCALE_SMOOTH));
ImageIcon iconCheckbox = new ImageIcon(new ImageIcon(getClass().getResource("/hvqzao/flow/resources/checkbox.png")).getImage().getScaledInstance(13, 13, java.awt.Image.SCALE_SMOOTH));
Dimension iconDimension = new Dimension(24, 24);
// flow tab prolog: vertical split
flowTab = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
callbacks.customizeUiComponent(flowTab);
// top: table
JPanel flowTablePane = new JPanel();
flowTablePane.setLayout(new BorderLayout());
// filter
final JPanel flowFilterPane = new JPanel();
flowFilterPane.setLayout(new BorderLayout());
flowFilterPane.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
// JTextField flowFilter = new JTextField("");
flowFilter = new JLabel(""); // "Filter: Showing all items");
flowFilter.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.darkGray), BorderFactory.createEmptyBorder(5, 5, 5, 5)));
flowFilterPane.add(flowFilter, BorderLayout.CENTER);
// filter popup
// actions
ActionListener flowFilterScopeUpdateAction = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (!flowFilterSourceTargetOnly.isSelected() && !flowFilterSourceProxyOnly.isSelected() && !flowFilterSourceSpiderOnly.isSelected() && !flowFilterSourceScannerOnly.isSelected() && !flowFilterSourceRepeaterOnly.isSelected() && !flowFilterSourceIntruderOnly.isSelected() && !flowFilterSourceExtenderOnly.isSelected()) {
flowFilterSourceTargetOnlyOrig = flowFilterSourceTarget.isSelected();
flowFilterSourceProxyOnlyOrig = flowFilterSourceProxy.isSelected();
flowFilterSourceSpiderOnlyOrig = flowFilterSourceSpider.isSelected();
flowFilterSourceScannerOnlyOrig = flowFilterSourceScanner.isSelected();
flowFilterSourceRepeaterOnlyOrig = flowFilterSourceRepeater.isSelected();
flowFilterSourceIntruderOnlyOrig = flowFilterSourceIntruder.isSelected();
flowFilterSourceExtenderOnlyOrig = flowFilterSourceExtender.isSelected();
}
flowFilterUpdate();
}
};
ActionListener flowFilterCaptureScopeUpdateAction = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (!flowFilterCaptureSourceTargetOnly.isSelected() && !flowFilterCaptureSourceProxyOnly.isSelected() && !flowFilterCaptureSourceSpiderOnly.isSelected() && !flowFilterCaptureSourceScannerOnly.isSelected() && !flowFilterCaptureSourceRepeaterOnly.isSelected() && !flowFilterCaptureSourceIntruderOnly.isSelected() && !flowFilterCaptureSourceExtenderOnly.isSelected()) {
flowFilterCaptureSourceTargetOnlyOrig = flowFilterCaptureSourceTarget.isSelected();
flowFilterCaptureSourceProxyOnlyOrig = flowFilterCaptureSourceProxy.isSelected();
flowFilterCaptureSourceSpiderOnlyOrig = flowFilterCaptureSourceSpider.isSelected();
flowFilterCaptureSourceScannerOnlyOrig = flowFilterCaptureSourceScanner.isSelected();
flowFilterCaptureSourceRepeaterOnlyOrig = flowFilterCaptureSourceRepeater.isSelected();
flowFilterCaptureSourceIntruderOnlyOrig = flowFilterCaptureSourceIntruder.isSelected();
flowFilterCaptureSourceExtenderOnlyOrig = flowFilterCaptureSourceExtender.isSelected();
}
flowFilterUpdateDescription(true);
}
};
// layout
final JDialog flowFilterPopupWindow = new JDialog();
FlowFilterPopup flowFilterPopup = new FlowFilterPopup();
flowFilterCaptureSourceTarget = flowFilterPopup.getFlowFilterCaptureSourceTarget();
flowFilterCaptureSourceTargetOnly = flowFilterPopup.getFlowFilterCaptureSourceTargetOnly();
flowFilterCaptureSourceProxy = flowFilterPopup.getFlowFilterCaptureSourceProxy();
flowFilterCaptureSourceProxyOnly = flowFilterPopup.getFlowFilterCaptureSourceProxyOnly();
flowFilterCaptureSourceSpider = flowFilterPopup.getFlowFilterCaptureSourceSpider();
flowFilterCaptureSourceSpiderOnly = flowFilterPopup.getFlowFilterCaptureSourceSpiderOnly();
flowFilterCaptureSourceScanner = flowFilterPopup.getFlowFilterCaptureSourceScanner();
flowFilterCaptureSourceScannerOnly = flowFilterPopup.getFlowFilterCaptureSourceScannerOnly();
flowFilterCaptureSourceRepeater = flowFilterPopup.getFlowFilterCaptureSourceRepeater();
flowFilterCaptureSourceRepeaterOnly = flowFilterPopup.getFlowFilterCaptureSourceRepeaterOnly();
flowFilterCaptureSourceIntruder = flowFilterPopup.getFlowFilterCaptureSourceIntruder();
flowFilterCaptureSourceIntruderOnly = flowFilterPopup.getFlowFilterCaptureSourceIntruderOnly();
flowFilterCaptureSourceExtender = flowFilterPopup.getFlowFilterCaptureSourceExtender();
flowFilterCaptureSourceExtenderOnly = flowFilterPopup.getFlowFilterCaptureSourceExtenderOnly();
flowFilterInscope = flowFilterPopup.getFlowFilterInscope();
flowFilterOutofscope = flowFilterPopup.getFlowFilterOutofscope();
flowFilterParametrized = flowFilterPopup.getFlowFilterParametrized();
flowFilterSearchCaseSensitive = flowFilterPopup.getFlowFilterSearchCaseSensitive();
flowFilterSearchField = flowFilterPopup.getFlowFilterSearchField();
flowFilterSearchNegative = flowFilterPopup.getFlowFilterSearchNegative();
flowFilterSearchRegex = flowFilterPopup.getFlowFilterSearchRegex();
flowFilterSearchRequest = flowFilterPopup.getFlowFilterSearchRequest();
flowFilterSearchResponse = flowFilterPopup.getFlowFilterSearchResponse();
flowFilterSourceExtender = flowFilterPopup.getFlowFilterSourceExtender();
flowFilterSourceExtenderOnly = flowFilterPopup.getFlowFilterSourceExtenderOnly();
flowFilterSourceIntruder = flowFilterPopup.getFlowFilterSourceIntruder();
flowFilterSourceIntruderOnly = flowFilterPopup.getFlowFilterSourceIntruderOnly();
flowFilterSourceTarget = flowFilterPopup.getFlowFilterSourceTarget();
flowFilterSourceTargetOnly = flowFilterPopup.getFlowFilterSourceTargetOnly();
flowFilterSourceProxy = flowFilterPopup.getFlowFilterSourceProxy();
flowFilterSourceProxyOnly = flowFilterPopup.getFlowFilterSourceProxyOnly();
flowFilterSourceRepeater = flowFilterPopup.getFlowFilterSourceRepeater();
flowFilterSourceRepeaterOnly = flowFilterPopup.getFlowFilterSourceRepeaterOnly();
flowFilterSourceScanner = flowFilterPopup.getFlowFilterSourceScanner();
flowFilterSourceScannerOnly = flowFilterPopup.getFlowFilterSourceScannerOnly();
flowFilterSourceSpider = flowFilterPopup.getFlowFilterSourceSpider();
flowFilterSourceSpiderOnly = flowFilterPopup.getFlowFilterSourceSpiderOnly();
flowFilterBottom = flowFilterPopup.getFlowFilterBottom();
flowFilterSourceTarget.setSelected(true); // TODO?
flowFilterSourceTargetOnlyOrig = true;
//flowFilterSourceProxy.setSelected(true); // TODO?
flowFilterSourceProxyOnlyOrig = true;
flowFilterSourceSpider.setSelected(true);
flowFilterSourceSpiderOnlyOrig = true;
flowFilterSourceScanner.setEnabled(!burpFree);
flowFilterSourceScanner.setSelected(!burpFree);
flowFilterSourceScannerOnly.setEnabled(!burpFree);
flowFilterSourceScannerOnlyOrig = !burpFree;
flowFilterSourceRepeater.setSelected(true);
flowFilterSourceRepeaterOnlyOrig = true;
flowFilterSourceIntruder.setSelected(true);
flowFilterSourceIntruderOnlyOrig = true;
flowFilterSourceExtender.setSelected(true);
flowFilterSourceExtenderOnlyOrig = true;
flowFilterCaptureSourceScanner.setEnabled(!burpFree);
flowFilterCaptureSourceScanner.setSelected(!burpFree);
flowFilterCaptureSourceScannerOnly.setEnabled(!burpFree);
flowFilterCaptureSourceScannerOnly.setSelected(!burpFree);
flowFilterCaptureSourceScannerOnlyOrig = !burpFree;
JButton flowFilterHelp;
flowFilterHelp = flowFilterPopup.getFlowFilterHelp();
flowFilterHelp.setIcon(iconHelp);
flowFilterHelp.setEnabled(false);
callbacks.customizeUiComponent(flowFilterHelp);
JButton flowFilterDefaults;
flowFilterDefaults = flowFilterPopup.getFlowFilterDefaults();
flowFilterDefaults.setIcon(iconDefaults);
callbacks.customizeUiComponent(flowFilterDefaults);
flowFilterDefaults.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
flowFilterSetDefaults();
}
});
flowFilterSearchField.getDocument().addDocumentListener(new DocumentListener() {
@Override
public void removeUpdate(DocumentEvent e) {
process();
}
@Override
public void insertUpdate(DocumentEvent e) {
process();
}
@Override
public void changedUpdate(DocumentEvent e) {
process();
}
private void process() {
flowFilterUpdate();
}
});
//flowFilterInscope.addActionListener(flowFilterScopeUpdateAction);
//flowFilterOutofscope.addActionListener(flowFilterScopeUpdateAction);
flowFilterInscope.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
flowFilterOutofscope.setSelected(false);
flowFilterUpdate();
}
});
flowFilterOutofscope.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
flowFilterInscope.setSelected(false);
flowFilterUpdate();
}
});
flowFilterParametrized.addActionListener(flowFilterScopeUpdateAction);
flowFilterSearchCaseSensitive.addActionListener(flowFilterScopeUpdateAction);
flowFilterSearchNegative.addActionListener(flowFilterScopeUpdateAction);
flowFilterSearchRegex.addActionListener(flowFilterScopeUpdateAction);
flowFilterSearchRequest.addActionListener(flowFilterScopeUpdateAction);
flowFilterSearchResponse.addActionListener(flowFilterScopeUpdateAction);
flowFilterSourceTarget.addActionListener(flowFilterScopeUpdateAction);
flowFilterSourceProxy.addActionListener(flowFilterScopeUpdateAction);
flowFilterSourceSpider.addActionListener(flowFilterScopeUpdateAction);
flowFilterSourceScanner.addActionListener(flowFilterScopeUpdateAction);
flowFilterSourceRepeater.addActionListener(flowFilterScopeUpdateAction);
flowFilterSourceIntruder.addActionListener(flowFilterScopeUpdateAction);
flowFilterSourceExtender.addActionListener(flowFilterScopeUpdateAction);
flowFilterSourceTargetOnly.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
flowFilterSourceOnly(flowFilterSourceTargetOnly);
}
});
flowFilterSourceProxyOnly.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
flowFilterSourceOnly(flowFilterSourceProxyOnly);
}
});
flowFilterSourceSpiderOnly.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
flowFilterSourceOnly(flowFilterSourceSpiderOnly);
}
});
flowFilterSourceScannerOnly.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
flowFilterSourceOnly(flowFilterSourceScannerOnly);
}
});
flowFilterSourceRepeaterOnly.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
flowFilterSourceOnly(flowFilterSourceRepeaterOnly);
}
});
flowFilterSourceIntruderOnly.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
flowFilterSourceOnly(flowFilterSourceIntruderOnly);
}
});
flowFilterSourceExtenderOnly.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
flowFilterSourceOnly(flowFilterSourceExtenderOnly);
}
});
flowFilterCaptureSourceTarget.addActionListener(flowFilterCaptureScopeUpdateAction);
flowFilterCaptureSourceProxy.addActionListener(flowFilterCaptureScopeUpdateAction);
flowFilterCaptureSourceSpider.addActionListener(flowFilterCaptureScopeUpdateAction);
flowFilterCaptureSourceScanner.addActionListener(flowFilterCaptureScopeUpdateAction);
flowFilterCaptureSourceRepeater.addActionListener(flowFilterCaptureScopeUpdateAction);
flowFilterCaptureSourceIntruder.addActionListener(flowFilterCaptureScopeUpdateAction);
flowFilterCaptureSourceExtender.addActionListener(flowFilterCaptureScopeUpdateAction);
flowFilterCaptureSourceTargetOnly.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
flowFilterCaptureSourceOnly(flowFilterCaptureSourceTargetOnly);
}
});
flowFilterCaptureSourceProxyOnly.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
flowFilterCaptureSourceOnly(flowFilterCaptureSourceProxyOnly);
}
});
flowFilterCaptureSourceSpiderOnly.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
flowFilterCaptureSourceOnly(flowFilterCaptureSourceSpiderOnly);
}
});
flowFilterCaptureSourceScannerOnly.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
flowFilterCaptureSourceOnly(flowFilterCaptureSourceScannerOnly);
}
});
flowFilterCaptureSourceRepeaterOnly.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
flowFilterCaptureSourceOnly(flowFilterCaptureSourceRepeaterOnly);
}
});
flowFilterCaptureSourceIntruderOnly.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
flowFilterCaptureSourceOnly(flowFilterCaptureSourceIntruderOnly);
}
});
flowFilterCaptureSourceExtenderOnly.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
flowFilterCaptureSourceOnly(flowFilterCaptureSourceExtenderOnly);
}
});
flowFilterPopupReady = true;
flowFilterPopupWindow.setUndecorated(true);
flowFilterPopupWindow.add(flowFilterPopup);
flowFilterPopupWindow.pack();
flowFilter.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
if (flowFilterPopupReady) {
flowFilterPopupReady = false;
flowFilterPopupWindow.addWindowFocusListener(new WindowFocusListener() {
@Override
public void windowLostFocus(WindowEvent e) {
flowFilterPopupWindow.setVisible(false);
//flowFilterPopupWindow.dispose();
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
flowFilterPopupReady = true;
}
});
}
@Override
public void windowGainedFocus(WindowEvent e) {
}
});
// flowFilterAd.setText(ads[adIndex]);
// adIndex += 1;
// if (adIndex >= ads.length) {
// adIndex = 0;
// }
// dialog.setLocationRelativeTo(null);
Point flowFilterPT = flowFilter.getLocationOnScreen();
flowFilterPopupWindow.setLocation(new Point((int) flowFilterPT.getX() - 2, flowFilterPT.y + flowFilter.getHeight() + 1));
flowFilterBottom.requestFocus();
flowFilterPopupWindow.setVisible(true);
//flowFilterPopupWindow.repaint();
//flowTab.repaint();
}
}
});
// filter help
JPanel flowFilterHelpPane = new JPanel();
flowFilterHelpPane.setBorder(BorderFactory.createEmptyBorder(-4, 4, 0, 0));
flowFilterHelpPane.setPreferredSize(new Dimension(26 + 10 + 26, 24));
//
JButton flowFilterHelpOpt = new JButton(iconCheckbox);
flowFilterHelpOpt.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
flowFilterHelpOpt.setPreferredSize(iconDimension);
flowFilterHelpOpt.setMaximumSize(iconDimension);
callbacks.customizeUiComponent(flowFilterHelpOpt);
flowFilterHelpPane.add(flowFilterHelpOpt);
// final JButton flowFilterHelpExt = new JButton(iconHelp);
flowFilterHelpExt = new JButton(iconNewWindow);
flowFilterHelpExt.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
flowFilterHelpExt.setPreferredSize(iconDimension);
flowFilterHelpExt.setMaximumSize(iconDimension);
flowFilterHelpExt.setToolTipText(version);
callbacks.customizeUiComponent(flowFilterHelpExt);
flowFilterHelpExt.setEnabled(true);
flowFilterHelpPane.add(flowFilterHelpExt);
flowFilterPane.add(flowFilterHelpPane, BorderLayout.LINE_END);
flowTablePane.add(flowFilterPane, BorderLayout.PAGE_START);
//// flow filterHelpExt popup
//final JDialog flowFilterHelpExtPopupWindow = new JDialog();
//final JLabel flowFilterHelpExtPopup = new JLabel(version);
//// flowFilterHelpExtPopup.setBorder(BorderFactory.createLineBorder(Color.darkGray));
//// flowFilterHelpExtPopup.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.darkGray), BorderFactory.createEmptyBorder(10, 20, 10, 20)));
//flowFilterHelpExtPopup.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.darkGray), BorderFactory.createEmptyBorder(2, 20, 2, 20)));
//flowFilterHelpExtPopup.setBackground(Color.lightGray);
////
//flowFilterHelpExtPopupReady = true;
//flowFilterHelpExt.addMouseListener(new MouseAdapter() {
// public void mousePressed(MouseEvent e) {
// if (flowFilterHelpExtPopupReady) {
// flowFilterHelpExtPopupReady = false;
// flowFilterHelpExtPopupWindow.addWindowFocusListener(new WindowFocusListener() {
//
// @Override
// public void windowLostFocus(WindowEvent e) {
// flowFilterHelpExtPopupWindow.dispose();
// SwingUtilities.invokeLater(new Runnable() {
//
// @Override
// public void run() {
// flowFilterHelpExtPopupReady = true;
// }
// });
// }
//
// @Override
// public void windowGainedFocus(WindowEvent e) {
// }
//
// });
// flowFilterHelpExtPopupWindow.setUndecorated(true);
// flowFilterHelpExtPopupWindow.add(flowFilterHelpExtPopup);
// flowFilterHelpExtPopupWindow.pack();
// // dialog.setLocationRelativeTo(null);
// Point flowFilterHelpExtPT = flowFilterHelpExt.getLocationOnScreen();
// int x = (int) flowFilterHelpExtPT.getX() - 2 - flowFilterHelpExtPopup.getWidth() + 2; // - 7;
// if (x < 0) {
// x = 0;
// }
// flowFilterHelpExtPopupWindow.setLocation(new Point(x, flowFilterHelpExtPT.y + 2)); // + 1
// // ....requestFocus();
// flowFilterHelpExtPopupWindow.setVisible(true);
// }
// }
//});
flowFilterHelpExt.addMouseListener(new MouseAdapter() {
@Override
public void mouseReleased(MouseEvent e) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if (separateView == null) {
separateView = new SeparateViewDialog(burpFrame, "Flow");
}
}
});
}
});
// table
flowTableModel = new FlowTableModel();
flowTableSorter = new TableRowSorter<>(flowTableModel);
flowTable = new FlowTable(flowTableModel);
flowTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
//flowTable.setAutoCreateRowSorter(true);
flowTable.setRowSorter(flowTableSorter);
for (int i = 0; i < flowTableModel.getColumnCount(); i++) {
TableColumn column = flowTable.getColumnModel().getColumn(i);
column.setMinWidth(20);
column.setPreferredWidth(flowTableModel.getPreferredWidth(i));
}
flowTableSorter.addRowSorterListener(new RowSorterListener() {
@Override
public void sorterChanged(RowSorterEvent e) {
if (e.getType() == RowSorterEvent.Type.SORT_ORDER_CHANGED) {
List<? extends RowSorter.SortKey> keys = flowTableSorter.getSortKeys();
if (keys.isEmpty() == false) {
RowSorter.SortKey key = keys.get(0);
int order = 0;
if (key.getSortOrder() == SortOrder.ASCENDING) {
order = 1;
}
if (key.getSortOrder() == SortOrder.DESCENDING) {
order = -1;
}
sortOrder = order;
}
}
}
});
callbacks.customizeUiComponent(flowTable);
flowTableScroll = new JScrollPane(flowTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
flowTableScroll.setMinimumSize(new Dimension(40, 40));
callbacks.customizeUiComponent(flowTableScroll);
flowTable.setDefaultRenderer(Boolean.class, new BooleanTableCellRenderer());
flowTable.getTableHeader().setReorderingAllowed(true);
// flowTab.setTopComponent(flowTableScroll);
flowTablePane.add(flowTableScroll, BorderLayout.CENTER);
flowTab.setTopComponent(flowTablePane);
// sort index column in descending order
flowTableSorter.toggleSortOrder(0);
flowTableSorter.toggleSortOrder(0);
// flowTable popup
flowTablePopup = new FlowTablePopup();
flowTable.setComponentPopupMenu(flowTablePopup);
// flowTable renderer
flowTableCellRenderer = new FlowTableCellRenderer();
flowTable.setDefaultRenderer(Object.class, flowTableCellRenderer);
flowTable.setDefaultRenderer(Date.class, flowTableCellRenderer); // Newer JTable requires Date be explicitly added here or it won't be processed
flowTable.setDefaultRenderer(Integer.class, flowTableCellRenderer); // Added to fix row highlighting bug with ints
// flow bottom prolog: request & response
JSplitPane flowViewPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
flowViewPane.setResizeWeight(.5d);
callbacks.customizeUiComponent(flowViewPane);
flowEntryEditor = new FlowEntryEditor();
// req
JPanel flowReqPane = new JPanel();
flowReqPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10));
flowReqPane.setLayout(new BorderLayout());
// JLabel flowReqLabel = new JLabel("<html><b style='color:#e58900;font-size:10px'>Request</b></html>");
// flowReqLabel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
// flowReqPane.add(flowReqLabel, BorderLayout.PAGE_START);
//
flowViewPane.setLeftComponent(flowReqPane);
flowReqView = callbacks.createMessageEditor((IMessageEditorController) flowEntryEditor, false);
flowReqPane.add(flowReqView.getComponent(), BorderLayout.CENTER);
// resp
JPanel flowRespPane = new JPanel();
flowRespPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
flowRespPane.setLayout(new BorderLayout());
// JLabel flowRespLabel = new JLabel("<html><b style='color:#e58900;font-size:10px'>Response</b></html>");
// flowRespLabel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
// flowRespPane.add(flowRespLabel, BorderLayout.PAGE_START);
flowViewPane.setRightComponent(flowRespPane);
flowRespView = callbacks.createMessageEditor(flowEntryEditor, false);
flowRespPane.add(flowRespView.getComponent(), BorderLayout.CENTER);
// flow bottom epilog
flowTab.setBottomComponent(flowViewPane);
flowComponent = new JPanel();
flowComponent.setLayout(new BoxLayout(flowComponent, BoxLayout.X_AXIS));
flowComponent.add(flowTab);
separateView = null;
callbacks.addSuiteTab(FlowExtension.this);
// get burp frame
burpFrame = (JFrame) SwingUtilities.getWindowAncestor(flowTab);
//
flowFilterHelpOpt.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (showOptionsDialog()) {
if (mode != modalMode) {
mode = modalMode;
callbacks.saveExtensionSetting("mode", String.valueOf(mode));
flowFilterUpdate();
}
if (autoPopulate != modalAutoPopulate) {
autoPopulate = modalAutoPopulate;
callbacks.saveExtensionSetting("autoPopulateProxy", autoPopulate ? "1" : "0");
}
if (autoDeleteKeep != modalAutoDeleteKeep) {
autoDeleteKeep = modalAutoDeleteKeep;
callbacks.saveExtensionSetting("autoDeleteKeep", String.valueOf(autoDeleteKeep));
}
if (autoDelete != modalAutoDelete) {
autoDelete = modalAutoDelete;
callbacks.saveExtensionSetting("autoDelete", autoDelete ? "1" : "0");
if (autoDelete) {
triggerAutoDelete();
flowTableSorter.sort();
}
}
if (showReflections != modalShowReflections) {
showReflections = modalShowReflections;
callbacks.saveExtensionSetting("showReflections", showReflections ? "1" : "0");
}
if (showReflectionsCount != modalShowReflectionsCount) {
showReflectionsCount = modalShowReflectionsCount;
callbacks.saveExtensionSetting("showReflectionsCount", String.valueOf(showReflectionsCount));
}
}
}
});
// register ourselves as an HTTP listener
callbacks.registerHttpListener(FlowExtension.this);
// extension state listener
callbacks.registerExtensionStateListener(FlowExtension.this);
// scope change listener
callbacks.registerScopeChangeListener(FlowExtension.this);
//
if ("1".equals(callbacks.loadExtensionSetting("mode"))) {
mode = 1;
}
//
//autoPopulate = "0".equals(callbacks.loadExtensionSetting("autoPopulate")) == false; // will default to true if not set
autoPopulate = "1".equals(callbacks.loadExtensionSetting("autoPopulateProxy"));
autoDeleteKeep = validateAutoDeleteKeep(callbacks.loadExtensionSetting("autoDeleteKeep"));
autoDelete = "1".equals(callbacks.loadExtensionSetting("autoDelete"));
showReflections = "0".equals(callbacks.loadExtensionSetting("showReflections")) == false;
showReflectionsCount = parseReflectionsCount(callbacks.loadExtensionSetting("showReflectionsCount"));
//
//
flowFilterSetDefaults();
callbacks.printOutput(version);
if (autoPopulate) {
//callbacks.printOutput("Initializing extension with contents of Burp Proxy...");
(new PopulateWorker(callbacks.getProxyHistory())).execute();
}
//Set<Map.Entry<Object, Object>> entries = UIManager.getLookAndFeelDefaults().entrySet();
//for (Map.Entry<Object, Object> entry : entries) {
// if (entry.getValue() instanceof Color) {
// stderr.println(String.valueOf(entry.getKey()) + "\t" + String.valueOf(UIManager.getColor(entry.getKey())) + "\t" + String.valueOf(entry.getValue()));
// }
//}
//callbacks.printOutput("Loaded.");
// TODO end main
}
});
}
//
// implement ITab
//
@Override
public String getTabCaption() {
return "Flow";
}
@Override
public Component getUiComponent() {
return flowComponent;
}
//
// implement IHttpListener
//
@Override
public void processHttpMessage(int toolFlag, boolean messageIsRequest, IHttpRequestResponse messageInfo) {
if (toolFlagCaptureProcessing(toolFlag)) {
synchronized (flow) {
if (messageIsRequest) {
// both complete and incomplete requests
if (mode == 1) {
int row = flow.size();
try {
flow.add(new FlowEntry(toolFlag, messageInfo));
flowTableModel.fireTableRowsInserted(row, row);
} catch (Exception ex) {
// do nothing
//ex.printStackTrace(stderr);
}
triggerAutoDelete();
}
//stdout.println("[+] " + String.valueOf(helpers.analyzeRequest(messageInfo.getHttpService(), messageInfo.getRequest()).getUrl()));
//stdout.println(" " + String.valueOf(flowIncomplete.size()));
} else {
// only requests with responses
if (mode == 0) {
int row = flow.size();
flow.add(new FlowEntry(toolFlag, messageInfo));
flowTableModel.fireTableRowsInserted(row, row);
triggerAutoDelete();
}
if (FLOW_INCOMPLETE.size() > 0) {
FlowEntry flowIncompleteFound = null;
ArrayList<FlowEntry> flowIncompleteCleanup = new ArrayList<>();
Date outdated = new Date(System.currentTimeMillis() - 5 * 60 * 1000);
for (FlowEntry incomplete : FLOW_INCOMPLETE) {
if (flowIncompleteFound == null) {
if (incomplete.toolFlag == toolFlag && incomplete.isIncomplete() && incomplete.incomplete.equals(helpers.bytesToString(messageInfo.getRequest()))) {
flowIncompleteFound = incomplete;
}
}
if (incomplete.date.before(outdated)) {
flowIncompleteCleanup.add(incomplete);
}
}
if (flowIncompleteFound != null && flowIncompleteCleanup.contains(flowIncompleteFound)) {
flowIncompleteCleanup.remove(flowIncompleteFound);
}
while (!flowIncompleteCleanup.isEmpty()) {
FLOW_INCOMPLETE.remove(flowIncompleteCleanup.get(0));
flowIncompleteCleanup.remove(0);
}
if (flowIncompleteFound != null) {
flowIncompleteFound.update(messageInfo);
if (flowCurrentEntry == flowIncompleteFound) {
flowTable.updateResponse();
}
int row = flow.indexOf(flowIncompleteFound);
//callbacks.printError(String.valueOf(row) + " " + String.valueOf(flow.size()));
if (mode == 0) {
// TODO refresh tableSorter filter trigger to display it
flowTableSorter.sort();
}
//flowTableModel.fireTableDataChanged();
////callbacks.printError(String.valueOf(flow.size()) + ", " + String.valueOf(row));
//flowTableModel.fireTableRowsInserted(row, row);
//triggerAutoDelete();
//flowTableModel.fireTableRowsUpdated(0, row);
//} else {
flowTableModel.fireTableRowsUpdated(row, row);
//}
FLOW_INCOMPLETE.remove(flowIncompleteFound);
//
//flowTableModel.fireTableDataChanged();
}
//stdout.println("[-] " + String.valueOf(helpers.analyzeRequest(messageInfo.getHttpService(), messageInfo.getRequest()).getUrl()) + " [" + String.valueOf(helpers.analyzeResponse(messageInfo.getResponse()).getStatusCode()) + "]");
//stdout.println(" " + String.valueOf(flowIncomplete.size()) + ", match: " + String.valueOf(flowIncompleteFound != null));
//callbacks.printOutput(String.valueOf(FLOW_INCOMPLETE.size()));
}
}
}
}
}
//
// implement IScopeChangeListener
//
@Override
public void scopeChanged() {
if (flowFilterInscope.isSelected()) {
flowFilterUpdate();
}
}
//
// implement IExtensionStateListener
//
@Override
public void extensionUnloaded() {
while (!dialogs.isEmpty()) {
dialogs.get(0).dispose();
}
}
/**
* Flow table populating SwingWorker.
*
*/
class PopulateWorker extends SwingWorker<Object, FlowEntry> {
private final IHttpRequestResponse[] history;
private final PrintWriter stdout;
public PopulateWorker(IHttpRequestResponse[] history) {
this.history = history;
stdout = new PrintWriter(callbacks.getStdout(), true);
stdout.print("Populating log with Burp Proxy history, Please wait... ");
stdout.flush();
}
@Override
protected Object doInBackground() throws Exception {
if (history.length > 0) {
int start = 0;
if (autoDelete) {
start = history.length - autoDeleteKeep;
if (start < 0) {
start = 0;
}
}
for (int i = start; i < history.length; i++) {
publish(new FlowEntry(IBurpExtenderCallbacks.TOOL_PROXY, history[i]));
}
}
return null;
}
@Override
protected void process(List<FlowEntry> chunks) {
synchronized (flow) {
int from = flow.size();
flow.addAll(chunks);
int to = flow.size();
try {
flowTableModel.fireTableRowsInserted(from, to - 1);
} catch (Exception ex) {
ex.printStackTrace(stderr);
}
}
}
@Override
protected void done() {
flowTable.repaint();
stdout.println("done.");
}
}
public static IBurpExtenderCallbacks getCallbacks() {
return callbacks;
}
//
// misc
//
private void triggerAutoDelete() {
if (autoDelete) {
while (flow.size() > autoDeleteKeep) {
flow.remove(0);
flowTableModel.fireTableRowsDeleted(0, 0);
}
}
}
private int validateAutoDeleteKeep(String number) {
int output;
final int DEFAULT = 1000;
if (number == null) {
output = DEFAULT;
} else {
try {
output = Integer.parseInt(number);
} catch (NumberFormatException e) {
output = DEFAULT;
}
}
if (output < 50) {
output = 50;
}
return output;
}
private boolean showAddNewIssueDialog() {
final JDialog dialog = new JDialog(burpFrame, "Add New Sitemap Issue", Dialog.ModalityType.DOCUMENT_MODAL);
DialogWrapper wrapper = new DialogWrapper();
final FlowAddNewIssue addNewIssue = new FlowAddNewIssue(callbacks, popupPointedFlowEntry);
// customize options pane
JButton help = addNewIssue.getHelpButton();
help.setIcon(iconHelp);
help.setEnabled(false);
callbacks.customizeUiComponent(help);
//
// wrap optionsPane
wrapper.getScrollPane().getViewport().add(addNewIssue);
//dialog.setBounds(100, 100, 1070, 670);
Dimension dim = ((JComponent) addNewIssue).getPreferredSize();
dialog.setBounds(100, 100, (int) Math.round(dim.getWidth() * 1.33), (int) Math.round(dim.getHeight() * 1.50));
dialog.setContentPane(wrapper);
//
modalResult = false;
// presets here
JButton ok = wrapper.getOkButton();
callbacks.customizeUiComponent(ok);
ok.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (addNewIssue.dataValidation()) {
modalResult = true;
// FUTURE: multiple entries with same IHttpService?
//int[] rows = flowTable.getSelectedRows();
//for (int i = 0; i < rows.length; i++) {
// rows[i] = flowTable.convertRowIndexToModel(rows[i]);
//}
//FlowEntry[] selected = new FlowEntry[rows.length];
//for (int i=0 ; i < rows.length ; i++) {
// selected[i] = flow.get(rows[i]);
//}
callbacks.addScanIssue(addNewIssue.getIssue());
dialog.dispose();
}
}
});
JButton cancel = wrapper.getCancelButton();
callbacks.customizeUiComponent(cancel);
cancel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
dialog.dispose();
}
});
dialog.setLocationRelativeTo(null);
dialog.setVisible(true);
//
return modalResult;
}
private boolean showOptionsDialog() {
final JDialog dialog = new JDialog(burpFrame, "Flow Extension Options", Dialog.ModalityType.DOCUMENT_MODAL);
DialogWrapper wrapper = new DialogWrapper();
final FlowOptionsPane optionsPane = new FlowOptionsPane(callbacks);
// customize options pane
JButton modeHelp = optionsPane.getModeHelp();
modeHelp.setIcon(iconHelp);
modeHelp.setEnabled(false);
callbacks.customizeUiComponent(modeHelp);
//
JButton miscHelp = optionsPane.getMiscHelp();
miscHelp.setIcon(iconHelp);
miscHelp.setEnabled(false);
callbacks.customizeUiComponent(miscHelp);
//
// wrap optionsPane
wrapper.getScrollPane().getViewport().add(optionsPane);
dialog.setBounds(100, 100, 526, 500);
dialog.setContentPane(wrapper);
//
modalResult = false;
if (mode == 0 && optionsPane.getMode2().isSelected()) {
optionsPane.getMode1().setSelected(true);
}
optionsPane.getAutoPopulate().setSelected(autoPopulate);
optionsPane.getAutoDelete().setSelected(autoDelete);
optionsPane.getAutoDeleteKeep().setText(String.valueOf(autoDeleteKeep));
optionsPane.getShowReflections().setSelected(showReflections);
optionsPane.getShowReflectionsCount().setText(String.valueOf(showReflectionsCount));
//
JButton ok = wrapper.getOkButton();
callbacks.customizeUiComponent(ok);
ok.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
modalResult = true;
modalMode = optionsPane.getMode2().isSelected() ? 1 : 0;
modalAutoPopulate = optionsPane.getAutoPopulate().isSelected();
modalAutoDelete = optionsPane.getAutoDelete().isSelected();
modalAutoDeleteKeep = validateAutoDeleteKeep(optionsPane.getAutoDeleteKeep().getText());
modalShowReflections = optionsPane.getShowReflections().isSelected();
modalShowReflectionsCount = parseReflectionsCount(optionsPane.getShowReflectionsCount().getText());
dialog.dispose();
}
});
JButton cancel = wrapper.getCancelButton();
callbacks.customizeUiComponent(cancel);
cancel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
dialog.dispose();
}
});
dialog.setLocationRelativeTo(flowTableScroll);
dialog.setVisible(true);
//
return modalResult;
}
private void flowFilterCaptureSourceOnly(JCheckBox which) {
if (which != flowFilterCaptureSourceTargetOnly && flowFilterCaptureSourceTargetOnly.isSelected()) {
flowFilterCaptureSourceTargetOnly.setSelected(false);
flowFilterCaptureSourceTarget.setSelected(flowFilterCaptureSourceTargetOnlyOrig);
}
if (which != flowFilterCaptureSourceProxyOnly && flowFilterCaptureSourceProxyOnly.isSelected()) {
flowFilterCaptureSourceProxyOnly.setSelected(false);
flowFilterCaptureSourceProxy.setSelected(flowFilterCaptureSourceProxyOnlyOrig);
}
if (which != flowFilterCaptureSourceSpiderOnly && flowFilterCaptureSourceSpiderOnly.isSelected()) {
flowFilterCaptureSourceSpiderOnly.setSelected(false);
flowFilterCaptureSourceSpider.setSelected(flowFilterCaptureSourceSpiderOnlyOrig);
}
if (which != flowFilterCaptureSourceScannerOnly && flowFilterCaptureSourceScannerOnly.isSelected()) {
flowFilterCaptureSourceScannerOnly.setSelected(false);
flowFilterCaptureSourceScanner.setSelected(flowFilterCaptureSourceScannerOnlyOrig);
}
if (which != flowFilterCaptureSourceRepeaterOnly && flowFilterCaptureSourceRepeaterOnly.isSelected()) {
flowFilterCaptureSourceRepeaterOnly.setSelected(false);
flowFilterCaptureSourceRepeater.setSelected(flowFilterCaptureSourceRepeaterOnlyOrig);
}
if (which != flowFilterCaptureSourceIntruderOnly && flowFilterCaptureSourceIntruderOnly.isSelected()) {
flowFilterCaptureSourceIntruderOnly.setSelected(false);
flowFilterCaptureSourceIntruder.setSelected(flowFilterCaptureSourceIntruderOnlyOrig);
}
if (which != flowFilterCaptureSourceExtenderOnly && flowFilterCaptureSourceExtenderOnly.isSelected()) {
flowFilterCaptureSourceExtenderOnly.setSelected(false);
flowFilterCaptureSourceExtender.setSelected(flowFilterCaptureSourceExtenderOnlyOrig);
}
if (which == flowFilterCaptureSourceTargetOnly && !flowFilterCaptureSourceTargetOnly.isSelected()) {
flowFilterCaptureSourceTarget.setSelected(flowFilterCaptureSourceTargetOnlyOrig);
}
if (which == flowFilterCaptureSourceProxyOnly && !flowFilterCaptureSourceProxyOnly.isSelected()) {
flowFilterCaptureSourceProxy.setSelected(flowFilterCaptureSourceProxyOnlyOrig);
}
if (which == flowFilterCaptureSourceSpiderOnly && !flowFilterCaptureSourceSpiderOnly.isSelected()) {
flowFilterCaptureSourceSpider.setSelected(flowFilterCaptureSourceSpiderOnlyOrig);
}
if (which == flowFilterCaptureSourceScannerOnly && !flowFilterCaptureSourceScannerOnly.isSelected()) {
flowFilterCaptureSourceScanner.setSelected(flowFilterCaptureSourceScannerOnlyOrig);
}
if (which == flowFilterCaptureSourceRepeaterOnly && !flowFilterCaptureSourceRepeaterOnly.isSelected()) {
flowFilterCaptureSourceRepeater.setSelected(flowFilterCaptureSourceRepeaterOnlyOrig);
}
if (which == flowFilterCaptureSourceIntruderOnly && !flowFilterCaptureSourceIntruderOnly.isSelected()) {
flowFilterCaptureSourceIntruder.setSelected(flowFilterCaptureSourceIntruderOnlyOrig);
}
if (which == flowFilterCaptureSourceExtenderOnly && !flowFilterCaptureSourceExtenderOnly.isSelected()) {
flowFilterCaptureSourceExtender.setSelected(flowFilterCaptureSourceExtenderOnlyOrig);
}
if (which.isSelected()) {
flowFilterCaptureSourceTarget.setEnabled(false);
flowFilterCaptureSourceTarget.setSelected(which == flowFilterCaptureSourceTargetOnly);
flowFilterCaptureSourceProxy.setEnabled(false);
flowFilterCaptureSourceProxy.setSelected(which == flowFilterCaptureSourceProxyOnly);
flowFilterCaptureSourceSpider.setEnabled(false);
flowFilterCaptureSourceSpider.setSelected(which == flowFilterCaptureSourceSpiderOnly);
flowFilterCaptureSourceScanner.setEnabled(false);
flowFilterCaptureSourceScanner.setSelected(which == flowFilterCaptureSourceScannerOnly);
flowFilterCaptureSourceRepeater.setEnabled(false);
flowFilterCaptureSourceRepeater.setSelected(which == flowFilterCaptureSourceRepeaterOnly);
flowFilterCaptureSourceIntruder.setEnabled(false);
flowFilterCaptureSourceIntruder.setSelected(which == flowFilterCaptureSourceIntruderOnly);
flowFilterCaptureSourceExtender.setEnabled(false);
flowFilterCaptureSourceExtender.setSelected(which == flowFilterCaptureSourceExtenderOnly);
} else {
flowFilterCaptureSourceTarget.setSelected(flowFilterCaptureSourceTargetOnlyOrig);
flowFilterCaptureSourceTarget.setEnabled(true);
flowFilterCaptureSourceProxy.setSelected(flowFilterCaptureSourceProxyOnlyOrig);
flowFilterCaptureSourceProxy.setEnabled(true);
flowFilterCaptureSourceSpider.setSelected(flowFilterCaptureSourceSpiderOnlyOrig);
flowFilterCaptureSourceSpider.setEnabled(true);
flowFilterCaptureSourceScanner.setSelected(flowFilterCaptureSourceScannerOnlyOrig);
flowFilterCaptureSourceScanner.setEnabled(!burpFree);
flowFilterCaptureSourceRepeater.setSelected(flowFilterCaptureSourceRepeaterOnlyOrig);
flowFilterCaptureSourceRepeater.setEnabled(true);
flowFilterCaptureSourceIntruder.setSelected(flowFilterCaptureSourceIntruderOnlyOrig);
flowFilterCaptureSourceIntruder.setEnabled(true);
flowFilterCaptureSourceExtender.setSelected(flowFilterCaptureSourceExtenderOnlyOrig);
flowFilterCaptureSourceExtender.setEnabled(true);
}
flowFilterUpdateDescription(true);
}
void flowFilterSourceOnly(JCheckBox which) {
if (which != flowFilterSourceTargetOnly && flowFilterSourceTargetOnly.isSelected()) {
flowFilterSourceTargetOnly.setSelected(false);
flowFilterSourceTarget.setSelected(flowFilterSourceTargetOnlyOrig);
}
if (which != flowFilterSourceProxyOnly && flowFilterSourceProxyOnly.isSelected()) {
flowFilterSourceProxyOnly.setSelected(false);
flowFilterSourceProxy.setSelected(flowFilterSourceProxyOnlyOrig);
}
if (which != flowFilterSourceSpiderOnly && flowFilterSourceSpiderOnly.isSelected()) {
flowFilterSourceSpiderOnly.setSelected(false);
flowFilterSourceSpider.setSelected(flowFilterSourceSpiderOnlyOrig);
}
if (which != flowFilterSourceScannerOnly && flowFilterSourceScannerOnly.isSelected()) {
flowFilterSourceScannerOnly.setSelected(false);
flowFilterSourceScanner.setSelected(flowFilterSourceScannerOnlyOrig);
}
if (which != flowFilterSourceRepeaterOnly && flowFilterSourceRepeaterOnly.isSelected()) {
flowFilterSourceRepeaterOnly.setSelected(false);
flowFilterSourceRepeater.setSelected(flowFilterSourceRepeaterOnlyOrig);
}
if (which != flowFilterSourceIntruderOnly && flowFilterSourceIntruderOnly.isSelected()) {
flowFilterSourceIntruderOnly.setSelected(false);
flowFilterSourceIntruder.setSelected(flowFilterSourceIntruderOnlyOrig);
}
if (which != flowFilterSourceExtenderOnly && flowFilterSourceExtenderOnly.isSelected()) {
flowFilterSourceExtenderOnly.setSelected(false);
flowFilterSourceExtender.setSelected(flowFilterSourceExtenderOnlyOrig);
}
if (which == flowFilterSourceTargetOnly && !flowFilterSourceTargetOnly.isSelected()) {
flowFilterSourceTarget.setSelected(flowFilterSourceTargetOnlyOrig);
}
if (which == flowFilterSourceProxyOnly && !flowFilterSourceProxyOnly.isSelected()) {
flowFilterSourceProxy.setSelected(flowFilterSourceProxyOnlyOrig);
}
if (which == flowFilterSourceSpiderOnly && !flowFilterSourceSpiderOnly.isSelected()) {
flowFilterSourceSpider.setSelected(flowFilterSourceSpiderOnlyOrig);
}
if (which == flowFilterSourceScannerOnly && !flowFilterSourceScannerOnly.isSelected()) {
flowFilterSourceScanner.setSelected(flowFilterSourceScannerOnlyOrig);
}
if (which == flowFilterSourceRepeaterOnly && !flowFilterSourceRepeaterOnly.isSelected()) {
flowFilterSourceRepeater.setSelected(flowFilterSourceRepeaterOnlyOrig);
}
if (which == flowFilterSourceIntruderOnly && !flowFilterSourceIntruderOnly.isSelected()) {
flowFilterSourceIntruder.setSelected(flowFilterSourceIntruderOnlyOrig);
}
if (which == flowFilterSourceExtenderOnly && !flowFilterSourceExtenderOnly.isSelected()) {
flowFilterSourceExtender.setSelected(flowFilterSourceExtenderOnlyOrig);
}
if (which.isSelected()) {
flowFilterSourceTarget.setEnabled(false);
flowFilterSourceTarget.setSelected(which == flowFilterSourceTargetOnly);
flowFilterSourceProxy.setEnabled(false);
flowFilterSourceProxy.setSelected(which == flowFilterSourceProxyOnly);
flowFilterSourceSpider.setEnabled(false);
flowFilterSourceSpider.setSelected(which == flowFilterSourceSpiderOnly);
flowFilterSourceScanner.setEnabled(false);
flowFilterSourceScanner.setSelected(which == flowFilterSourceScannerOnly);
flowFilterSourceRepeater.setEnabled(false);
flowFilterSourceRepeater.setSelected(which == flowFilterSourceRepeaterOnly);
flowFilterSourceIntruder.setEnabled(false);
flowFilterSourceIntruder.setSelected(which == flowFilterSourceIntruderOnly);
flowFilterSourceExtender.setEnabled(false);
flowFilterSourceExtender.setSelected(which == flowFilterSourceExtenderOnly);
} else {
flowFilterSourceTarget.setSelected(flowFilterSourceTargetOnlyOrig);
flowFilterSourceTarget.setEnabled(true);
flowFilterSourceProxy.setSelected(flowFilterSourceProxyOnlyOrig);
flowFilterSourceProxy.setEnabled(true);
flowFilterSourceSpider.setSelected(flowFilterSourceSpiderOnlyOrig);
flowFilterSourceSpider.setEnabled(true);
flowFilterSourceScanner.setSelected(flowFilterSourceScannerOnlyOrig);
flowFilterSourceScanner.setEnabled(!burpFree);
flowFilterSourceRepeater.setSelected(flowFilterSourceRepeaterOnlyOrig);
flowFilterSourceRepeater.setEnabled(true);
flowFilterSourceIntruder.setSelected(flowFilterSourceIntruderOnlyOrig);
flowFilterSourceIntruder.setEnabled(true);
flowFilterSourceExtender.setSelected(flowFilterSourceExtenderOnlyOrig);
flowFilterSourceExtender.setEnabled(true);
}
flowFilterUpdate();
}
private boolean toolFlagFilterProcessing(int toolFlag) {
boolean process = true;
boolean targetOnly = flowFilterSourceTargetOnly.isSelected();
boolean proxyOnly = flowFilterSourceProxyOnly.isSelected();
boolean spiderOnly = flowFilterSourceSpiderOnly.isSelected();
boolean scannerOnly = flowFilterSourceScannerOnly.isSelected();
boolean repeaterOnly = flowFilterSourceRepeaterOnly.isSelected();
boolean intruderOnly = flowFilterSourceIntruderOnly.isSelected();
boolean extenderOnly = flowFilterSourceExtenderOnly.isSelected();
if (toolFlag == IBurpExtenderCallbacks.TOOL_TARGET) {
if (proxyOnly || spiderOnly || scannerOnly || repeaterOnly || intruderOnly || extenderOnly || !flowFilterSourceTarget.isSelected()) {
process = false;
}
} else if (toolFlag == IBurpExtenderCallbacks.TOOL_SPIDER) {
if (targetOnly || proxyOnly || scannerOnly || repeaterOnly || intruderOnly || extenderOnly || !flowFilterSourceSpider.isSelected()) {
process = false;
}
} else if (toolFlag == IBurpExtenderCallbacks.TOOL_SCANNER) {
if (targetOnly || proxyOnly || spiderOnly || repeaterOnly || intruderOnly || extenderOnly || !flowFilterSourceScanner.isSelected()) {
process = false;
}
} else if (toolFlag == IBurpExtenderCallbacks.TOOL_REPEATER) {
if (targetOnly || proxyOnly || spiderOnly || scannerOnly || intruderOnly || extenderOnly || !flowFilterSourceRepeater.isSelected()) {
process = false;
}
} else if (toolFlag == IBurpExtenderCallbacks.TOOL_INTRUDER) {
if (targetOnly || proxyOnly || spiderOnly || scannerOnly || repeaterOnly || extenderOnly || !flowFilterSourceIntruder.isSelected()) {
process = false;
}
} else if (toolFlag == IBurpExtenderCallbacks.TOOL_EXTENDER) {
if (targetOnly || proxyOnly || spiderOnly || scannerOnly || repeaterOnly || intruderOnly || !flowFilterSourceExtender.isSelected()) {
process = false;
}
} else if (!flowFilterSourceProxy.isSelected()) { // "proxy" processes
// all not mentioned
// above
process = false;
}
return process;
}
private boolean toolFlagCaptureProcessing(int toolFlag) {
boolean process = true;
boolean targetOnly = flowFilterCaptureSourceTargetOnly.isSelected();
boolean proxyOnly = flowFilterCaptureSourceProxyOnly.isSelected();
boolean spiderOnly = flowFilterCaptureSourceSpiderOnly.isSelected();
boolean scannerOnly = flowFilterCaptureSourceScannerOnly.isSelected();
boolean repeaterOnly = flowFilterCaptureSourceRepeaterOnly.isSelected();
boolean intruderOnly = flowFilterCaptureSourceIntruderOnly.isSelected();
boolean extenderOnly = flowFilterCaptureSourceExtenderOnly.isSelected();
if (toolFlag == IBurpExtenderCallbacks.TOOL_TARGET) {
if (proxyOnly || spiderOnly || scannerOnly || repeaterOnly || intruderOnly || extenderOnly || !flowFilterCaptureSourceTarget.isSelected()) {
process = false;
}
} else if (toolFlag == IBurpExtenderCallbacks.TOOL_SPIDER) {
if (targetOnly || proxyOnly || scannerOnly || repeaterOnly || intruderOnly || extenderOnly || !flowFilterCaptureSourceSpider.isSelected()) {
process = false;
}
} else if (toolFlag == IBurpExtenderCallbacks.TOOL_SCANNER) {
if (targetOnly || proxyOnly || spiderOnly || repeaterOnly || intruderOnly || extenderOnly || !flowFilterCaptureSourceScanner.isSelected()) {
process = false;
}
} else if (toolFlag == IBurpExtenderCallbacks.TOOL_REPEATER) {
if (targetOnly || proxyOnly || spiderOnly || scannerOnly || intruderOnly || extenderOnly || !flowFilterCaptureSourceRepeater.isSelected()) {
process = false;
}
} else if (toolFlag == IBurpExtenderCallbacks.TOOL_INTRUDER) {
if (targetOnly || proxyOnly || spiderOnly || scannerOnly || repeaterOnly || extenderOnly || !flowFilterCaptureSourceIntruder.isSelected()) {
process = false;
}
} else if (toolFlag == IBurpExtenderCallbacks.TOOL_EXTENDER) {
if (targetOnly || proxyOnly || spiderOnly || scannerOnly || repeaterOnly || intruderOnly || !flowFilterCaptureSourceExtender.isSelected()) {
process = false;
}
} else if (!flowFilterCaptureSourceProxy.isSelected()) { // "proxy" processes
// all not mentioned
// above
process = false;
}
return process;
}
// flow filter default
private void flowFilterSetDefaults() {
flowFilterInscope.setSelected(false);
flowFilterOutofscope.setSelected(false);
flowFilterParametrized.setSelected(false);
flowFilterSearchField.setText("");
flowFilterSearchCaseSensitive.setSelected(false);
flowFilterSearchNegative.setSelected(false);
flowFilterSearchRegex.setSelected(false);
flowFilterSearchRequest.setSelected(false);
flowFilterSearchResponse.setSelected(false);
// flowFilter
flowFilterSourceTarget.setSelected(true);
flowFilterSourceTarget.setEnabled(true);
flowFilterSourceTargetOnly.setSelected(false);
flowFilterSourceTargetOnlyOrig = true;
flowFilterSourceProxy.setSelected(true);
flowFilterSourceProxy.setEnabled(true);
flowFilterSourceProxyOnly.setSelected(false);
flowFilterSourceProxyOnlyOrig = true;
flowFilterSourceSpider.setSelected(true);
flowFilterSourceSpider.setEnabled(true);
flowFilterSourceSpiderOnly.setSelected(false);
flowFilterSourceSpiderOnlyOrig = true;
flowFilterSourceScanner.setSelected(!burpFree);
flowFilterSourceScanner.setEnabled(!burpFree);
flowFilterSourceScannerOnly.setSelected(false);
flowFilterSourceScannerOnlyOrig = !burpFree;
flowFilterSourceRepeater.setSelected(true);
flowFilterSourceRepeater.setEnabled(true);
flowFilterSourceRepeaterOnly.setSelected(false);
flowFilterSourceRepeaterOnlyOrig = true;
flowFilterSourceIntruder.setSelected(true);
flowFilterSourceIntruder.setEnabled(true);
flowFilterSourceIntruderOnly.setSelected(false);
flowFilterSourceIntruderOnlyOrig = true;
flowFilterSourceExtender.setSelected(true);
flowFilterSourceExtender.setEnabled(true);
flowFilterSourceExtenderOnly.setSelected(false);
flowFilterSourceExtenderOnlyOrig = true;
// filterFilterCapture
flowFilterCaptureSourceTarget.setSelected(true);
flowFilterCaptureSourceTarget.setEnabled(true);
flowFilterCaptureSourceTargetOnly.setSelected(false);
flowFilterCaptureSourceTargetOnlyOrig = true;
flowFilterCaptureSourceProxy.setSelected(true);
flowFilterCaptureSourceProxy.setEnabled(true);
flowFilterCaptureSourceProxyOnly.setSelected(false);
flowFilterCaptureSourceProxyOnlyOrig = true;
flowFilterCaptureSourceSpider.setSelected(true);
flowFilterCaptureSourceSpider.setEnabled(true);
flowFilterCaptureSourceSpiderOnly.setSelected(false);
flowFilterCaptureSourceSpiderOnlyOrig = true;
flowFilterCaptureSourceScanner.setSelected(!burpFree);
flowFilterCaptureSourceScanner.setEnabled(!burpFree);
flowFilterCaptureSourceScannerOnly.setSelected(false);
flowFilterCaptureSourceScannerOnlyOrig = !burpFree;
flowFilterCaptureSourceRepeater.setSelected(true);
flowFilterCaptureSourceRepeater.setEnabled(true);
flowFilterCaptureSourceRepeaterOnly.setSelected(false);
flowFilterCaptureSourceRepeaterOnlyOrig = true;
flowFilterCaptureSourceIntruder.setSelected(true);
flowFilterCaptureSourceIntruder.setEnabled(true);
flowFilterCaptureSourceIntruderOnly.setSelected(false);
flowFilterCaptureSourceIntruderOnlyOrig = true;
flowFilterCaptureSourceExtender.setSelected(true);
flowFilterCaptureSourceExtender.setEnabled(true);
flowFilterCaptureSourceExtenderOnly.setSelected(false);
flowFilterCaptureSourceExtenderOnlyOrig = true;
//
flowFilterBottom.requestFocus();
flowFilterUpdate();
}
// flow filter description update
private void flowFilterUpdateDescription(boolean show) {
StringBuilder filterDescription = new StringBuilder("Filter: ");
// filter
boolean filterAll = true;
if (flowFilterInscope.isSelected()) {
filterDescription.append("In-scope, ");
filterAll = false;
}
if (flowFilterOutofscope.isSelected()) {
filterDescription.append("Out-of-scope, ");
filterAll = false;
}
if (flowFilterParametrized.isSelected()) {
filterDescription.append("Parametrized only, ");
filterAll = false;
}
if (flowFilterSearchField.getText().length() != 0) {
filterDescription.append("\"").append(flowFilterSearchField.getText()).append("\"");
StringBuffer searchAttrib = new StringBuffer(" (");
boolean searchHasAttr = false;
if (flowFilterSearchCaseSensitive.isSelected()) {
searchAttrib.append("case sensitive");
searchHasAttr = true;
}
if (flowFilterSearchRegex.isSelected()) {
if (searchHasAttr) {
searchAttrib.append(", ");
}
searchAttrib.append("regex");
searchHasAttr = true;
}
if (flowFilterSearchRequest.isSelected() && flowFilterSearchResponse.isSelected()) {
if (searchHasAttr) {
searchAttrib.append(", ");
}
searchAttrib.append("in request & response");
searchHasAttr = true;
} else {
if (flowFilterSearchRequest.isSelected()) {
if (searchHasAttr) {
searchAttrib.append(", ");
}
searchAttrib.append("in request");
searchHasAttr = true;
}
if (flowFilterSearchResponse.isSelected()) {
if (searchHasAttr) {
searchAttrib.append(", ");
}
searchAttrib.append("in response");
searchHasAttr = true;
}
}
if (flowFilterSearchNegative.isSelected()) {
if (searchHasAttr) {
searchAttrib.append(", ");
}
searchAttrib.append("negative");
searchHasAttr = true;
}
if (searchHasAttr) {
filterDescription.append(searchAttrib).append(")");
}
filterDescription.append(", ");
filterAll = false;
}
if (filterAll) {
filterDescription.append("All, ");
}
// filter sources
int filterSources = 0;
if (flowFilterSourceTargetOnly.isSelected()) {
filterDescription.append("Target only");
} else if (flowFilterSourceProxyOnly.isSelected()) {
filterDescription.append("Proxy only");
} else if (flowFilterSourceSpiderOnly.isSelected()) {
filterDescription.append("Spider only");
} else if (flowFilterSourceScannerOnly.isSelected()) {
filterDescription.append("Scanner only");
} else if (flowFilterSourceRepeaterOnly.isSelected()) {
filterDescription.append("Repeater only");
} else if (flowFilterSourceIntruderOnly.isSelected()) {
filterDescription.append("Intruder only");
} else if (flowFilterSourceExtenderOnly.isSelected()) {
filterDescription.append("Extender only");
} else if (flowFilterSourceTarget.isSelected() && flowFilterSourceProxy.isSelected() && flowFilterSourceSpider.isSelected() && (burpFree || flowFilterSourceScanner.isSelected()) && flowFilterSourceRepeater.isSelected() && flowFilterSourceIntruder.isSelected() && flowFilterSourceExtender.isSelected()) {
filterDescription.append("All sources");
} else {
if (flowFilterSourceTarget.isSelected()) {
filterDescription.append("T");
filterSources += 1;
}
if (flowFilterSourceProxy.isSelected()) {
filterDescription.append("P");
filterSources += 1;
}
if (flowFilterSourceSpider.isSelected()) {
filterDescription.append("S");
filterSources += 1;
}
if (flowFilterSourceScanner.isSelected()) {
filterDescription.append("C");
filterSources += 1;
}
if (flowFilterSourceRepeater.isSelected()) {
filterDescription.append("R");
filterSources += 1;
}
if (flowFilterSourceIntruder.isSelected()) {
filterDescription.append("I");
filterSources += 1;
}
if (flowFilterSourceExtender.isSelected()) {
filterDescription.append("E");
filterSources += 1;
}
if (filterSources == 0) {
filterDescription.append("None");
}
}
// filter capture
filterDescription.append(", Capture: ");
// filter sources
int FilterCaptureSources = 0;
if (flowFilterCaptureSourceTargetOnly.isSelected()) {
filterDescription.append("Target only");
} else if (flowFilterCaptureSourceProxyOnly.isSelected()) {
filterDescription.append("Proxy only");
} else if (flowFilterCaptureSourceSpiderOnly.isSelected()) {
filterDescription.append("Spider only");
} else if (flowFilterCaptureSourceScannerOnly.isSelected()) {
filterDescription.append("Scanner only");
} else if (flowFilterCaptureSourceRepeaterOnly.isSelected()) {
filterDescription.append("Repeater only");
} else if (flowFilterCaptureSourceIntruderOnly.isSelected()) {
filterDescription.append("Intruder only");
} else if (flowFilterCaptureSourceExtenderOnly.isSelected()) {
filterDescription.append("Extender only");
} else if (flowFilterCaptureSourceTarget.isSelected() && flowFilterCaptureSourceProxy.isSelected() && flowFilterCaptureSourceSpider.isSelected() && (burpFree || flowFilterCaptureSourceScanner.isSelected()) && flowFilterCaptureSourceRepeater.isSelected() && flowFilterCaptureSourceIntruder.isSelected() && flowFilterCaptureSourceExtender.isSelected()) {
filterDescription.append("All sources");
} else {
if (flowFilterCaptureSourceTarget.isSelected()) {
filterDescription.append("T");
FilterCaptureSources += 1;
}
if (flowFilterCaptureSourceProxy.isSelected()) {
filterDescription.append("P");
FilterCaptureSources += 1;
}
if (flowFilterCaptureSourceSpider.isSelected()) {
filterDescription.append("S");
FilterCaptureSources += 1;
}
if (flowFilterCaptureSourceScanner.isSelected()) {
filterDescription.append("C");
FilterCaptureSources += 1;
}
if (flowFilterCaptureSourceRepeater.isSelected()) {
filterDescription.append("R");
FilterCaptureSources += 1;
}
if (flowFilterCaptureSourceIntruder.isSelected()) {
filterDescription.append("I");
FilterCaptureSources += 1;
}
if (flowFilterCaptureSourceExtender.isSelected()) {
filterDescription.append("E");
FilterCaptureSources += 1;
}
if (FilterCaptureSources == 0) {
filterDescription.append("None");
}
}
flowFilterText = filterDescription.toString();
if (show && (flowFilterWorker == null || flowFilterWorker.isDone())) {
flowFilter.setText(flowFilterText);
} else {
flowFilter.setText(flowFilterText + " (Please wait...)");
}
}
// flow filter update
private void flowFilterUpdate() {
final ArrayList<RowFilter<FlowTableModel, Number>> mergedFilter = new ArrayList<>();
// manual filter
RowFilter<FlowTableModel, Number> manualFilter;
// filter logic
final String text = flowFilterSearchField.getText();
final Pattern pattern;
if (flowFilterSearchRegex.isSelected()) {
if (flowFilterSearchCaseSensitive.isSelected()) {
pattern = Pattern.compile(text);
} else {
pattern = Pattern.compile(text, Pattern.CASE_INSENSITIVE);
}
} else {
if (flowFilterSearchCaseSensitive.isSelected()) {
pattern = Pattern.compile(Pattern.quote(text));
} else {
pattern = Pattern.compile(Pattern.quote(text), Pattern.CASE_INSENSITIVE);
}
}
// process
manualFilter = new RowFilter<FlowTableModel, Number>() {
@Override
public boolean include(javax.swing.RowFilter.Entry<? extends FlowTableModel, ? extends Number> entry) {
FlowEntry flowEntry;
flowEntry = flow.get(entry.getIdentifier().intValue());
boolean result = true;
// mode
if (result && mode == 0 && flowEntry.isIncomplete()) {
result = false;
}
// in-scope
if (result && flowFilterInscope.isSelected() && !callbacks.isInScope(flowEntry.url)) {
result = false;
}
// out-of-scope
if (result && flowFilterOutofscope.isSelected() && callbacks.isInScope(flowEntry.url)) {
result = false;
}
// parametrized
if (result && flowFilterParametrized.isSelected() && !flowEntry.hasParams) {
result = false;
}
// search
if (result && flowFilterSearchField.getText().length() != 0) {
boolean found;
String req = new String(flowEntry.messageInfoPersisted.getRequest());
byte[] response = flowEntry.messageInfoPersisted.getResponse();
String resp;
if (response != null) {
resp = new String(response);
} else {
resp = "";
}
boolean foundInReq = pattern.matcher(req).find();
boolean foundInResp = pattern.matcher(resp).find();
if (flowFilterSearchRequest.isSelected() && flowFilterSearchResponse.isSelected()) {
found = foundInReq && foundInResp;
} else if (flowFilterSearchRequest.isSelected()) {
found = foundInReq;
} else if (flowFilterSearchResponse.isSelected()) {
found = foundInResp;
} else {
found = foundInReq || foundInResp;
}
if (flowFilterSearchNegative.isSelected()) {
if (found) {
result = false;
}
} else if (!found) {
result = false;
}
}
// capture
if (result && !toolFlagFilterProcessing(flowEntry.toolFlag)) {
result = false;
}
return result;
}
};
mergedFilter.add(manualFilter);
// regex filter
//if (flowFilterSearchField.getText().length() != 0) {
// RowFilter<FlowTableModel, Number> regexFilter;
// try {
// if (flowFilterSearchCaseSensitive.isSelected()) {
// regexFilter = RowFilter.regexFilter(flowFilterSearchField.getText());
// } else {
// regexFilter = RowFilter.regexFilter("(?i)" + flowFilterSearchField.getText());
// }
// } catch (java.util.regex.PatternSyntaxException e) {
// return;
// }
//
// if (flowFilterSearchNegative.isSelected()) {
// mergedFilter.add(RowFilter.notFilter(regexFilter));
// } else {
// mergedFilter.add(regexFilter);
// }
//}
// flowTableSorter.setRowFilter(RowFilter.andFilter(mergedFilter));
//SwingUtilities.invokeLater(new Runnable() {
//
// @Override
// public void run() {
// flowTableSorter.setRowFilter(RowFilter.andFilter(mergedFilter));
// }
//});
flowFilterUpdateDescription(false);
if (flowFilterWorker != null) {
try {
flowFilterWorker.cancel(true);
} catch (Exception ex) {
// do nothing
}
}
(flowFilterWorker = new FilterWorker(RowFilter.andFilter(mergedFilter))).execute();
}
class FilterWorker extends SwingWorker<Object, Object> {
private final RowFilter<FlowTableModel, Number> filter;
public FilterWorker(RowFilter<FlowTableModel, Number> filter) {
this.filter = filter;
}
@Override
protected Object doInBackground() throws Exception {
flowTableSorter.setRowFilter(filter);
return null;
}
@Override
protected void done() {
flowFilter.setText(flowFilterText);
flowTable.repaint();
}
}
private static String abbreviateMiddle(String str, String middle, int length) {
if (str.length() == 0 || middle.length() == 0) {
return str;
}
if (length >= str.length() || length < middle.length() + 2) {
return str;
}
int targetSting = length - middle.length();
int startOffset = targetSting / 2 + targetSting % 2;
int endOffset = str.length() - targetSting / 2;
StringBuilder builder = new StringBuilder(length);
builder.append(str.substring(0, startOffset));
builder.append(middle);
builder.append(str.substring(endOffset));
return builder.toString();
}
//
// flowTableModel (AbstractTableModel) class
//
// class FlowTableModel extends DefaultTableModel {
class FlowTableModel extends AbstractTableModel {
// private static final Object[][] flowTableSpecs = {{"Index","#",40,Integer}, ...
@Override
public int getRowCount() {
return flow.size();
}
@Override
public int getColumnCount() {
return 13;
}
@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
switch (columnIndex) {
case 12:
return true;
default:
return false;
}
}
@Override
public Class<?> getColumnClass(int columnIndex) {
switch (columnIndex) {
case 0:
return Integer.class; // "#"
//case 1:
// return "Tool";
//case 2:
// return "Host";
//case 3:
// return "Method";
//case 4:
// return "URL";
//case 5:
// return "Reflect";
case 6:
return Boolean.class; // "Params"
case 7:
return Integer.class; // "Count"
case 8:
return Integer.class; // "Status"
case 9:
return Integer.class; // "Length"
//case 10:
// return "MIME";
case 11:
return Date.class; // "Date"
//case 12:
// return "Comment";
default:
return String.class;
}
}
public int getPreferredWidth(int column) {
switch (column) {
case 0:
return 40;
case 1:
return 60;
case 2:
return 150;
case 3:
return 55;
case 4:
return 430;
case 5:
return 55;
case 6:
return 55;
case 7:
return 55;
case 8:
return 55;
case 9:
return 55;
case 10:
return 55;
case 11:
return 130;
case 12:
return 160;
default:
return 20;
}
}
@Override
public String getColumnName(int column) {
// return (String) flowTableCols[column][0];
switch (column) {
case 0:
return "#";
case 1:
return "Tool";
case 2:
return "Host";
case 3:
return "Method";
case 4:
return "URL";
case 5:
return "Reflect";
case 6:
return "Params";
case 7:
return "Count";
case 8:
return "Status";
case 9:
return "Length";
case 10:
return "MIME";
case 11:
return "Time";
case 12:
return "Comment";
default:
return "";
}
}
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
try {
FlowEntry flowEntry = flow.get(rowIndex);
switch (columnIndex) {
case 0:
return flowEntry.id; // rowIndex + 1;
case 1:
return callbacks.getToolName(flowEntry.toolFlag);
case 2:
return new StringBuilder(flowEntry.url.getProtocol()).append("://").append(flowEntry.url.getHost()).toString();
case 3:
return flowEntry.method;
case 4:
return flowEntry.getPath(); //flowEntry.getQueryPath();
case 5:
return new String(new char[flowEntry.getReflections().size()]).replace("\0", "|");
case 6:
return flowEntry.hasParams;
case 7:
return flowEntry.paramCount;
case 8:
return flowEntry.status;
case 9:
return flowEntry.length;
case 10:
return flowEntry.mime;
case 11:
return flowEntry.date; //new SimpleDateFormat("HH:mm:ss d MMM yyyy").format(flowEntry.date);
case 12:
return flowEntry.comment;
default:
return "";
}
} catch (Exception ex) {
ex.printStackTrace(stderr);
return null;
}
}
@Override
public void setValueAt(Object value, int rowIndex, int colIndex) {
FlowEntry flowEntry = flow.get(rowIndex);
flowEntry.comment = (String) value;
fireTableCellUpdated(rowIndex, colIndex);
}
public void removeRowAt(int rowIndex) {
flow.remove(rowIndex);
fireTableDataChanged();
}
public void remove(FlowEntry entry) {
flow.remove(entry);
fireTableDataChanged();
}
public void removeAll() {
flow.clear();
fireTableDataChanged();
}
public void removeAll(int[] rows) {
for (int i = 0; i < rows.length; i++) {
flow.remove(rows[i]);
}
fireTableDataChanged();
}
}
//
// FlowEntry class
//
public static final class FlowEntry {
private static int newID = 1;
private final int id;
private final int toolFlag;
private IHttpRequestResponsePersisted messageInfoPersisted;
//private IHttpRequestResponse messageInfo;
private String incomplete;
private final String method;
private final URL url;
private final boolean hasParams;
private int paramCount;
private int status;
private int length;
private String mime;
private final Date date;
private String comment;
private final String path;
private final String queryPath;
private final ArrayList<IParameter> reflections;
private final IHttpService service;
//public String serialize() {
// return "";
//}
//public static FlowEntry deserialize() {
// return new FlowEntry();
//}
void update(IHttpRequestResponse messageInfo) {
// status = 999;
// stdout.println(" Update");
byte[] response = messageInfo.getResponse();
if (response != null) {
incomplete = null;
messageInfoPersisted = callbacks.saveBuffersToTempFiles(messageInfo);
onResponse(response);
}
}
void onResponse(byte[] response) {
IResponseInfo responseInfo = helpers.analyzeResponse(response);
status = responseInfo.getStatusCode();
length = messageInfoPersisted.getResponse().length - responseInfo.getBodyOffset();
mime = responseInfo.getStatedMimeType();
IRequestInfo requestInfo = helpers.analyzeRequest(messageInfoPersisted);
String responseBody = helpers.bytesToString(response).substring(responseInfo.getBodyOffset());
for (IParameter requestParam : requestInfo.getParameters()) {
// exclude cookies
if (requestParam.getType() != IParameter.PARAM_COOKIE) {
// parameter value has at least 3 chars
String value = requestParam.getValue();
// reflected in response?
if (value.length() > 3 && responseBody.contains(value)) {
reflections.add(requestParam);
}
}
}
}
FlowEntry(int toolFlag, IHttpRequestResponse messageInfo) {
this.id = FlowEntry.newID;
FlowEntry.newID += 1;
this.toolFlag = toolFlag;
//this.messageInfo = messageInfo;
messageInfoPersisted = callbacks.saveBuffersToTempFiles(messageInfo);
IRequestInfo requestInfo;
requestInfo = helpers.analyzeRequest(messageInfo);
method = requestInfo.getMethod();
url = requestInfo.getUrl();
service = messageInfo.getHttpService();
reflections = new ArrayList<>();
path = url.getPath();
{
StringBuilder pathBuilder = new StringBuilder(url.getPath());
String query = url.getQuery();
if (query != null) {
pathBuilder.append("?").append(query);
}
queryPath = pathBuilder.toString();
}
byte[] response = messageInfo.getResponse();
if (response == null) {
incomplete = helpers.bytesToString(messageInfo.getRequest());
FLOW_INCOMPLETE.add(FlowEntry.this);
}
boolean hasGetParams = url.getQuery() != null;
boolean hasPostParams = messageInfoPersisted.getRequest().length - requestInfo.getBodyOffset() > 0;
hasParams = hasGetParams || hasPostParams;
if (hasParams) {
for (IParameter param : requestInfo.getParameters()) {
byte type = param.getType();
if (type == IParameter.PARAM_BODY || type == IParameter.PARAM_URL) {
paramCount += 1;
}
}
}
if (response != null) {
onResponse(response);
} else {
status = -1;
length = -1;
mime = "";
}
date = new Date();
comment = "";
}
public boolean isIncomplete() {
return incomplete != null;
}
/**
* Returns URL's path along with query string (if present)
*
* @return queryPath
*/
public String getQueryPath() {
return queryPath;
}
public String getPath() {
return path;
}
public ArrayList<IParameter> getReflections() {
return reflections;
}
public URL getUrl() {
return url;
}
public IHttpRequestResponse getMessageInfo() {
return (IHttpRequestResponse) messageInfoPersisted;
}
public IHttpService getService() {
return service;
}
}
//
// FlowEntryEditor (IMessageEditorController) class
//
class FlowEntryEditor implements IMessageEditorController {
@Override
public IHttpService getHttpService() {
return flowCurrentEntry.messageInfoPersisted.getHttpService();
}
@Override
public byte[] getRequest() {
return flowCurrentEntry.messageInfoPersisted.getRequest();
}
@Override
public byte[] getResponse() {
return flowCurrentEntry.messageInfoPersisted.getResponse();
}
}
//
// Table (JTable) class to handle cell selection
//
private class FlowTable extends JTable {
public FlowTable(TableModel tableModel) {
super(tableModel);
}
public void updateResponse() {
byte[] response = flowCurrentEntry.messageInfoPersisted.getResponse();
if (response != null) {
flowRespView.setMessage(flowCurrentEntry.messageInfoPersisted.getResponse(), false);
} else {
flowRespView.setMessage(new byte[0], false);
}
}
@Override
public void changeSelection(int row, int col, boolean toggle, boolean extend) {
FlowEntry flowEntry = flow.get(flowTable.convertRowIndexToModel(row));
flowReqView.setMessage(flowEntry.messageInfoPersisted.getRequest(), true);
flowCurrentEntry = flowEntry;
updateResponse();
super.changeSelection(row, col, toggle, extend);
}
@Override
public JPopupMenu getComponentPopupMenu() {
Point pt = getMousePosition();
if (pt != null) {
popupPointedFlowEntry = flow.get(flowTable.convertRowIndexToModel(rowAtPoint(pt)));
flowTablePopup.getHeader().setText(abbreviateMiddle(popupPointedFlowEntry.url.toString(), "...", 70));
} else {
popupPointedFlowEntry = null;
}
// scope add/remove options visibility
int selectedCount = flowTable.getSelectedRows().length;
flowTablePopup.scopeSeparator.setVisible(selectedCount > 0);
if (selectedCount > 0) {
if (selectedCount > 1) {
flowTablePopup.scopeAdd.setVisible(true);
flowTablePopup.scopeExclude.setVisible(true);
} else {
boolean inScope = callbacks.isInScope(flow.get(flowTable.convertRowIndexToModel(flowTable.getSelectedRows()[0])).url);
flowTablePopup.scopeAdd.setVisible(!inScope);
flowTablePopup.scopeExclude.setVisible(inScope);
}
} else {
flowTablePopup.scopeAdd.setVisible(false);
flowTablePopup.scopeExclude.setVisible(false);
}
//
return super.getComponentPopupMenu();
}
}
class FlowTablePopup extends JPopupMenu {
private final JMenuItem header;
final Separator scopeSeparator;
final JMenuItem scopeAdd;
final JMenuItem scopeExclude;
public JMenuItem getHeader() {
return header;
}
public FlowTablePopup() {
header = new JMenuItem();
scopeSeparator = new Separator();
scopeAdd = new JMenuItem("Add to scope");
scopeAdd.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
for (int i : flowTable.getSelectedRows()) {
callbacks.includeInScope(flow.get(flowTable.convertRowIndexToModel(i)).url);
}
}
});
scopeExclude = new JMenuItem("Remove from scope");
scopeExclude.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
for (int i : flowTable.getSelectedRows()) {
callbacks.excludeFromScope(flow.get(flowTable.convertRowIndexToModel(i)).url);
}
}
});
initialize();
}
private void initialize() {
add(header);
add(scopeSeparator);
add(scopeAdd);
add(scopeExclude);
add(new Separator());
JMenuItem doAnActiveScan = new JMenuItem("Do an active scan");
doAnActiveScan.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
IHttpService service = popupPointedFlowEntry.messageInfoPersisted.getHttpService();
callbacks.doActiveScan(service.getHost(), service.getPort(), "https".equals(service.getProtocol()), popupPointedFlowEntry.messageInfoPersisted.getRequest());
}
});
add(doAnActiveScan);
JMenuItem doAPassiveScan = new JMenuItem("Do a passive scan");
doAPassiveScan.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
IHttpService service = popupPointedFlowEntry.messageInfoPersisted.getHttpService();
callbacks.doPassiveScan(service.getHost(), service.getPort(), "https".equals(service.getProtocol()), popupPointedFlowEntry.messageInfoPersisted.getRequest(), popupPointedFlowEntry.messageInfoPersisted.getResponse());
}
});
add(doAPassiveScan);
JMenuItem sendToIntruder = new JMenuItem("Send to Intruder");
sendToIntruder.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
IHttpService service = popupPointedFlowEntry.messageInfoPersisted.getHttpService();
callbacks.sendToIntruder(service.getHost(), service.getPort(), "https".equals(service.getProtocol()), popupPointedFlowEntry.messageInfoPersisted.getRequest());
}
});
add(sendToIntruder);
JMenuItem sendToRepeater = new JMenuItem("Send to Repeater");
sendToRepeater.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
IHttpService service = popupPointedFlowEntry.messageInfoPersisted.getHttpService();
callbacks.sendToRepeater(service.getHost(), service.getPort(), "https".equals(service.getProtocol()), popupPointedFlowEntry.messageInfoPersisted.getRequest(), null);
}
});
add(sendToRepeater);
JMenu history = new JMenu("History");
add(history);
//JMenuItem saveHistory = new JMenuItem("Save history");
//saveHistory.addActionListener(new ActionListener() {
// @Override
// public void actionPerformed(ActionEvent e) {
// // TODO
// }
//});
//history.add(saveHistory);
//JMenuItem loadHistory = new JMenuItem("Load history");
//loadHistory.addActionListener(new ActionListener() {
// @Override
// public void actionPerformed(ActionEvent e) {
// // TODO
// }
//});
//history.add(loadHistory);
JMenuItem clearAll = new JMenuItem("Clear history");
clearAll.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(burpFrame, "Are you sure you want to clear the history?", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE)) {
flowTableModel.removeAll();
}
}
});
history.add(clearAll);
add(new Separator());
JMenuItem addNewIssue = new JMenuItem("Add new sitemap issue");
addNewIssue.setEnabled(burpFree == false);
addNewIssue.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
//int[] rows = flowTable.getSelectedRows();
//for (int i = 0; i < rows.length; i++) {
// rows[i] = flowTable.convertRowIndexToModel(rows[i]);
//}
showAddNewIssueDialog();
}
});
add(addNewIssue);
add(new Separator());
//JMenuItem delete = new JMenuItem("Delete");
//delete.addActionListener(new ActionListener() {
//
// @Override
// public void actionPerformed(ActionEvent e) {
// if (popupPointedFlowEntry != null) {
// flowTableModel.remove(popupPointedFlowEntry);
// popupPointedFlowEntry = null;
// }
// }
//});
//add(delete);
//
//JMenuItem temp = new JMenuItem("temp");
//temp.addActionListener(new ActionListener() {
//
// @Override
// public void actionPerformed(ActionEvent e) {
// tempy = popupPointedFlowEntry;
// flowTable.repaint();
// }
//});
//add(temp);
JMenuItem deleteSelected = new JMenuItem("Delete selected");
deleteSelected.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
int[] rows = flowTable.getSelectedRows();
for (int i = 0; i < rows.length; i++) {
rows[i] = flowTable.convertRowIndexToModel(rows[i]);
}
flowTableModel.removeAll(rows);
}
});
add(deleteSelected);
JMenuItem copyURL = new JMenuItem("Copy URL");
copyURL.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
clipboard.setContents(new StringSelection(popupPointedFlowEntry.url.toString()), null);
}
});
add(copyURL);
}
}
private String paramType(byte type) {
String result;
switch (type) {
case IParameter.PARAM_BODY:
result = "BODY";
break;
case IParameter.PARAM_COOKIE:
result = "COOKIE";
break;
case IParameter.PARAM_JSON:
result = "JSON";
break;
case IParameter.PARAM_MULTIPART_ATTR:
result = "MULTIPART_ATTR";
break;
case IParameter.PARAM_URL:
result = "URL";
break;
case IParameter.PARAM_XML:
result = "XML";
break;
case IParameter.PARAM_XML_ATTR:
result = "XML_ATTR";
break;
default:
result = Byte.toString(type);
}
return result;
}
class FlowTableCellRenderer extends DefaultTableCellRenderer {
@Override
protected void setValue(Object value) {
if (value instanceof Date) {
value = new SimpleDateFormat("HH:mm:ss d MMM yyyy").format(value);
}
if ((value instanceof Integer) && ((Integer) value == -1)) {
value = "";
}
super.setValue(value);
}
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
final Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
int modelRow = table.convertRowIndexToModel(row);
FlowEntry entry = flow.get(modelRow);
if (ThemeHelper.isDarkTheme() == false) {
// c.setBackground(row % 2 == 0 ? Color.LIGHT_GRAY : Color.WHITE);
//if (!isSelected && tempy != null && flowTable.convertRowIndexToModel(row) == flow.indexOf(tempy)) {
// c.setForeground(Color.blue);
//} else {
// c.setForeground(Color.black);
//}
int r = 0, g = 0, b = 0;
if (entry.status == 404 || entry.status == 403) {
r += 196;
g += 128;
b += 128;
}
if (entry.status == 500) {
g += 196;
}
if (entry.toolFlag != IBurpExtenderCallbacks.TOOL_PROXY) {
b += 196;
}
if (r > 255) {
r = 255;
}
if (g > 255) {
g = 255;
}
if (b > 255) {
b = 255;
}
c.setForeground(new Color(r, g, b));
c.setBackground(ThemeHelper.cellBackground(table.getRowCount(), row, isSelected));
}
final ArrayList<String> reflections = new ArrayList<>();
final ArrayList<IParameter> allReflections = entry.getReflections();
int reflectionsAmount = allReflections.size();
if (reflectionsAmount > showReflectionsCount) {
reflectionsAmount = showReflectionsCount;
}
if (allReflections.size() > 0) {
for (IParameter reflection : allReflections.subList(0, reflectionsAmount)) {
String param = reflection.getName();
if (param.length() > 50) {
param = param.substring(0, 50 - 3) + "...";
}
String val = reflection.getValue();
if (val.length() > 50) {
val = val.substring(0, 50 - 3) + "...";
}
reflections.add(new StringBuilder(" (").append(paramType(reflection.getType())).append(") ").append(param).append("=").append(val).toString());
}
if (allReflections.size() > showReflectionsCount) {
reflections.add("...");
}
((JLabel) c).setToolTipText(new StringBuilder("<html>Reflections:<br/>").append(String.join("<br/>", reflections)).append("</html>").toString());
} else {
((JLabel) c).setToolTipText(null);
}
return c;
}
}
public class SeparateViewDialog extends JDialog {
private final Component parent;
private final String title;
@Override
public void dispose() {
if (dialogs.contains(this)) {
dialogs.remove(this);
}
separateView = null;
try {
flowFilterHelpExt.setEnabled(true);
flowComponent.add(flowTab);
flowComponent.revalidate();
flowComponent.repaint();
} catch (Exception ex) {
// do nothing
}
super.dispose();
}
public SeparateViewDialog(final Component parent, String title) {
flowFilterHelpExt.setEnabled(false);
flowComponent.remove(flowTab);
flowComponent.revalidate();
flowComponent.repaint();
this.parent = parent;
this.title = title;
initialize();
}
private void initialize() {
setTitle(title);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setBounds(parent.getBounds());
setContentPane(flowTab);
dialogs.add(this);
setLocationRelativeTo(parent);
setVisible(true);
}
}
public static int getSortOrder() {
return sortOrder;
}
public static FlowExtension getInstance() {
return instance;
}
public static PrintWriter getStderr() {
return stderr;
}
private int parseReflectionsCount(String text) {
int result = showReflectionsCountDefault;
if (text != null) {
try {
showReflectionsCount = Integer.parseInt(text);
if (showReflectionsCount > showReflectionsCountMax) {
showReflectionsCount = showReflectionsCountMax;
}
if (showReflectionsCount < 0) {
showReflectionsCount = 0;
}
} catch (NumberFormatException ex) {
// do nothing
}
}
return result;
}
}
| hvqzao/burp-flow | src/hvqzao/flow/FlowExtension.java | Java | mit | 121,297 |
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Microsoft.DocAsCode.MarkdigEngine.Extensions
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using Markdig.Extensions.Yaml;
using Markdig.Renderers;
using Markdig.Renderers.Html;
using Microsoft.DocAsCode.Common;
public class YamlHeaderRenderer : HtmlObjectRenderer<YamlFrontMatterBlock>
{
protected override void Write(HtmlRenderer renderer, YamlFrontMatterBlock obj)
{
var content = obj.Lines.ToString();
try
{
using (StringReader reader = new StringReader(content))
{
var result = YamlUtility.Deserialize<Dictionary<string, object>>(reader);
if (result != null)
{
renderer.Write("<yamlheader").Write($" start=\"{obj.Line + 1}\" end=\"{obj.Line + obj.Lines.Count + 2}\"");
renderer.WriteAttributes(obj).Write(">");
renderer.Write(WebUtility.HtmlEncode(obj.Lines.ToString()));
renderer.Write("</yamlheader>");
}
}
}
catch (Exception)
{
// not a valid ymlheader, do nothing
Logger.LogWarning("Invalid YamlHeader, ignored");
}
}
}
}
| pascalberger/docfx | src/Microsoft.DocAsCode.MarkdigEngine.Extensions/YamlHeader/YamlHeaderRenderer.cs | C# | mit | 1,541 |
exports.seed = function(knex) {
return knex('users_follows').del()
.then(() => {
return knex('users_follows').insert([{
id: 1,
user_id: 2,
follow_id: 1,
created_at: new Date('2016-06-29 14:26:16 UTC'),
updated_at: new Date('2016-06-29 14:26:16 UTC')
}]);
})
.then(() => {
return knex.raw(
"SELECT setval('users_id_seq', (SELECT MAX(id) FROM users_follows));"
);
});
};
| PortableTomb/capstone | seeds/5users_follows.js | JavaScript | mit | 459 |
<?php namespace Kalley\LaravelOauthClient;
use \Input;
use League\OAuth2\Client\Token\AccessToken;
abstract class AbstractOAuthClient {
protected $provider;
protected $providerName;
protected $token;
public static function factory($providerName, $config) {
$providerName = strtolower($providerName);
if (array_key_exists('identifier', $config)) {
return new OAuth1Client($providerName, $config);
} else {
return new OAuth2Client($providerName, $config);
}
}
public function __construct($providerName, $config) {
$this->providerName = strtolower($providerName);
$providerClass = (isset($this->mapped[$this->providerName]) ? $this->namespace . $this->mapped[$this->providerName] : (array_key_exists('providerClass', $config) ? $config['providerClass'] : $this->providerName));
$this->provider = new $providerClass($config);
}
abstract public function getAccessToken($code);
public function setAccessToken(AccessToken $token) {
$this->token = $token;
}
public function getUserDetails() {
if ( ! $this->token ) {
throw new \Exception('You must first get the access token before getting user details.');
}
return $this->provider->getUserDetails($this->token);
}
public function refreshToken() {
return $this->token;
}
public function __call($method, $args) {
if ( method_exists($this->provider, $method) ) {
switch(count($args)) {
case 0: return $this->provider->$method();
case 1: return $this->provider->$method($args[0]);
case 2: return $this->provider->$method($args[0], $args[1]);
case 3: return $this->provider->$method($args[0], $args[1], $args[2]);
case 4: return $this->provider->$method($args[0], $args[1], $args[2], $args[3]);
case 5: return $this->provider->$method($args[0], $args[1], $args[2], $args[3], $args[4]);
default: return call_user_func_array($method, $args);
}
}
// Throw an Exception?
}
}
| kalley/laravel-oauth-client | src/Kalley/LaravelOauthClient/AbstractOAuthClient.php | PHP | mit | 1,997 |
using System;
using BenchmarkDotNet.Characteristics;
using BenchmarkDotNet.Engines;
using BenchmarkDotNet.Horology;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Reports;
using BenchmarkDotNet.Running;
using JetBrains.Annotations;
using Xunit.Abstractions;
namespace BenchmarkDotNet.Tests.Mocks
{
public class MockEngine : IEngine
{
private readonly ITestOutputHelper output;
private readonly Func<IterationData, TimeInterval> measure;
// ReSharper disable once NotNullMemberIsNotInitialized
public MockEngine(ITestOutputHelper output, Job job, Func<IterationData, TimeInterval> measure)
{
this.output = output;
this.measure = measure;
TargetJob = job;
}
[UsedImplicitly]
public IHost Host { get; }
public Job TargetJob { get; }
public long OperationsPerInvoke { get; } = 1;
[UsedImplicitly]
public Action GlobalSetupAction { get; set; }
[UsedImplicitly]
public Action GlobalCleanupAction { get; set; }
[UsedImplicitly]
public bool IsDiagnoserAttached { get; set; }
public Action<long> MainAction { get; } = _ => { };
public Action<long> IdleAction { get; } = _ => { };
[UsedImplicitly]
public IEngineFactory Factory => null;
public Measurement RunIteration(IterationData data)
{
double nanoseconds = measure(data).Nanoseconds;
var measurement = new Measurement(1, data.IterationMode, data.Index, data.InvokeCount * OperationsPerInvoke, nanoseconds);
WriteLine(measurement.ToOutputLine());
return measurement;
}
public void PreAllocate() { }
public void Jitting() { }
public RunResults Run() => default(RunResults);
public void WriteLine() => output.WriteLine("");
public void WriteLine(string line) => output.WriteLine(line);
public IResolver Resolver => new CompositeResolver(BenchmarkRunnerCore.DefaultResolver, EngineResolver.Instance);
}
} | Teknikaali/BenchmarkDotNet | tests/BenchmarkDotNet.Tests/Mocks/MockEngine.cs | C# | mit | 2,093 |
module customRules {
interface IIntergerOption {
unsigned?: boolean;
zerofill?: boolean;
}
export var integer: ICustomRule = {
convert: function (value: string, options: IIntergerOption, params: string[]): string {
if (options.zerofill) {
return Util.zerofill(new jaco.Jaco(value).toNumeric(false, false).toString(), +params[0]);
} else {
return new jaco.Jaco(value).toNumeric(options.unsigned, false).toString();
}
},
is: function (value: string, options: IIntergerOption, params: string[]): boolean {
return new jaco.Jaco(value).isNumeric(options.unsigned || options.zerofill, false);
}
}
} | YusukeHirao/vorm | src/customRules/integer.ts | TypeScript | mit | 655 |
import random, binascii
class HashOutput(bytearray):
def hexdigest(self) -> str:
return binascii.hexlify(self).decode('ascii')
class PearsonHasher:
def __init__(self, length: int, seed = 'ΑΓΕΩΜΕΤΡΗΤΟΣ ΜΗΔΕΙΣ ΕΙΣΙΤΩ'):
self.length = length
generator = random.Random()
generator.seed(seed)
self.table = list(range(256))
generator.shuffle(self.table)
def hash(self, data: bytes) -> HashOutput:
result = HashOutput()
for byte in range(self.length):
h = self.table[(data[0] + byte) % 256]
for c in data[1:]:
h = self.table[h ^ c]
result.append(h)
return result
if __name__ == '__main__':
for L in (2, 4, 10):
print(L, 'bytes')
hasher = PearsonHasher(L)
for s in ('Lorem ipsum dolor sit amet', 'Morem ipsum dolor sit amet', 'Lorem ipsum dolor sit amet!', 'a', 'b'):
print(s, '\t', hasher.hash(s.encode('utf-8')).hexdigest())
print()
| ze-phyr-us/pearhash | pearhash.py | Python | mit | 908 |
// Copyright (c) 2011-2014 The Bitcoin developers
// Copyright (c) 2014-2015 The Dash developers
// Copyright (c) 2015-2017 The PIVX developers
// Copyright (c) 2017 The Phore developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "overviewpage.h"
#include "ui_overviewpage.h"
#include "bitcoinunits.h"
#include "clientmodel.h"
#include "guiconstants.h"
#include "guiutil.h"
#include "init.h"
#include "obfuscation.h"
#include "obfuscationconfig.h"
#include "optionsmodel.h"
#include "transactionfilterproxy.h"
#include "transactiontablemodel.h"
#include "walletmodel.h"
#include <QAbstractItemDelegate>
#include <QPainter>
#include <QSettings>
#include <QTimer>
#define DECORATION_SIZE 48
#define ICON_OFFSET 16
#define NUM_ITEMS 5
class TxViewDelegate : public QAbstractItemDelegate
{
Q_OBJECT
public:
TxViewDelegate() : QAbstractItemDelegate(), unit(BitcoinUnits::PIV)
{
}
inline void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
{
painter->save();
QIcon icon = qvariant_cast<QIcon>(index.data(Qt::DecorationRole));
QRect mainRect = option.rect;
mainRect.moveLeft(ICON_OFFSET);
QRect decorationRect(mainRect.topLeft(), QSize(DECORATION_SIZE, DECORATION_SIZE));
int xspace = DECORATION_SIZE + 8;
int ypad = 6;
int halfheight = (mainRect.height() - 2 * ypad) / 2;
QRect amountRect(mainRect.left() + xspace, mainRect.top() + ypad, mainRect.width() - xspace - ICON_OFFSET, halfheight);
QRect addressRect(mainRect.left() + xspace, mainRect.top() + ypad + halfheight, mainRect.width() - xspace, halfheight);
icon.paint(painter, decorationRect);
QDateTime date = index.data(TransactionTableModel::DateRole).toDateTime();
QString address = index.data(Qt::DisplayRole).toString();
qint64 amount = index.data(TransactionTableModel::AmountRole).toLongLong();
bool confirmed = index.data(TransactionTableModel::ConfirmedRole).toBool();
QVariant value = index.data(Qt::ForegroundRole);
QColor foreground = COLOR_BLACK;
if (value.canConvert<QBrush>()) {
QBrush brush = qvariant_cast<QBrush>(value);
foreground = brush.color();
}
painter->setPen(foreground);
QRect boundingRect;
painter->drawText(addressRect, Qt::AlignLeft | Qt::AlignVCenter, address, &boundingRect);
if (index.data(TransactionTableModel::WatchonlyRole).toBool()) {
QIcon iconWatchonly = qvariant_cast<QIcon>(index.data(TransactionTableModel::WatchonlyDecorationRole));
QRect watchonlyRect(boundingRect.right() + 5, mainRect.top() + ypad + halfheight, 16, halfheight);
iconWatchonly.paint(painter, watchonlyRect);
}
if (amount < 0) {
foreground = COLOR_NEGATIVE;
} else if (!confirmed) {
foreground = COLOR_UNCONFIRMED;
} else {
foreground = COLOR_BLACK;
}
painter->setPen(foreground);
QString amountText = BitcoinUnits::formatWithUnit(unit, amount, true, BitcoinUnits::separatorAlways);
if (!confirmed) {
amountText = QString("[") + amountText + QString("]");
}
painter->drawText(amountRect, Qt::AlignRight | Qt::AlignVCenter, amountText);
painter->setPen(COLOR_BLACK);
painter->drawText(amountRect, Qt::AlignLeft | Qt::AlignVCenter, GUIUtil::dateTimeStr(date));
painter->restore();
}
inline QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const
{
return QSize(DECORATION_SIZE, DECORATION_SIZE);
}
int unit;
};
#include "overviewpage.moc"
OverviewPage::OverviewPage(QWidget* parent) : QWidget(parent),
ui(new Ui::OverviewPage),
clientModel(0),
walletModel(0),
currentBalance(-1),
currentUnconfirmedBalance(-1),
currentImmatureBalance(-1),
currentWatchOnlyBalance(-1),
currentWatchUnconfBalance(-1),
currentWatchImmatureBalance(-1),
txdelegate(new TxViewDelegate()),
filter(0)
{
nDisplayUnit = 0; // just make sure it's not unitialized
ui->setupUi(this);
// Recent transactions
ui->listTransactions->setItemDelegate(txdelegate);
ui->listTransactions->setIconSize(QSize(DECORATION_SIZE, DECORATION_SIZE));
ui->listTransactions->setMinimumHeight(NUM_ITEMS * (DECORATION_SIZE + 2));
ui->listTransactions->setAttribute(Qt::WA_MacShowFocusRect, false);
connect(ui->listTransactions, SIGNAL(clicked(QModelIndex)), this, SLOT(handleTransactionClicked(QModelIndex)));
// init "out of sync" warning labels
ui->labelWalletStatus->setText("(" + tr("out of sync") + ")");
ui->labelObfuscationSyncStatus->setText("(" + tr("out of sync") + ")");
ui->labelTransactionsStatus->setText("(" + tr("out of sync") + ")");
if (fLiteMode) {
ui->frameObfuscation->setVisible(false);
} else {
if (fMasterNode) {
ui->toggleObfuscation->setText("(" + tr("Disabled") + ")");
ui->obfuscationAuto->setText("(" + tr("Disabled") + ")");
ui->obfuscationReset->setText("(" + tr("Disabled") + ")");
ui->frameObfuscation->setEnabled(false);
} else {
if (!fEnableObfuscation) {
ui->toggleObfuscation->setText(tr("Start Obfuscation"));
} else {
ui->toggleObfuscation->setText(tr("Stop Obfuscation"));
}
timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(obfuScationStatus()));
timer->start(1000);
}
}
// start with displaying the "out of sync" warnings
showOutOfSyncWarning(true);
}
void OverviewPage::handleTransactionClicked(const QModelIndex& index)
{
if (filter)
emit transactionClicked(filter->mapToSource(index));
}
OverviewPage::~OverviewPage()
{
if (!fLiteMode && !fMasterNode) disconnect(timer, SIGNAL(timeout()), this, SLOT(obfuScationStatus()));
delete ui;
}
void OverviewPage::setBalance(const CAmount& balance, const CAmount& unconfirmedBalance, const CAmount& immatureBalance, const CAmount& anonymizedBalance, const CAmount& watchOnlyBalance, const CAmount& watchUnconfBalance, const CAmount& watchImmatureBalance)
{
currentBalance = balance;
currentUnconfirmedBalance = unconfirmedBalance;
currentImmatureBalance = immatureBalance;
currentAnonymizedBalance = anonymizedBalance;
currentWatchOnlyBalance = watchOnlyBalance;
currentWatchUnconfBalance = watchUnconfBalance;
currentWatchImmatureBalance = watchImmatureBalance;
ui->labelBalance->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, balance - immatureBalance, false, BitcoinUnits::separatorAlways));
ui->labelUnconfirmed->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, unconfirmedBalance, false, BitcoinUnits::separatorAlways));
ui->labelImmature->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, immatureBalance, false, BitcoinUnits::separatorAlways));
ui->labelAnonymized->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, anonymizedBalance, false, BitcoinUnits::separatorAlways));
ui->labelTotal->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, balance + unconfirmedBalance, false, BitcoinUnits::separatorAlways));
ui->labelWatchAvailable->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, watchOnlyBalance, false, BitcoinUnits::separatorAlways));
ui->labelWatchPending->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, watchUnconfBalance, false, BitcoinUnits::separatorAlways));
ui->labelWatchImmature->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, watchImmatureBalance, false, BitcoinUnits::separatorAlways));
ui->labelWatchTotal->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, watchOnlyBalance + watchUnconfBalance + watchImmatureBalance, false, BitcoinUnits::separatorAlways));
// only show immature (newly mined) balance if it's non-zero, so as not to complicate things
// for the non-mining users
bool showImmature = immatureBalance != 0;
bool showWatchOnlyImmature = watchImmatureBalance != 0;
// for symmetry reasons also show immature label when the watch-only one is shown
ui->labelImmature->setVisible(showImmature || showWatchOnlyImmature);
ui->labelImmatureText->setVisible(showImmature || showWatchOnlyImmature);
ui->labelWatchImmature->setVisible(showWatchOnlyImmature); // show watch-only immature balance
updateObfuscationProgress();
static int cachedTxLocks = 0;
if (cachedTxLocks != nCompleteTXLocks) {
cachedTxLocks = nCompleteTXLocks;
ui->listTransactions->update();
}
}
// show/hide watch-only labels
void OverviewPage::updateWatchOnlyLabels(bool showWatchOnly)
{
ui->labelSpendable->setVisible(showWatchOnly); // show spendable label (only when watch-only is active)
ui->labelWatchonly->setVisible(showWatchOnly); // show watch-only label
ui->lineWatchBalance->setVisible(showWatchOnly); // show watch-only balance separator line
ui->labelWatchAvailable->setVisible(showWatchOnly); // show watch-only available balance
ui->labelWatchPending->setVisible(showWatchOnly); // show watch-only pending balance
ui->labelWatchTotal->setVisible(showWatchOnly); // show watch-only total balance
if (!showWatchOnly) {
ui->labelWatchImmature->hide();
} else {
ui->labelBalance->setIndent(20);
ui->labelUnconfirmed->setIndent(20);
ui->labelImmature->setIndent(20);
ui->labelTotal->setIndent(20);
}
}
void OverviewPage::setClientModel(ClientModel* model)
{
this->clientModel = model;
if (model) {
// Show warning if this is a prerelease version
connect(model, SIGNAL(alertsChanged(QString)), this, SLOT(updateAlerts(QString)));
updateAlerts(model->getStatusBarWarnings());
}
}
void OverviewPage::setWalletModel(WalletModel* model)
{
this->walletModel = model;
if (model && model->getOptionsModel()) {
// Set up transaction list
filter = new TransactionFilterProxy();
filter->setSourceModel(model->getTransactionTableModel());
filter->setLimit(NUM_ITEMS);
filter->setDynamicSortFilter(true);
filter->setSortRole(Qt::EditRole);
filter->setShowInactive(false);
filter->sort(TransactionTableModel::Date, Qt::DescendingOrder);
ui->listTransactions->setModel(filter);
ui->listTransactions->setModelColumn(TransactionTableModel::ToAddress);
// Keep up to date with wallet
setBalance(model->getBalance(), model->getUnconfirmedBalance(), model->getImmatureBalance(), model->getAnonymizedBalance(),
model->getWatchBalance(), model->getWatchUnconfirmedBalance(), model->getWatchImmatureBalance());
connect(model, SIGNAL(balanceChanged(CAmount, CAmount, CAmount, CAmount, CAmount, CAmount, CAmount)), this, SLOT(setBalance(CAmount, CAmount, CAmount, CAmount, CAmount, CAmount, CAmount)));
connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit()));
connect(ui->obfuscationAuto, SIGNAL(clicked()), this, SLOT(obfuscationAuto()));
connect(ui->obfuscationReset, SIGNAL(clicked()), this, SLOT(obfuscationReset()));
connect(ui->toggleObfuscation, SIGNAL(clicked()), this, SLOT(toggleObfuscation()));
updateWatchOnlyLabels(model->haveWatchOnly());
connect(model, SIGNAL(notifyWatchonlyChanged(bool)), this, SLOT(updateWatchOnlyLabels(bool)));
}
// update the display unit, to not use the default ("PIV")
updateDisplayUnit();
}
void OverviewPage::updateDisplayUnit()
{
if (walletModel && walletModel->getOptionsModel()) {
nDisplayUnit = walletModel->getOptionsModel()->getDisplayUnit();
if (currentBalance != -1)
setBalance(currentBalance, currentUnconfirmedBalance, currentImmatureBalance, currentAnonymizedBalance,
currentWatchOnlyBalance, currentWatchUnconfBalance, currentWatchImmatureBalance);
// Update txdelegate->unit with the current unit
txdelegate->unit = nDisplayUnit;
ui->listTransactions->update();
}
}
void OverviewPage::updateAlerts(const QString& warnings)
{
this->ui->labelAlerts->setVisible(!warnings.isEmpty());
this->ui->labelAlerts->setText(warnings);
}
void OverviewPage::showOutOfSyncWarning(bool fShow)
{
ui->labelWalletStatus->setVisible(fShow);
ui->labelObfuscationSyncStatus->setVisible(fShow);
ui->labelTransactionsStatus->setVisible(fShow);
}
void OverviewPage::updateObfuscationProgress()
{
if (!masternodeSync.IsBlockchainSynced() || ShutdownRequested()) return;
if (!pwalletMain) return;
QString strAmountAndRounds;
QString strAnonymizePivxAmount = BitcoinUnits::formatHtmlWithUnit(nDisplayUnit, nAnonymizePivxAmount * COIN, false, BitcoinUnits::separatorAlways);
if (currentBalance == 0) {
ui->obfuscationProgress->setValue(0);
ui->obfuscationProgress->setToolTip(tr("No inputs detected"));
// when balance is zero just show info from settings
strAnonymizePivxAmount = strAnonymizePivxAmount.remove(strAnonymizePivxAmount.indexOf("."), BitcoinUnits::decimals(nDisplayUnit) + 1);
strAmountAndRounds = strAnonymizePivxAmount + " / " + tr("%n Rounds", "", nObfuscationRounds);
ui->labelAmountRounds->setToolTip(tr("No inputs detected"));
ui->labelAmountRounds->setText(strAmountAndRounds);
return;
}
CAmount nDenominatedConfirmedBalance;
CAmount nDenominatedUnconfirmedBalance;
CAmount nAnonymizableBalance;
CAmount nNormalizedAnonymizedBalance;
double nAverageAnonymizedRounds;
{
TRY_LOCK(cs_main, lockMain);
if (!lockMain) return;
nDenominatedConfirmedBalance = pwalletMain->GetDenominatedBalance();
nDenominatedUnconfirmedBalance = pwalletMain->GetDenominatedBalance(true);
nAnonymizableBalance = pwalletMain->GetAnonymizableBalance();
nNormalizedAnonymizedBalance = pwalletMain->GetNormalizedAnonymizedBalance();
nAverageAnonymizedRounds = pwalletMain->GetAverageAnonymizedRounds();
}
CAmount nMaxToAnonymize = nAnonymizableBalance + currentAnonymizedBalance + nDenominatedUnconfirmedBalance;
// If it's more than the anon threshold, limit to that.
if (nMaxToAnonymize > nAnonymizePivxAmount * COIN) nMaxToAnonymize = nAnonymizePivxAmount * COIN;
if (nMaxToAnonymize == 0) return;
if (nMaxToAnonymize >= nAnonymizePivxAmount * COIN) {
ui->labelAmountRounds->setToolTip(tr("Found enough compatible inputs to anonymize %1")
.arg(strAnonymizePivxAmount));
strAnonymizePivxAmount = strAnonymizePivxAmount.remove(strAnonymizePivxAmount.indexOf("."), BitcoinUnits::decimals(nDisplayUnit) + 1);
strAmountAndRounds = strAnonymizePivxAmount + " / " + tr("%n Rounds", "", nObfuscationRounds);
} else {
QString strMaxToAnonymize = BitcoinUnits::formatHtmlWithUnit(nDisplayUnit, nMaxToAnonymize, false, BitcoinUnits::separatorAlways);
ui->labelAmountRounds->setToolTip(tr("Not enough compatible inputs to anonymize <span style='color:red;'>%1</span>,<br>"
"will anonymize <span style='color:red;'>%2</span> instead")
.arg(strAnonymizePivxAmount)
.arg(strMaxToAnonymize));
strMaxToAnonymize = strMaxToAnonymize.remove(strMaxToAnonymize.indexOf("."), BitcoinUnits::decimals(nDisplayUnit) + 1);
strAmountAndRounds = "<span style='color:red;'>" +
QString(BitcoinUnits::factor(nDisplayUnit) == 1 ? "" : "~") + strMaxToAnonymize +
" / " + tr("%n Rounds", "", nObfuscationRounds) + "</span>";
}
ui->labelAmountRounds->setText(strAmountAndRounds);
// calculate parts of the progress, each of them shouldn't be higher than 1
// progress of denominating
float denomPart = 0;
// mixing progress of denominated balance
float anonNormPart = 0;
// completeness of full amount anonimization
float anonFullPart = 0;
CAmount denominatedBalance = nDenominatedConfirmedBalance + nDenominatedUnconfirmedBalance;
denomPart = (float)denominatedBalance / nMaxToAnonymize;
denomPart = denomPart > 1 ? 1 : denomPart;
denomPart *= 100;
anonNormPart = (float)nNormalizedAnonymizedBalance / nMaxToAnonymize;
anonNormPart = anonNormPart > 1 ? 1 : anonNormPart;
anonNormPart *= 100;
anonFullPart = (float)currentAnonymizedBalance / nMaxToAnonymize;
anonFullPart = anonFullPart > 1 ? 1 : anonFullPart;
anonFullPart *= 100;
// apply some weights to them ...
float denomWeight = 1;
float anonNormWeight = nObfuscationRounds;
float anonFullWeight = 2;
float fullWeight = denomWeight + anonNormWeight + anonFullWeight;
// ... and calculate the whole progress
float denomPartCalc = ceilf((denomPart * denomWeight / fullWeight) * 100) / 100;
float anonNormPartCalc = ceilf((anonNormPart * anonNormWeight / fullWeight) * 100) / 100;
float anonFullPartCalc = ceilf((anonFullPart * anonFullWeight / fullWeight) * 100) / 100;
float progress = denomPartCalc + anonNormPartCalc + anonFullPartCalc;
if (progress >= 100) progress = 100;
ui->obfuscationProgress->setValue(progress);
QString strToolPip = ("<b>" + tr("Overall progress") + ": %1%</b><br/>" +
tr("Denominated") + ": %2%<br/>" +
tr("Mixed") + ": %3%<br/>" +
tr("Anonymized") + ": %4%<br/>" +
tr("Denominated inputs have %5 of %n rounds on average", "", nObfuscationRounds))
.arg(progress)
.arg(denomPart)
.arg(anonNormPart)
.arg(anonFullPart)
.arg(nAverageAnonymizedRounds);
ui->obfuscationProgress->setToolTip(strToolPip);
}
void OverviewPage::obfuScationStatus()
{
static int64_t nLastDSProgressBlockTime = 0;
int nBestHeight = chainActive.Tip()->nHeight;
// we we're processing more then 1 block per second, we'll just leave
if (((nBestHeight - obfuScationPool.cachedNumBlocks) / (GetTimeMillis() - nLastDSProgressBlockTime + 1) > 1)) return;
nLastDSProgressBlockTime = GetTimeMillis();
if (!fEnableObfuscation) {
if (nBestHeight != obfuScationPool.cachedNumBlocks) {
obfuScationPool.cachedNumBlocks = nBestHeight;
updateObfuscationProgress();
ui->obfuscationEnabled->setText(tr("Disabled"));
ui->obfuscationStatus->setText("");
ui->toggleObfuscation->setText(tr("Start Obfuscation"));
}
return;
}
// check obfuscation status and unlock if needed
if (nBestHeight != obfuScationPool.cachedNumBlocks) {
// Balance and number of transactions might have changed
obfuScationPool.cachedNumBlocks = nBestHeight;
updateObfuscationProgress();
ui->obfuscationEnabled->setText(tr("Enabled"));
}
QString strStatus = QString(obfuScationPool.GetStatus().c_str());
QString s = tr("Last Obfuscation message:\n") + strStatus;
if (s != ui->obfuscationStatus->text())
LogPrintf("Last Obfuscation message: %s\n", strStatus.toStdString());
ui->obfuscationStatus->setText(s);
if (obfuScationPool.sessionDenom == 0) {
ui->labelSubmittedDenom->setText(tr("N/A"));
} else {
std::string out;
obfuScationPool.GetDenominationsToString(obfuScationPool.sessionDenom, out);
QString s2(out.c_str());
ui->labelSubmittedDenom->setText(s2);
}
}
void OverviewPage::obfuscationAuto()
{
obfuScationPool.DoAutomaticDenominating();
}
void OverviewPage::obfuscationReset()
{
obfuScationPool.Reset();
QMessageBox::warning(this, tr("Obfuscation"),
tr("Obfuscation was successfully reset."),
QMessageBox::Ok, QMessageBox::Ok);
}
void OverviewPage::toggleObfuscation()
{
QSettings settings;
// Popup some information on first mixing
QString hasMixed = settings.value("hasMixed").toString();
if (hasMixed.isEmpty()) {
QMessageBox::information(this, tr("Obfuscation"),
tr("If you don't want to see internal Obfuscation fees/transactions select \"Most Common\" as Type on the \"Transactions\" tab."),
QMessageBox::Ok, QMessageBox::Ok);
settings.setValue("hasMixed", "hasMixed");
}
if (!fEnableObfuscation) {
int64_t balance = currentBalance;
float minAmount = 14.90 * COIN;
if (balance < minAmount) {
QString strMinAmount(BitcoinUnits::formatWithUnit(nDisplayUnit, minAmount));
QMessageBox::warning(this, tr("Obfuscation"),
tr("Obfuscation requires at least %1 to use.").arg(strMinAmount),
QMessageBox::Ok, QMessageBox::Ok);
return;
}
// if wallet is locked, ask for a passphrase
if (walletModel->getEncryptionStatus() == WalletModel::Locked) {
WalletModel::UnlockContext ctx(walletModel->requestUnlock(false));
if (!ctx.isValid()) {
//unlock was cancelled
obfuScationPool.cachedNumBlocks = std::numeric_limits<int>::max();
QMessageBox::warning(this, tr("Obfuscation"),
tr("Wallet is locked and user declined to unlock. Disabling Obfuscation."),
QMessageBox::Ok, QMessageBox::Ok);
if (fDebug) LogPrintf("Wallet is locked and user declined to unlock. Disabling Obfuscation.\n");
return;
}
}
}
fEnableObfuscation = !fEnableObfuscation;
obfuScationPool.cachedNumBlocks = std::numeric_limits<int>::max();
if (!fEnableObfuscation) {
ui->toggleObfuscation->setText(tr("Start Obfuscation"));
obfuScationPool.UnlockCoins();
} else {
ui->toggleObfuscation->setText(tr("Stop Obfuscation"));
/* show obfuscation configuration if client has defaults set */
if (nAnonymizePivxAmount == 0) {
ObfuscationConfig dlg(this);
dlg.setModel(walletModel);
dlg.exec();
}
}
}
| 48thct2jtnf/P | src/qt/overviewpage.cpp | C++ | mit | 23,169 |
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
public class RnaTranscriptionTest {
private RnaTranscription rnaTranscription;
@Before
public void setUp() {
rnaTranscription = new RnaTranscription();
}
@Test
public void testEmptyRnaSequence() {
assertThat(rnaTranscription.transcribe("")).isEmpty();
}
@Ignore("Remove to run test")
@Test
public void testRnaTranscriptionOfCytosineIsGuanine() {
assertThat(rnaTranscription.transcribe("C")).isEqualTo("G");
}
@Ignore("Remove to run test")
@Test
public void testRnaTranscriptionOfGuanineIsCytosine() {
assertThat(rnaTranscription.transcribe("G")).isEqualTo("C");
}
@Ignore("Remove to run test")
@Test
public void testRnaTranscriptionOfThymineIsAdenine() {
assertThat(rnaTranscription.transcribe("T")).isEqualTo("A");
}
@Ignore("Remove to run test")
@Test
public void testRnaTranscriptionOfAdenineIsUracil() {
assertThat(rnaTranscription.transcribe("A")).isEqualTo("U");
}
@Ignore("Remove to run test")
@Test
public void testRnaTranscription() {
assertThat(rnaTranscription.transcribe("ACGTGGTCTTAA")).isEqualTo("UGCACCAGAAUU");
}
}
| jmluy/xjava | exercises/practice/rna-transcription/src/test/java/RnaTranscriptionTest.java | Java | mit | 1,336 |
import Model from '../../model/model'
import Config from '../../config'
import { EmailAddress } from '../../model/email_addresses'
import { IMiddleware } from 'koa-router'
import { EmailOption, sendEmail } from '../email'
import { ResendLimitExeededError, InvalidEmailError } from '../../model/errors'
import emailVerificationTemplate from '../templates/verification_email_template'
export function sendVerificationEmail(model: Model, config: Config): IMiddleware {
return async (ctx, next) => {
const body: any = ctx.request.body
if (body == null || typeof body !== 'object') {
ctx.status = 400
return
}
let { emailLocal, emailDomain } = body
emailLocal = emailLocal.trim()
emailDomain = emailDomain.trim()
if (!emailLocal || !emailDomain) {
ctx.status = 400
return
}
if (emailDomain !== 'snu.ac.kr') {
ctx.status = 400
return
}
let emailIdx = -1
let token = ''
let resendCount = -1
try {
// create email address and generate token
await model.pgDo(async tr => {
emailIdx = await model.emailAddresses.create(tr, emailLocal, emailDomain)
const isValidated = await model.emailAddresses.isValidatedEmail(tr, emailIdx)
if (isValidated) {
throw new Error('already validated')
}
token = await model.emailAddresses.generateVerificationToken(tr, emailIdx)
resendCount = await model.emailAddresses.getResendCount(tr, token)
})
} catch (e) {
ctx.status = 400
return
}
try {
// send email
const option = {
address: `${emailLocal}@${emailDomain}`,
token,
subject: config.email.verificationEmailSubject,
url: config.email.verificationEmailUrl,
template: emailVerificationTemplate,
resendCount,
}
await sendEmail(option, model.log, config)
} catch (e) {
if (e instanceof ResendLimitExeededError || e instanceof InvalidEmailError) {
ctx.status = 400
return
}
model.log.warn(`sending email to ${emailLocal}@${emailDomain} just failed.`)
}
ctx.status = 200
await next()
}
}
export function checkVerificationEmailToken(model: Model): IMiddleware {
return async (ctx, next) => {
const body: any = ctx.request.body
if (body == null || typeof body !== 'object') {
ctx.status = 400
return
}
const { token } = body
let emailAddress: EmailAddress
let result
try {
await model.pgDo(async tr => {
emailAddress = await model.emailAddresses.getEmailAddressByToken(tr, token)
await model.emailAddresses.ensureTokenNotExpired(tr, token)
result = {
emailLocal: emailAddress.local,
emailDomain: emailAddress.domain,
}
})
} catch (e) {
ctx.status = 400
return
}
if (ctx.session) {
ctx.session.verificationToken = token
} else {
ctx.status = 500
return
}
ctx.status = 200
ctx.body = result
await next()
}
}
| bacchus-snu/id | core/src/api/handlers/emails.ts | TypeScript | mit | 3,079 |
const {BrowserWindow, ipcMain} = require('electron')
const CssInjector = require('../configuration/css-injector');
const path = require('path');
const isOnline = require('is-online');
class RadioController {
constructor() {
this.initSplash();
setTimeout(() => this.checkConnectionAndStart(), 500);
}
init() {
this.window = new BrowserWindow({
width: 1000,
height: 470,
show: false,
frame: true,
autoHideMenuBar: true,
webPreferences: {
plugins: true
},
});
this.window.on('close', (e) => {
if (this.window.isVisible()) {
e.preventDefault();
this.window.hide();
}
});
this.window.loadURL('http://www.xiami.com/radio');
this.window.webContents.on('dom-ready', () => {
this.window.webContents.insertCSS(CssInjector.radio);
this.show();
});
}
show() {
this.window.show();
this.window.focus();
}
initSplash() {
this.splashWin = new BrowserWindow({
width: 300,
height: 300,
frame: false,
autoHideMenuBar: true,
webPreferences: {
nodeIntegration: true
}
});
this.splashWin.loadURL(`file://${path.join(__dirname, '../view/splash.html')}`);
ipcMain.on('reconnect', () => {
this.checkConnectionAndStart();
});
}
checkConnectionAndStart() {
(async () => await isOnline({timeout: 15000}))().then(result => {
if (result) {
setTimeout(() => this.init(), 1000);
} else {
this.splashWin.webContents.send('connect-timeout');
}
});
}
}
module.exports = RadioController; | eNkru/electron-xiami | src/controller/radio-controller.js | JavaScript | mit | 1,628 |
#include "WorldGrid.h"
#include <folly/Format.h>
#include <folly/Singleton.h>
#include <iostream>
#include <string>
namespace fgm {
WorldTile::WorldTile(const grid_t x,
const grid_t y,
const TileType type,
size_t pixelsPerTileEdge)
: x_(x), y_(y), type_(type) {
const auto& texture =
folly::Singleton<TileTextureProvider>::try_get_fast()->getTileTexture(
type);
sprite_.setTexture(texture);
sprite_.setPosition(x * pixelsPerTileEdge, y * pixelsPerTileEdge);
}
WorldGrid::WorldGrid(const size_t widthInPixels,
const size_t heightInPixels,
const size_t pixelsPerTileEdge)
: pixelsPerTileEdge_(pixelsPerTileEdge) {
if (widthInPixels == 0 || heightInPixels == 0) {
throw std::runtime_error(
folly::format(
"Invalid grid dimensions. widthInPixels: {}, heightInPixels: {}",
widthInPixels,
heightInPixels)
.str());
}
// Initialize to passed dimensions
grid_t widthInTiles = widthInPixels / pixelsPerTileEdge_;
grid_t heightInTiles = heightInPixels / pixelsPerTileEdge_;
for (int y = 0; y < heightInTiles; y++) {
std::vector<WorldTile> row;
for (int x = 0; x < widthInTiles; x++) {
row.emplace_back(x, y, TileType::LAVA, pixelsPerTileEdge_);
}
grid_.push_back(std::move(row));
}
}
WorldTile& WorldGrid::get(const grid_t x, const grid_t y) {
if (x >= width() || y >= height()) {
throw std::runtime_error(
folly::format("Invalid coordinate request: x: {}, y: {}", x, y).str());
}
return grid_.at(y).at(x);
}
}
| suo/fgm | src/WorldGrid.cpp | C++ | mit | 1,657 |
<?php
namespace ClipBundle\Report;
use AppBundle\Report\AbstractReport;
use ClipBundle\Service\ContactmomentDaoInterface;
use ClipBundle\Service\VraagDaoInterface;
class VragenPerCommunicatiekanaal extends AbstractReport
{
protected $title = 'Vragen per contacttype';
protected $xPath = 'kolom';
protected $yPath = 'groep';
protected $nPath = 'aantal';
protected $xDescription = '';
protected $yDescription = 'Contacttype';
protected $tables = [];
/**
* @var VraagDaoInterface
*/
private $vraagDao;
/**
* @var ContactmomentDaoInterface
*/
private $contactmomentDao;
public function __construct(VraagDaoInterface $vraagDao, ContactmomentDaoInterface $contactmomentDao)
{
$this->vraagDao = $vraagDao;
$this->contactmomentDao = $contactmomentDao;
}
protected function init()
{
$vragen = $this->vraagDao->countByCommunicatiekanaal($this->startDate, $this->endDate);
array_walk($vragen, function (&$item) {
$item['kolom'] = 'Vragen';
});
$contactmomenten = $this->contactmomentDao->countByCommunicatiekanaal($this->startDate, $this->endDate);
array_walk($contactmomenten, function (&$item) {
$item['kolom'] = 'Contactmomenten';
});
$this->tables[''] = array_merge($vragen, $contactmomenten);
}
}
| deregenboog/ecd | src/ClipBundle/Report/VragenPerCommunicatiekanaal.php | PHP | mit | 1,390 |
var multilevel = require('multilevel');
var net = require('net');
var db = multilevel.client();
var connection = net.connect(4545);
connection.pipe(db.createRpcStream()).pipe(connection);
db.get('multilevelmeup', function(err, item) {
if(err) throw err;
console.log(item);
connection.end();
}); | zburgermeiszter/nodeschool.io | level-me-up/12_multilevel/program.js | JavaScript | mit | 307 |
import math
import theano.tensor as T
# ----------------------------------------------------------------------------
# this is all taken from the parmesan lib
c = - 0.5 * math.log(2*math.pi)
def log_bernoulli(x, p, eps=1e-5):
"""
Compute log pdf of a Bernoulli distribution with success probability p, at values x.
.. math:: \log p(x; p) = \log \mathcal{B}(x; p)
Parameters
----------
x : Theano tensor
Values at which to evaluate pdf.
p : Theano tensor
Success probability :math:`p(x=1)`, which is also the mean of the Bernoulli distribution.
eps : float
Small number used to avoid NaNs by clipping p in range [eps;1-eps].
Returns
-------
Theano tensor
Element-wise log probability, this has to be summed for multi-variate distributions.
"""
p = T.clip(p, eps, 1.0 - eps)
return -T.nnet.binary_crossentropy(p, x)
def log_normal(x, mean, std, eps=1e-5):
"""
Compute log pdf of a Gaussian distribution with diagonal covariance, at values x.
Variance is parameterized as standard deviation.
.. math:: \log p(x) = \log \mathcal{N}(x; \mu, \sigma^2I)
Parameters
----------
x : Theano tensor
Values at which to evaluate pdf.
mean : Theano tensor
Mean of the Gaussian distribution.
std : Theano tensor
Standard deviation of the diagonal covariance Gaussian.
eps : float
Small number added to standard deviation to avoid NaNs.
Returns
-------
Theano tensor
Element-wise log probability, this has to be summed for multi-variate distributions.
See also
--------
log_normal1 : using variance parameterization
log_normal2 : using log variance parameterization
"""
abs_std = T.abs_(std) + eps
return c - T.log(abs_std) - (x - mean)**2 / (2 * abs_std**2)
def log_normal2(x, mean, log_var, eps=1e-5):
"""
Compute log pdf of a Gaussian distribution with diagonal covariance, at values x.
Variance is parameterized as log variance rather than standard deviation, which ensures :math:`\sigma > 0`.
.. math:: \log p(x) = \log \mathcal{N}(x; \mu, \sigma^2I)
Parameters
----------
x : Theano tensor
Values at which to evaluate pdf.
mean : Theano tensor
Mean of the Gaussian distribution.
log_var : Theano tensor
Log variance of the diagonal covariance Gaussian.
eps : float
Small number added to denominator to avoid NaNs.
Returns
-------
Theano tensor
Element-wise log probability, this has to be summed for multi-variate distributions.
See also
--------
log_normal : using standard deviation parameterization
log_normal1 : using variance parameterization
"""
return c - log_var/2 - (x - mean)**2 / (2 * T.exp(log_var) + eps) | kuleshov/deep-learning-models | models/distributions/distributions.py | Python | mit | 2,861 |
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _debounce = require('debounce');
var _debounce2 = _interopRequireDefault(_debounce);
var _reactThemeable = require('react-themeable');
var _reactThemeable2 = _interopRequireDefault(_reactThemeable);
var _sectionIterator = require('./sectionIterator');
var _sectionIterator2 = _interopRequireDefault(_sectionIterator);
var Autosuggest = (function (_Component) {
_inherits(Autosuggest, _Component);
_createClass(Autosuggest, null, [{
key: 'propTypes',
value: {
value: _react.PropTypes.string, // Controlled value of the selected suggestion
defaultValue: _react.PropTypes.string, // Initial value of the text
suggestions: _react.PropTypes.func.isRequired, // Function to get the suggestions
suggestionRenderer: _react.PropTypes.func, // Function that renders a given suggestion (must be implemented when suggestions are objects)
suggestionValue: _react.PropTypes.func, // Function that maps suggestion object to input value (must be implemented when suggestions are objects)
showWhen: _react.PropTypes.func, // Function that determines whether to show suggestions or not
onSuggestionSelected: _react.PropTypes.func, // This function is called when suggestion is selected via mouse click or Enter
onSuggestionFocused: _react.PropTypes.func, // This function is called when suggestion is focused via mouse hover or Up/Down keys
onSuggestionUnfocused: _react.PropTypes.func, // This function is called when suggestion is unfocused via mouse hover or Up/Down keys
inputAttributes: _react.PropTypes.object, // Attributes to pass to the input field (e.g. { id: 'my-input', className: 'sweet autosuggest' })
cache: _react.PropTypes.bool, // Set it to false to disable in-memory caching
id: _react.PropTypes.string, // Used in aria-* attributes. If multiple Autosuggest's are rendered on a page, they must have unique ids.
scrollBar: _react.PropTypes.bool, // Set it to true when the suggestions container can have a scroll bar
theme: _react.PropTypes.object // Custom theme. See: https://github.com/markdalgleish/react-themeable
},
enumerable: true
}, {
key: 'defaultProps',
value: {
showWhen: function showWhen(input) {
return input.trim().length > 0;
},
onSuggestionSelected: function onSuggestionSelected() {},
onSuggestionFocused: function onSuggestionFocused() {},
onSuggestionUnfocused: function onSuggestionUnfocused() {},
inputAttributes: {},
cache: true,
id: '1',
scrollBar: false,
theme: {
root: 'react-autosuggest',
suggestions: 'react-autosuggest__suggestions',
suggestion: 'react-autosuggest__suggestion',
suggestionIsFocused: 'react-autosuggest__suggestion--focused',
section: 'react-autosuggest__suggestions-section',
sectionName: 'react-autosuggest__suggestions-section-name',
sectionSuggestions: 'react-autosuggest__suggestions-section-suggestions'
}
},
enumerable: true
}]);
function Autosuggest(props) {
_classCallCheck(this, Autosuggest);
_get(Object.getPrototypeOf(Autosuggest.prototype), 'constructor', this).call(this);
this.cache = {};
this.state = {
value: props.value || props.defaultValue || '',
suggestions: null,
focusedSectionIndex: null, // Used when multiple sections are displayed
focusedSuggestionIndex: null, // Index within a section
valueBeforeUpDown: null // When user interacts using the Up and Down keys,
// this field remembers input's value prior to
// interaction in order to revert back if ESC hit.
// See: http://www.w3.org/TR/wai-aria-practices/#autocomplete
};
this.isControlledComponent = typeof props.value !== 'undefined';
this.suggestionsFn = (0, _debounce2['default'])(props.suggestions, 100);
this.onChange = props.inputAttributes.onChange || function () {};
this.onFocus = props.inputAttributes.onFocus || function () {};
this.onBlur = props.inputAttributes.onBlur || function () {};
this.lastSuggestionsInputValue = null; // Helps to deal with delayed requests
this.justUnfocused = false; // Helps to avoid calling onSuggestionUnfocused
// twice when mouse is moving between suggestions
this.justClickedOnSuggestion = false; // Helps not to call inputAttributes.onBlur
// and showSuggestions() when suggestion is clicked.
// Also helps not to call handleValueChange() in
// componentWillReceiveProps() when suggestion is clicked.
this.justPressedUpDown = false; // Helps not to call handleValueChange() in
// componentWillReceiveProps() when Up or Down is pressed.
this.justPressedEsc = false; // Helps not to call handleValueChange() in
// componentWillReceiveProps() when ESC is pressed.
this.onInputChange = this.onInputChange.bind(this);
this.onInputKeyDown = this.onInputKeyDown.bind(this);
this.onInputFocus = this.onInputFocus.bind(this);
this.onInputBlur = this.onInputBlur.bind(this);
}
_createClass(Autosuggest, [{
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(nextProps) {
if (this.isControlledComponent) {
var inputValue = this.refs.input.value;
if (nextProps.value !== inputValue && !this.justClickedOnSuggestion && !this.justPressedUpDown && !this.justPressedEsc) {
this.handleValueChange(nextProps.value);
}
}
}
}, {
key: 'resetSectionIterator',
value: function resetSectionIterator(suggestions) {
if (this.isMultipleSections(suggestions)) {
_sectionIterator2['default'].setData(suggestions.map(function (suggestion) {
return suggestion.suggestions.length;
}));
} else {
_sectionIterator2['default'].setData(suggestions === null ? [] : suggestions.length);
}
}
}, {
key: 'isMultipleSections',
value: function isMultipleSections(suggestions) {
return suggestions !== null && suggestions.length > 0 && typeof suggestions[0].suggestions !== 'undefined';
}
}, {
key: 'setSuggestionsState',
value: function setSuggestionsState(suggestions) {
this.resetSectionIterator(suggestions);
this.setState({
suggestions: suggestions,
focusedSectionIndex: null,
focusedSuggestionIndex: null,
valueBeforeUpDown: null
});
}
}, {
key: 'suggestionsExist',
value: function suggestionsExist(suggestions) {
if (this.isMultipleSections(suggestions)) {
return suggestions.some(function (section) {
return section.suggestions.length > 0;
});
}
return suggestions !== null && suggestions.length > 0;
}
}, {
key: 'showSuggestions',
value: function showSuggestions(input) {
var _this = this;
var cacheKey = input.toLowerCase();
this.lastSuggestionsInputValue = input;
if (!this.props.showWhen(input)) {
this.setSuggestionsState(null);
} else if (this.props.cache && this.cache[cacheKey]) {
this.setSuggestionsState(this.cache[cacheKey]);
} else {
this.suggestionsFn(input, function (error, suggestions) {
// If input value changed, suggestions are not relevant anymore.
if (_this.lastSuggestionsInputValue !== input) {
return;
}
if (error) {
throw error;
} else {
if (!_this.suggestionsExist(suggestions)) {
suggestions = null;
}
if (_this.props.cache) {
_this.cache[cacheKey] = suggestions;
}
_this.setSuggestionsState(suggestions);
}
});
}
}
}, {
key: 'suggestionIsFocused',
value: function suggestionIsFocused() {
return this.state.focusedSuggestionIndex !== null;
}
}, {
key: 'getSuggestion',
value: function getSuggestion(sectionIndex, suggestionIndex) {
if (this.isMultipleSections(this.state.suggestions)) {
return this.state.suggestions[sectionIndex].suggestions[suggestionIndex];
}
return this.state.suggestions[suggestionIndex];
}
}, {
key: 'getFocusedSuggestion',
value: function getFocusedSuggestion() {
if (this.suggestionIsFocused()) {
return this.getSuggestion(this.state.focusedSectionIndex, this.state.focusedSuggestionIndex);
}
return null;
}
}, {
key: 'getSuggestionValue',
value: function getSuggestionValue(sectionIndex, suggestionIndex) {
var suggestion = this.getSuggestion(sectionIndex, suggestionIndex);
if (typeof suggestion === 'object') {
if (this.props.suggestionValue) {
return this.props.suggestionValue(suggestion);
}
throw new Error('When <suggestion> is an object, you must implement the suggestionValue() function to specify how to set input\'s value when suggestion selected.');
} else {
return suggestion.toString();
}
}
}, {
key: 'onSuggestionUnfocused',
value: function onSuggestionUnfocused() {
var focusedSuggestion = this.getFocusedSuggestion();
if (focusedSuggestion !== null && !this.justUnfocused) {
this.props.onSuggestionUnfocused(focusedSuggestion);
this.justUnfocused = true;
}
}
}, {
key: 'onSuggestionFocused',
value: function onSuggestionFocused(sectionIndex, suggestionIndex) {
this.onSuggestionUnfocused();
var suggestion = this.getSuggestion(sectionIndex, suggestionIndex);
this.props.onSuggestionFocused(suggestion);
this.justUnfocused = false;
}
}, {
key: 'scrollToElement',
value: function scrollToElement(container, element, alignTo) {
if (alignTo === 'bottom') {
var scrollDelta = element.offsetTop + element.offsetHeight - container.scrollTop - container.offsetHeight;
if (scrollDelta > 0) {
container.scrollTop += scrollDelta;
}
} else {
var scrollDelta = container.scrollTop - element.offsetTop;
if (scrollDelta > 0) {
container.scrollTop -= scrollDelta;
}
}
}
}, {
key: 'scrollToSuggestion',
value: function scrollToSuggestion(direction, sectionIndex, suggestionIndex) {
var alignTo = direction === 'down' ? 'bottom' : 'top';
if (suggestionIndex === null) {
if (direction === 'down') {
alignTo = 'top';
var _sectionIterator$next = _sectionIterator2['default'].next([null, null]);
var _sectionIterator$next2 = _slicedToArray(_sectionIterator$next, 2);
sectionIndex = _sectionIterator$next2[0];
suggestionIndex = _sectionIterator$next2[1];
} else {
return;
}
} else {
if (_sectionIterator2['default'].isLast([sectionIndex, suggestionIndex]) && direction === 'up') {
alignTo = 'bottom';
}
}
var suggestions = this.refs.suggestions;
var suggestionRef = this.getSuggestionRef(sectionIndex, suggestionIndex);
var suggestion = this.refs[suggestionRef];
this.scrollToElement(suggestions, suggestion, alignTo);
}
}, {
key: 'focusOnSuggestionUsingKeyboard',
value: function focusOnSuggestionUsingKeyboard(direction, suggestionPosition) {
var _this2 = this;
var _suggestionPosition = _slicedToArray(suggestionPosition, 2);
var sectionIndex = _suggestionPosition[0];
var suggestionIndex = _suggestionPosition[1];
var newState = {
focusedSectionIndex: sectionIndex,
focusedSuggestionIndex: suggestionIndex,
value: suggestionIndex === null ? this.state.valueBeforeUpDown : this.getSuggestionValue(sectionIndex, suggestionIndex)
};
this.justPressedUpDown = true;
// When users starts to interact with Up/Down keys, remember input's value.
if (this.state.valueBeforeUpDown === null) {
newState.valueBeforeUpDown = this.state.value;
}
if (suggestionIndex === null) {
this.onSuggestionUnfocused();
} else {
this.onSuggestionFocused(sectionIndex, suggestionIndex);
}
if (this.props.scrollBar) {
this.scrollToSuggestion(direction, sectionIndex, suggestionIndex);
}
if (newState.value !== this.state.value) {
this.onChange(newState.value);
}
this.setState(newState);
setTimeout(function () {
return _this2.justPressedUpDown = false;
});
}
}, {
key: 'onSuggestionSelected',
value: function onSuggestionSelected(event) {
var focusedSuggestion = this.getFocusedSuggestion();
this.props.onSuggestionUnfocused(focusedSuggestion);
this.props.onSuggestionSelected(focusedSuggestion, event);
}
}, {
key: 'onInputChange',
value: function onInputChange(event) {
var newValue = event.target.value;
this.onSuggestionUnfocused();
this.handleValueChange(newValue);
this.showSuggestions(newValue);
}
}, {
key: 'handleValueChange',
value: function handleValueChange(newValue) {
if (newValue !== this.state.value) {
this.onChange(newValue);
this.setState({
value: newValue
});
}
}
}, {
key: 'onInputKeyDown',
value: function onInputKeyDown(event) {
var _this3 = this;
var newState = undefined;
switch (event.keyCode) {
case 13:
// Enter
if (this.state.valueBeforeUpDown !== null && this.suggestionIsFocused()) {
this.onSuggestionSelected(event);
this.setSuggestionsState(null);
}
break;
case 27:
// ESC
newState = {
suggestions: null,
focusedSectionIndex: null,
focusedSuggestionIndex: null,
valueBeforeUpDown: null
};
if (this.state.valueBeforeUpDown !== null) {
newState.value = this.state.valueBeforeUpDown;
} else if (this.state.suggestions === null) {
newState.value = '';
}
this.onSuggestionUnfocused();
this.justPressedEsc = true;
if (typeof newState.value === 'string' && newState.value !== this.state.value) {
this.onChange(newState.value);
}
this.setState(newState);
setTimeout(function () {
return _this3.justPressedEsc = false;
});
break;
case 38:
// Up
if (this.state.suggestions === null) {
this.showSuggestions(this.state.value);
} else {
this.focusOnSuggestionUsingKeyboard('up', _sectionIterator2['default'].prev([this.state.focusedSectionIndex, this.state.focusedSuggestionIndex]));
}
event.preventDefault(); // Prevent the cursor from jumping to input's start
break;
case 40:
// Down
if (this.state.suggestions === null) {
this.showSuggestions(this.state.value);
} else {
this.focusOnSuggestionUsingKeyboard('down', _sectionIterator2['default'].next([this.state.focusedSectionIndex, this.state.focusedSuggestionIndex]));
}
break;
}
}
}, {
key: 'onInputFocus',
value: function onInputFocus(event) {
if (!this.justClickedOnSuggestion) {
this.showSuggestions(this.state.value);
}
this.onFocus(event);
}
}, {
key: 'onInputBlur',
value: function onInputBlur(event) {
this.onSuggestionUnfocused();
if (!this.justClickedOnSuggestion) {
this.onBlur(event);
}
this.setSuggestionsState(null);
}
}, {
key: 'isSuggestionFocused',
value: function isSuggestionFocused(sectionIndex, suggestionIndex) {
return sectionIndex === this.state.focusedSectionIndex && suggestionIndex === this.state.focusedSuggestionIndex;
}
}, {
key: 'onSuggestionMouseEnter',
value: function onSuggestionMouseEnter(sectionIndex, suggestionIndex) {
if (!this.isSuggestionFocused(sectionIndex, suggestionIndex)) {
this.onSuggestionFocused(sectionIndex, suggestionIndex);
}
this.setState({
focusedSectionIndex: sectionIndex,
focusedSuggestionIndex: suggestionIndex
});
}
}, {
key: 'onSuggestionMouseLeave',
value: function onSuggestionMouseLeave(sectionIndex, suggestionIndex) {
if (this.isSuggestionFocused(sectionIndex, suggestionIndex)) {
this.onSuggestionUnfocused();
}
this.setState({
focusedSectionIndex: null,
focusedSuggestionIndex: null
});
}
}, {
key: 'onSuggestionMouseDown',
value: function onSuggestionMouseDown(sectionIndex, suggestionIndex, event) {
var _this4 = this;
var suggestionValue = this.getSuggestionValue(sectionIndex, suggestionIndex);
this.justClickedOnSuggestion = true;
this.onSuggestionSelected(event);
if (suggestionValue !== this.state.value) {
this.onChange(suggestionValue);
}
this.setState({
value: suggestionValue,
suggestions: null,
focusedSectionIndex: null,
focusedSuggestionIndex: null,
valueBeforeUpDown: null
}, function () {
// This code executes after the component is re-rendered
setTimeout(function () {
_this4.refs.input.focus();
_this4.justClickedOnSuggestion = false;
});
});
}
}, {
key: 'getSuggestionId',
value: function getSuggestionId(sectionIndex, suggestionIndex) {
if (suggestionIndex === null) {
return null;
}
return 'react-autosuggest-' + this.props.id + '-' + this.getSuggestionRef(sectionIndex, suggestionIndex);
}
}, {
key: 'getSuggestionRef',
value: function getSuggestionRef(sectionIndex, suggestionIndex) {
return 'suggestion-' + (sectionIndex === null ? '' : sectionIndex) + '-' + suggestionIndex;
}
}, {
key: 'renderSuggestionContent',
value: function renderSuggestionContent(suggestion) {
if (this.props.suggestionRenderer) {
return this.props.suggestionRenderer(suggestion, this.state.valueBeforeUpDown || this.state.value);
}
if (typeof suggestion === 'object') {
throw new Error('When <suggestion> is an object, you must implement the suggestionRenderer() function to specify how to render it.');
} else {
return suggestion.toString();
}
}
}, {
key: 'renderSuggestionsList',
value: function renderSuggestionsList(theme, suggestions, sectionIndex) {
var _this5 = this;
return suggestions.map(function (suggestion, suggestionIndex) {
var styles = theme(suggestionIndex, 'suggestion', sectionIndex === _this5.state.focusedSectionIndex && suggestionIndex === _this5.state.focusedSuggestionIndex && 'suggestionIsFocused');
var suggestionRef = _this5.getSuggestionRef(sectionIndex, suggestionIndex);
return _react2['default'].createElement(
'li',
_extends({ id: _this5.getSuggestionId(sectionIndex, suggestionIndex)
}, styles, {
role: 'option',
ref: suggestionRef,
key: suggestionRef,
onMouseEnter: function () {
return _this5.onSuggestionMouseEnter(sectionIndex, suggestionIndex);
},
onMouseLeave: function () {
return _this5.onSuggestionMouseLeave(sectionIndex, suggestionIndex);
},
onMouseDown: function (event) {
return _this5.onSuggestionMouseDown(sectionIndex, suggestionIndex, event);
} }),
_this5.renderSuggestionContent(suggestion)
);
});
}
}, {
key: 'renderSuggestions',
value: function renderSuggestions(theme) {
var _this6 = this;
if (this.state.suggestions === null) {
return null;
}
if (this.isMultipleSections(this.state.suggestions)) {
return _react2['default'].createElement(
'div',
_extends({ id: 'react-autosuggest-' + this.props.id
}, theme('suggestions', 'suggestions'), {
ref: 'suggestions',
role: 'listbox' }),
this.state.suggestions.map(function (section, sectionIndex) {
var sectionName = section.sectionName ? _react2['default'].createElement(
'div',
theme('sectionName-' + sectionIndex, 'sectionName'),
section.sectionName
) : null;
return section.suggestions.length === 0 ? null : _react2['default'].createElement(
'div',
_extends({}, theme('section-' + sectionIndex, 'section'), {
key: 'section-' + sectionIndex }),
sectionName,
_react2['default'].createElement(
'ul',
theme('sectionSuggestions-' + sectionIndex, 'sectionSuggestions'),
_this6.renderSuggestionsList(theme, section.suggestions, sectionIndex)
)
);
})
);
}
return _react2['default'].createElement(
'ul',
_extends({ id: 'react-autosuggest-' + this.props.id
}, theme('suggestions', 'suggestions'), {
ref: 'suggestions',
role: 'listbox' }),
this.renderSuggestionsList(theme, this.state.suggestions, null)
);
}
}, {
key: 'render',
value: function render() {
var _props = this.props;
var id = _props.id;
var inputAttributes = _props.inputAttributes;
var _state = this.state;
var value = _state.value;
var suggestions = _state.suggestions;
var focusedSectionIndex = _state.focusedSectionIndex;
var focusedSuggestionIndex = _state.focusedSuggestionIndex;
var theme = (0, _reactThemeable2['default'])(this.props.theme);
var ariaActivedescendant = this.getSuggestionId(focusedSectionIndex, focusedSuggestionIndex);
return _react2['default'].createElement(
'div',
theme('root', 'root'),
_react2['default'].createElement('input', _extends({}, inputAttributes, {
type: inputAttributes.type || 'text',
value: value,
autoComplete: 'off',
role: 'combobox',
'aria-autocomplete': 'list',
'aria-owns': 'react-autosuggest-' + id,
'aria-expanded': suggestions !== null,
'aria-activedescendant': ariaActivedescendant,
ref: 'input',
onChange: this.onInputChange,
onKeyDown: this.onInputKeyDown,
onFocus: this.onInputFocus,
onBlur: this.onInputBlur })),
this.renderSuggestions(theme)
);
}
}]);
return Autosuggest;
})(_react.Component);
exports['default'] = Autosuggest;
module.exports = exports['default'];
},{"./sectionIterator":2,"debounce":3,"react":163,"react-themeable":5}],2:[function(require,module,exports){
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();
var data = undefined,
multipleSections = undefined;
function setData(newData) {
data = newData;
multipleSections = typeof data === 'object';
}
function nextNonEmptySectionIndex(sectionIndex) {
if (sectionIndex === null) {
sectionIndex = 0;
} else {
sectionIndex++;
}
while (sectionIndex < data.length && data[sectionIndex] === 0) {
sectionIndex++;
}
return sectionIndex === data.length ? null : sectionIndex;
}
function prevNonEmptySectionIndex(sectionIndex) {
if (sectionIndex === null) {
sectionIndex = data.length - 1;
} else {
sectionIndex--;
}
while (sectionIndex >= 0 && data[sectionIndex] === 0) {
sectionIndex--;
}
return sectionIndex === -1 ? null : sectionIndex;
}
function next(position) {
var _position = _slicedToArray(position, 2);
var sectionIndex = _position[0];
var itemIndex = _position[1];
if (multipleSections) {
if (itemIndex === null || itemIndex === data[sectionIndex] - 1) {
sectionIndex = nextNonEmptySectionIndex(sectionIndex);
if (sectionIndex === null) {
return [null, null];
}
return [sectionIndex, 0];
}
return [sectionIndex, itemIndex + 1];
}
if (data === 0 || itemIndex === data - 1) {
return [null, null];
}
if (itemIndex === null) {
return [null, 0];
}
return [null, itemIndex + 1];
}
function prev(position) {
var _position2 = _slicedToArray(position, 2);
var sectionIndex = _position2[0];
var itemIndex = _position2[1];
if (multipleSections) {
if (itemIndex === null || itemIndex === 0) {
sectionIndex = prevNonEmptySectionIndex(sectionIndex);
if (sectionIndex === null) {
return [null, null];
}
return [sectionIndex, data[sectionIndex] - 1];
}
return [sectionIndex, itemIndex - 1];
}
if (data === 0 || itemIndex === 0) {
return [null, null];
}
if (itemIndex === null) {
return [null, data - 1];
}
return [null, itemIndex - 1];
}
function isLast(position) {
return next(position)[1] === null;
}
exports['default'] = {
setData: setData,
next: next,
prev: prev,
isLast: isLast
};
module.exports = exports['default'];
},{}],3:[function(require,module,exports){
/**
* Module dependencies.
*/
var now = require('date-now');
/**
* Returns a function, that, as long as it continues to be invoked, will not
* be triggered. The function will be called after it stops being called for
* N milliseconds. If `immediate` is passed, trigger the function on the
* leading edge, instead of the trailing.
*
* @source underscore.js
* @see http://unscriptable.com/2009/03/20/debouncing-javascript-methods/
* @param {Function} function to wrap
* @param {Number} timeout in ms (`100`)
* @param {Boolean} whether to execute at the beginning (`false`)
* @api public
*/
module.exports = function debounce(func, wait, immediate){
var timeout, args, context, timestamp, result;
if (null == wait) wait = 100;
function later() {
var last = now() - timestamp;
if (last < wait && last > 0) {
timeout = setTimeout(later, wait - last);
} else {
timeout = null;
if (!immediate) {
result = func.apply(context, args);
if (!timeout) context = args = null;
}
}
};
return function debounced() {
context = this;
args = arguments;
timestamp = now();
var callNow = immediate && !timeout;
if (!timeout) timeout = setTimeout(later, wait);
if (callNow) {
result = func.apply(context, args);
context = args = null;
}
return result;
};
};
},{"date-now":4}],4:[function(require,module,exports){
module.exports = Date.now || now
function now() {
return new Date().getTime()
}
},{}],5:[function(require,module,exports){
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } }
var _objectAssign = require('object-assign');
var _objectAssign2 = _interopRequireDefault(_objectAssign);
var truthy = function truthy(x) {
return x;
};
exports['default'] = function (theme) {
return function (key) {
for (var _len = arguments.length, names = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
names[_key - 1] = arguments[_key];
}
var styles = names.map(function (name) {
return theme[name];
}).filter(truthy);
return typeof styles[0] === 'string' ? { key: key, className: styles.join(' ') } : { key: key, style: _objectAssign2['default'].apply(undefined, [{}].concat(_toConsumableArray(styles))) };
};
};
module.exports = exports['default'];
},{"object-assign":6}],6:[function(require,module,exports){
'use strict';
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
function ToObject(val) {
if (val == null) {
throw new TypeError('Object.assign cannot be called with null or undefined');
}
return Object(val);
}
function ownEnumerableKeys(obj) {
var keys = Object.getOwnPropertyNames(obj);
if (Object.getOwnPropertySymbols) {
keys = keys.concat(Object.getOwnPropertySymbols(obj));
}
return keys.filter(function (key) {
return propIsEnumerable.call(obj, key);
});
}
module.exports = Object.assign || function (target, source) {
var from;
var keys;
var to = ToObject(target);
for (var s = 1; s < arguments.length; s++) {
from = arguments[s];
keys = ownEnumerableKeys(Object(from));
for (var i = 0; i < keys.length; i++) {
to[keys[i]] = from[keys[i]];
}
}
return to;
};
},{}],7:[function(require,module,exports){
'use strict';
module.exports = require('react/lib/ReactDOM');
},{"react/lib/ReactDOM":42}],8:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule AutoFocusUtils
* @typechecks static-only
*/
'use strict';
var ReactMount = require('./ReactMount');
var findDOMNode = require('./findDOMNode');
var focusNode = require('fbjs/lib/focusNode');
var Mixin = {
componentDidMount: function () {
if (this.props.autoFocus) {
focusNode(findDOMNode(this));
}
}
};
var AutoFocusUtils = {
Mixin: Mixin,
focusDOMComponent: function () {
focusNode(ReactMount.getNode(this._rootNodeID));
}
};
module.exports = AutoFocusUtils;
},{"./ReactMount":72,"./findDOMNode":115,"fbjs/lib/focusNode":145}],9:[function(require,module,exports){
/**
* Copyright 2013-2015 Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule BeforeInputEventPlugin
* @typechecks static-only
*/
'use strict';
var EventConstants = require('./EventConstants');
var EventPropagators = require('./EventPropagators');
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
var FallbackCompositionState = require('./FallbackCompositionState');
var SyntheticCompositionEvent = require('./SyntheticCompositionEvent');
var SyntheticInputEvent = require('./SyntheticInputEvent');
var keyOf = require('fbjs/lib/keyOf');
var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
var START_KEYCODE = 229;
var canUseCompositionEvent = ExecutionEnvironment.canUseDOM && 'CompositionEvent' in window;
var documentMode = null;
if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) {
documentMode = document.documentMode;
}
// Webkit offers a very useful `textInput` event that can be used to
// directly represent `beforeInput`. The IE `textinput` event is not as
// useful, so we don't use it.
var canUseTextInputEvent = ExecutionEnvironment.canUseDOM && 'TextEvent' in window && !documentMode && !isPresto();
// In IE9+, we have access to composition events, but the data supplied
// by the native compositionend event may be incorrect. Japanese ideographic
// spaces, for instance (\u3000) are not recorded correctly.
var useFallbackCompositionData = ExecutionEnvironment.canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11);
/**
* Opera <= 12 includes TextEvent in window, but does not fire
* text input events. Rely on keypress instead.
*/
function isPresto() {
var opera = window.opera;
return typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12;
}
var SPACEBAR_CODE = 32;
var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE);
var topLevelTypes = EventConstants.topLevelTypes;
// Events and their corresponding property names.
var eventTypes = {
beforeInput: {
phasedRegistrationNames: {
bubbled: keyOf({ onBeforeInput: null }),
captured: keyOf({ onBeforeInputCapture: null })
},
dependencies: [topLevelTypes.topCompositionEnd, topLevelTypes.topKeyPress, topLevelTypes.topTextInput, topLevelTypes.topPaste]
},
compositionEnd: {
phasedRegistrationNames: {
bubbled: keyOf({ onCompositionEnd: null }),
captured: keyOf({ onCompositionEndCapture: null })
},
dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionEnd, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
},
compositionStart: {
phasedRegistrationNames: {
bubbled: keyOf({ onCompositionStart: null }),
captured: keyOf({ onCompositionStartCapture: null })
},
dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionStart, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
},
compositionUpdate: {
phasedRegistrationNames: {
bubbled: keyOf({ onCompositionUpdate: null }),
captured: keyOf({ onCompositionUpdateCapture: null })
},
dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionUpdate, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
}
};
// Track whether we've ever handled a keypress on the space key.
var hasSpaceKeypress = false;
/**
* Return whether a native keypress event is assumed to be a command.
* This is required because Firefox fires `keypress` events for key commands
* (cut, copy, select-all, etc.) even though no character is inserted.
*/
function isKeypressCommand(nativeEvent) {
return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
// ctrlKey && altKey is equivalent to AltGr, and is not a command.
!(nativeEvent.ctrlKey && nativeEvent.altKey);
}
/**
* Translate native top level events into event types.
*
* @param {string} topLevelType
* @return {object}
*/
function getCompositionEventType(topLevelType) {
switch (topLevelType) {
case topLevelTypes.topCompositionStart:
return eventTypes.compositionStart;
case topLevelTypes.topCompositionEnd:
return eventTypes.compositionEnd;
case topLevelTypes.topCompositionUpdate:
return eventTypes.compositionUpdate;
}
}
/**
* Does our fallback best-guess model think this event signifies that
* composition has begun?
*
* @param {string} topLevelType
* @param {object} nativeEvent
* @return {boolean}
*/
function isFallbackCompositionStart(topLevelType, nativeEvent) {
return topLevelType === topLevelTypes.topKeyDown && nativeEvent.keyCode === START_KEYCODE;
}
/**
* Does our fallback mode think that this event is the end of composition?
*
* @param {string} topLevelType
* @param {object} nativeEvent
* @return {boolean}
*/
function isFallbackCompositionEnd(topLevelType, nativeEvent) {
switch (topLevelType) {
case topLevelTypes.topKeyUp:
// Command keys insert or clear IME input.
return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1;
case topLevelTypes.topKeyDown:
// Expect IME keyCode on each keydown. If we get any other
// code we must have exited earlier.
return nativeEvent.keyCode !== START_KEYCODE;
case topLevelTypes.topKeyPress:
case topLevelTypes.topMouseDown:
case topLevelTypes.topBlur:
// Events are not possible without cancelling IME.
return true;
default:
return false;
}
}
/**
* Google Input Tools provides composition data via a CustomEvent,
* with the `data` property populated in the `detail` object. If this
* is available on the event object, use it. If not, this is a plain
* composition event and we have nothing special to extract.
*
* @param {object} nativeEvent
* @return {?string}
*/
function getDataFromCustomEvent(nativeEvent) {
var detail = nativeEvent.detail;
if (typeof detail === 'object' && 'data' in detail) {
return detail.data;
}
return null;
}
// Track the current IME composition fallback object, if any.
var currentComposition = null;
/**
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {?object} A SyntheticCompositionEvent.
*/
function extractCompositionEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
var eventType;
var fallbackData;
if (canUseCompositionEvent) {
eventType = getCompositionEventType(topLevelType);
} else if (!currentComposition) {
if (isFallbackCompositionStart(topLevelType, nativeEvent)) {
eventType = eventTypes.compositionStart;
}
} else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) {
eventType = eventTypes.compositionEnd;
}
if (!eventType) {
return null;
}
if (useFallbackCompositionData) {
// The current composition is stored statically and must not be
// overwritten while composition continues.
if (!currentComposition && eventType === eventTypes.compositionStart) {
currentComposition = FallbackCompositionState.getPooled(topLevelTarget);
} else if (eventType === eventTypes.compositionEnd) {
if (currentComposition) {
fallbackData = currentComposition.getData();
}
}
}
var event = SyntheticCompositionEvent.getPooled(eventType, topLevelTargetID, nativeEvent, nativeEventTarget);
if (fallbackData) {
// Inject data generated from fallback path into the synthetic event.
// This matches the property of native CompositionEventInterface.
event.data = fallbackData;
} else {
var customData = getDataFromCustomEvent(nativeEvent);
if (customData !== null) {
event.data = customData;
}
}
EventPropagators.accumulateTwoPhaseDispatches(event);
return event;
}
/**
* @param {string} topLevelType Record from `EventConstants`.
* @param {object} nativeEvent Native browser event.
* @return {?string} The string corresponding to this `beforeInput` event.
*/
function getNativeBeforeInputChars(topLevelType, nativeEvent) {
switch (topLevelType) {
case topLevelTypes.topCompositionEnd:
return getDataFromCustomEvent(nativeEvent);
case topLevelTypes.topKeyPress:
/**
* If native `textInput` events are available, our goal is to make
* use of them. However, there is a special case: the spacebar key.
* In Webkit, preventing default on a spacebar `textInput` event
* cancels character insertion, but it *also* causes the browser
* to fall back to its default spacebar behavior of scrolling the
* page.
*
* Tracking at:
* https://code.google.com/p/chromium/issues/detail?id=355103
*
* To avoid this issue, use the keypress event as if no `textInput`
* event is available.
*/
var which = nativeEvent.which;
if (which !== SPACEBAR_CODE) {
return null;
}
hasSpaceKeypress = true;
return SPACEBAR_CHAR;
case topLevelTypes.topTextInput:
// Record the characters to be added to the DOM.
var chars = nativeEvent.data;
// If it's a spacebar character, assume that we have already handled
// it at the keypress level and bail immediately. Android Chrome
// doesn't give us keycodes, so we need to blacklist it.
if (chars === SPACEBAR_CHAR && hasSpaceKeypress) {
return null;
}
return chars;
default:
// For other native event types, do nothing.
return null;
}
}
/**
* For browsers that do not provide the `textInput` event, extract the
* appropriate string to use for SyntheticInputEvent.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {object} nativeEvent Native browser event.
* @return {?string} The fallback string for this `beforeInput` event.
*/
function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
// If we are currently composing (IME) and using a fallback to do so,
// try to extract the composed characters from the fallback object.
if (currentComposition) {
if (topLevelType === topLevelTypes.topCompositionEnd || isFallbackCompositionEnd(topLevelType, nativeEvent)) {
var chars = currentComposition.getData();
FallbackCompositionState.release(currentComposition);
currentComposition = null;
return chars;
}
return null;
}
switch (topLevelType) {
case topLevelTypes.topPaste:
// If a paste event occurs after a keypress, throw out the input
// chars. Paste events should not lead to BeforeInput events.
return null;
case topLevelTypes.topKeyPress:
/**
* As of v27, Firefox may fire keypress events even when no character
* will be inserted. A few possibilities:
*
* - `which` is `0`. Arrow keys, Esc key, etc.
*
* - `which` is the pressed key code, but no char is available.
* Ex: 'AltGr + d` in Polish. There is no modified character for
* this key combination and no character is inserted into the
* document, but FF fires the keypress for char code `100` anyway.
* No `input` event will occur.
*
* - `which` is the pressed key code, but a command combination is
* being used. Ex: `Cmd+C`. No character is inserted, and no
* `input` event will occur.
*/
if (nativeEvent.which && !isKeypressCommand(nativeEvent)) {
return String.fromCharCode(nativeEvent.which);
}
return null;
case topLevelTypes.topCompositionEnd:
return useFallbackCompositionData ? null : nativeEvent.data;
default:
return null;
}
}
/**
* Extract a SyntheticInputEvent for `beforeInput`, based on either native
* `textInput` or fallback behavior.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {?object} A SyntheticInputEvent.
*/
function extractBeforeInputEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
var chars;
if (canUseTextInputEvent) {
chars = getNativeBeforeInputChars(topLevelType, nativeEvent);
} else {
chars = getFallbackBeforeInputChars(topLevelType, nativeEvent);
}
// If no characters are being inserted, no BeforeInput event should
// be fired.
if (!chars) {
return null;
}
var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, topLevelTargetID, nativeEvent, nativeEventTarget);
event.data = chars;
EventPropagators.accumulateTwoPhaseDispatches(event);
return event;
}
/**
* Create an `onBeforeInput` event to match
* http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents.
*
* This event plugin is based on the native `textInput` event
* available in Chrome, Safari, Opera, and IE. This event fires after
* `onKeyPress` and `onCompositionEnd`, but before `onInput`.
*
* `beforeInput` is spec'd but not implemented in any browsers, and
* the `input` event does not provide any useful information about what has
* actually been added, contrary to the spec. Thus, `textInput` is the best
* available event to identify the characters that have actually been inserted
* into the target node.
*
* This plugin is also responsible for emitting `composition` events, thus
* allowing us to share composition fallback code for both `beforeInput` and
* `composition` event types.
*/
var BeforeInputEventPlugin = {
eventTypes: eventTypes,
/**
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
return [extractCompositionEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget), extractBeforeInputEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget)];
}
};
module.exports = BeforeInputEventPlugin;
},{"./EventConstants":21,"./EventPropagators":25,"./FallbackCompositionState":26,"./SyntheticCompositionEvent":97,"./SyntheticInputEvent":101,"fbjs/lib/ExecutionEnvironment":137,"fbjs/lib/keyOf":155}],10:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule CSSProperty
*/
'use strict';
/**
* CSS properties which accept numbers but are not in units of "px".
*/
var isUnitlessNumber = {
animationIterationCount: true,
boxFlex: true,
boxFlexGroup: true,
boxOrdinalGroup: true,
columnCount: true,
flex: true,
flexGrow: true,
flexPositive: true,
flexShrink: true,
flexNegative: true,
flexOrder: true,
fontWeight: true,
lineClamp: true,
lineHeight: true,
opacity: true,
order: true,
orphans: true,
tabSize: true,
widows: true,
zIndex: true,
zoom: true,
// SVG-related properties
fillOpacity: true,
stopOpacity: true,
strokeDashoffset: true,
strokeOpacity: true,
strokeWidth: true
};
/**
* @param {string} prefix vendor-specific prefix, eg: Webkit
* @param {string} key style name, eg: transitionDuration
* @return {string} style name prefixed with `prefix`, properly camelCased, eg:
* WebkitTransitionDuration
*/
function prefixKey(prefix, key) {
return prefix + key.charAt(0).toUpperCase() + key.substring(1);
}
/**
* Support style names that may come passed in prefixed by adding permutations
* of vendor prefixes.
*/
var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
// Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
// infinite loop, because it iterates over the newly added props too.
Object.keys(isUnitlessNumber).forEach(function (prop) {
prefixes.forEach(function (prefix) {
isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
});
});
/**
* Most style properties can be unset by doing .style[prop] = '' but IE8
* doesn't like doing that with shorthand properties so for the properties that
* IE8 breaks on, which are listed here, we instead unset each of the
* individual properties. See http://bugs.jquery.com/ticket/12385.
* The 4-value 'clock' properties like margin, padding, border-width seem to
* behave without any problems. Curiously, list-style works too without any
* special prodding.
*/
var shorthandPropertyExpansions = {
background: {
backgroundAttachment: true,
backgroundColor: true,
backgroundImage: true,
backgroundPositionX: true,
backgroundPositionY: true,
backgroundRepeat: true
},
backgroundPosition: {
backgroundPositionX: true,
backgroundPositionY: true
},
border: {
borderWidth: true,
borderStyle: true,
borderColor: true
},
borderBottom: {
borderBottomWidth: true,
borderBottomStyle: true,
borderBottomColor: true
},
borderLeft: {
borderLeftWidth: true,
borderLeftStyle: true,
borderLeftColor: true
},
borderRight: {
borderRightWidth: true,
borderRightStyle: true,
borderRightColor: true
},
borderTop: {
borderTopWidth: true,
borderTopStyle: true,
borderTopColor: true
},
font: {
fontStyle: true,
fontVariant: true,
fontWeight: true,
fontSize: true,
lineHeight: true,
fontFamily: true
},
outline: {
outlineWidth: true,
outlineStyle: true,
outlineColor: true
}
};
var CSSProperty = {
isUnitlessNumber: isUnitlessNumber,
shorthandPropertyExpansions: shorthandPropertyExpansions
};
module.exports = CSSProperty;
},{}],11:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule CSSPropertyOperations
* @typechecks static-only
*/
'use strict';
var CSSProperty = require('./CSSProperty');
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
var ReactPerf = require('./ReactPerf');
var camelizeStyleName = require('fbjs/lib/camelizeStyleName');
var dangerousStyleValue = require('./dangerousStyleValue');
var hyphenateStyleName = require('fbjs/lib/hyphenateStyleName');
var memoizeStringOnly = require('fbjs/lib/memoizeStringOnly');
var warning = require('fbjs/lib/warning');
var processStyleName = memoizeStringOnly(function (styleName) {
return hyphenateStyleName(styleName);
});
var hasShorthandPropertyBug = false;
var styleFloatAccessor = 'cssFloat';
if (ExecutionEnvironment.canUseDOM) {
var tempStyle = document.createElement('div').style;
try {
// IE8 throws "Invalid argument." if resetting shorthand style properties.
tempStyle.font = '';
} catch (e) {
hasShorthandPropertyBug = true;
}
// IE8 only supports accessing cssFloat (standard) as styleFloat
if (document.documentElement.style.cssFloat === undefined) {
styleFloatAccessor = 'styleFloat';
}
}
if (process.env.NODE_ENV !== 'production') {
// 'msTransform' is correct, but the other prefixes should be capitalized
var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
// style values shouldn't contain a semicolon
var badStyleValueWithSemicolonPattern = /;\s*$/;
var warnedStyleNames = {};
var warnedStyleValues = {};
var warnHyphenatedStyleName = function (name) {
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
return;
}
warnedStyleNames[name] = true;
process.env.NODE_ENV !== 'production' ? warning(false, 'Unsupported style property %s. Did you mean %s?', name, camelizeStyleName(name)) : undefined;
};
var warnBadVendoredStyleName = function (name) {
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
return;
}
warnedStyleNames[name] = true;
process.env.NODE_ENV !== 'production' ? warning(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?', name, name.charAt(0).toUpperCase() + name.slice(1)) : undefined;
};
var warnStyleValueWithSemicolon = function (name, value) {
if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
return;
}
warnedStyleValues[value] = true;
process.env.NODE_ENV !== 'production' ? warning(false, 'Style property values shouldn\'t contain a semicolon. ' + 'Try "%s: %s" instead.', name, value.replace(badStyleValueWithSemicolonPattern, '')) : undefined;
};
/**
* @param {string} name
* @param {*} value
*/
var warnValidStyle = function (name, value) {
if (name.indexOf('-') > -1) {
warnHyphenatedStyleName(name);
} else if (badVendoredStyleNamePattern.test(name)) {
warnBadVendoredStyleName(name);
} else if (badStyleValueWithSemicolonPattern.test(value)) {
warnStyleValueWithSemicolon(name, value);
}
};
}
/**
* Operations for dealing with CSS properties.
*/
var CSSPropertyOperations = {
/**
* Serializes a mapping of style properties for use as inline styles:
*
* > createMarkupForStyles({width: '200px', height: 0})
* "width:200px;height:0;"
*
* Undefined values are ignored so that declarative programming is easier.
* The result should be HTML-escaped before insertion into the DOM.
*
* @param {object} styles
* @return {?string}
*/
createMarkupForStyles: function (styles) {
var serialized = '';
for (var styleName in styles) {
if (!styles.hasOwnProperty(styleName)) {
continue;
}
var styleValue = styles[styleName];
if (process.env.NODE_ENV !== 'production') {
warnValidStyle(styleName, styleValue);
}
if (styleValue != null) {
serialized += processStyleName(styleName) + ':';
serialized += dangerousStyleValue(styleName, styleValue) + ';';
}
}
return serialized || null;
},
/**
* Sets the value for multiple styles on a node. If a value is specified as
* '' (empty string), the corresponding style property will be unset.
*
* @param {DOMElement} node
* @param {object} styles
*/
setValueForStyles: function (node, styles) {
var style = node.style;
for (var styleName in styles) {
if (!styles.hasOwnProperty(styleName)) {
continue;
}
if (process.env.NODE_ENV !== 'production') {
warnValidStyle(styleName, styles[styleName]);
}
var styleValue = dangerousStyleValue(styleName, styles[styleName]);
if (styleName === 'float') {
styleName = styleFloatAccessor;
}
if (styleValue) {
style[styleName] = styleValue;
} else {
var expansion = hasShorthandPropertyBug && CSSProperty.shorthandPropertyExpansions[styleName];
if (expansion) {
// Shorthand property that IE8 won't like unsetting, so unset each
// component to placate it
for (var individualStyleName in expansion) {
style[individualStyleName] = '';
}
} else {
style[styleName] = '';
}
}
}
}
};
ReactPerf.measureMethods(CSSPropertyOperations, 'CSSPropertyOperations', {
setValueForStyles: 'setValueForStyles'
});
module.exports = CSSPropertyOperations;
}).call(this,require('_process'))
},{"./CSSProperty":10,"./ReactPerf":78,"./dangerousStyleValue":112,"_process":164,"fbjs/lib/ExecutionEnvironment":137,"fbjs/lib/camelizeStyleName":139,"fbjs/lib/hyphenateStyleName":150,"fbjs/lib/memoizeStringOnly":157,"fbjs/lib/warning":162}],12:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule CallbackQueue
*/
'use strict';
var PooledClass = require('./PooledClass');
var assign = require('./Object.assign');
var invariant = require('fbjs/lib/invariant');
/**
* A specialized pseudo-event module to help keep track of components waiting to
* be notified when their DOM representations are available for use.
*
* This implements `PooledClass`, so you should never need to instantiate this.
* Instead, use `CallbackQueue.getPooled()`.
*
* @class ReactMountReady
* @implements PooledClass
* @internal
*/
function CallbackQueue() {
this._callbacks = null;
this._contexts = null;
}
assign(CallbackQueue.prototype, {
/**
* Enqueues a callback to be invoked when `notifyAll` is invoked.
*
* @param {function} callback Invoked when `notifyAll` is invoked.
* @param {?object} context Context to call `callback` with.
* @internal
*/
enqueue: function (callback, context) {
this._callbacks = this._callbacks || [];
this._contexts = this._contexts || [];
this._callbacks.push(callback);
this._contexts.push(context);
},
/**
* Invokes all enqueued callbacks and clears the queue. This is invoked after
* the DOM representation of a component has been created or updated.
*
* @internal
*/
notifyAll: function () {
var callbacks = this._callbacks;
var contexts = this._contexts;
if (callbacks) {
!(callbacks.length === contexts.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Mismatched list of contexts in callback queue') : invariant(false) : undefined;
this._callbacks = null;
this._contexts = null;
for (var i = 0; i < callbacks.length; i++) {
callbacks[i].call(contexts[i]);
}
callbacks.length = 0;
contexts.length = 0;
}
},
/**
* Resets the internal queue.
*
* @internal
*/
reset: function () {
this._callbacks = null;
this._contexts = null;
},
/**
* `PooledClass` looks for this.
*/
destructor: function () {
this.reset();
}
});
PooledClass.addPoolingTo(CallbackQueue);
module.exports = CallbackQueue;
}).call(this,require('_process'))
},{"./Object.assign":29,"./PooledClass":30,"_process":164,"fbjs/lib/invariant":151}],13:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ChangeEventPlugin
*/
'use strict';
var EventConstants = require('./EventConstants');
var EventPluginHub = require('./EventPluginHub');
var EventPropagators = require('./EventPropagators');
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
var ReactUpdates = require('./ReactUpdates');
var SyntheticEvent = require('./SyntheticEvent');
var getEventTarget = require('./getEventTarget');
var isEventSupported = require('./isEventSupported');
var isTextInputElement = require('./isTextInputElement');
var keyOf = require('fbjs/lib/keyOf');
var topLevelTypes = EventConstants.topLevelTypes;
var eventTypes = {
change: {
phasedRegistrationNames: {
bubbled: keyOf({ onChange: null }),
captured: keyOf({ onChangeCapture: null })
},
dependencies: [topLevelTypes.topBlur, topLevelTypes.topChange, topLevelTypes.topClick, topLevelTypes.topFocus, topLevelTypes.topInput, topLevelTypes.topKeyDown, topLevelTypes.topKeyUp, topLevelTypes.topSelectionChange]
}
};
/**
* For IE shims
*/
var activeElement = null;
var activeElementID = null;
var activeElementValue = null;
var activeElementValueProp = null;
/**
* SECTION: handle `change` event
*/
function shouldUseChangeEvent(elem) {
var nodeName = elem.nodeName && elem.nodeName.toLowerCase();
return nodeName === 'select' || nodeName === 'input' && elem.type === 'file';
}
var doesChangeEventBubble = false;
if (ExecutionEnvironment.canUseDOM) {
// See `handleChange` comment below
doesChangeEventBubble = isEventSupported('change') && (!('documentMode' in document) || document.documentMode > 8);
}
function manualDispatchChangeEvent(nativeEvent) {
var event = SyntheticEvent.getPooled(eventTypes.change, activeElementID, nativeEvent, getEventTarget(nativeEvent));
EventPropagators.accumulateTwoPhaseDispatches(event);
// If change and propertychange bubbled, we'd just bind to it like all the
// other events and have it go through ReactBrowserEventEmitter. Since it
// doesn't, we manually listen for the events and so we have to enqueue and
// process the abstract event manually.
//
// Batching is necessary here in order to ensure that all event handlers run
// before the next rerender (including event handlers attached to ancestor
// elements instead of directly on the input). Without this, controlled
// components don't work properly in conjunction with event bubbling because
// the component is rerendered and the value reverted before all the event
// handlers can run. See https://github.com/facebook/react/issues/708.
ReactUpdates.batchedUpdates(runEventInBatch, event);
}
function runEventInBatch(event) {
EventPluginHub.enqueueEvents(event);
EventPluginHub.processEventQueue(false);
}
function startWatchingForChangeEventIE8(target, targetID) {
activeElement = target;
activeElementID = targetID;
activeElement.attachEvent('onchange', manualDispatchChangeEvent);
}
function stopWatchingForChangeEventIE8() {
if (!activeElement) {
return;
}
activeElement.detachEvent('onchange', manualDispatchChangeEvent);
activeElement = null;
activeElementID = null;
}
function getTargetIDForChangeEvent(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topChange) {
return topLevelTargetID;
}
}
function handleEventsForChangeEventIE8(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topFocus) {
// stopWatching() should be a noop here but we call it just in case we
// missed a blur event somehow.
stopWatchingForChangeEventIE8();
startWatchingForChangeEventIE8(topLevelTarget, topLevelTargetID);
} else if (topLevelType === topLevelTypes.topBlur) {
stopWatchingForChangeEventIE8();
}
}
/**
* SECTION: handle `input` event
*/
var isInputEventSupported = false;
if (ExecutionEnvironment.canUseDOM) {
// IE9 claims to support the input event but fails to trigger it when
// deleting text, so we ignore its input events
isInputEventSupported = isEventSupported('input') && (!('documentMode' in document) || document.documentMode > 9);
}
/**
* (For old IE.) Replacement getter/setter for the `value` property that gets
* set on the active element.
*/
var newValueProp = {
get: function () {
return activeElementValueProp.get.call(this);
},
set: function (val) {
// Cast to a string so we can do equality checks.
activeElementValue = '' + val;
activeElementValueProp.set.call(this, val);
}
};
/**
* (For old IE.) Starts tracking propertychange events on the passed-in element
* and override the value property so that we can distinguish user events from
* value changes in JS.
*/
function startWatchingForValueChange(target, targetID) {
activeElement = target;
activeElementID = targetID;
activeElementValue = target.value;
activeElementValueProp = Object.getOwnPropertyDescriptor(target.constructor.prototype, 'value');
// Not guarded in a canDefineProperty check: IE8 supports defineProperty only
// on DOM elements
Object.defineProperty(activeElement, 'value', newValueProp);
activeElement.attachEvent('onpropertychange', handlePropertyChange);
}
/**
* (For old IE.) Removes the event listeners from the currently-tracked element,
* if any exists.
*/
function stopWatchingForValueChange() {
if (!activeElement) {
return;
}
// delete restores the original property definition
delete activeElement.value;
activeElement.detachEvent('onpropertychange', handlePropertyChange);
activeElement = null;
activeElementID = null;
activeElementValue = null;
activeElementValueProp = null;
}
/**
* (For old IE.) Handles a propertychange event, sending a `change` event if
* the value of the active element has changed.
*/
function handlePropertyChange(nativeEvent) {
if (nativeEvent.propertyName !== 'value') {
return;
}
var value = nativeEvent.srcElement.value;
if (value === activeElementValue) {
return;
}
activeElementValue = value;
manualDispatchChangeEvent(nativeEvent);
}
/**
* If a `change` event should be fired, returns the target's ID.
*/
function getTargetIDForInputEvent(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topInput) {
// In modern browsers (i.e., not IE8 or IE9), the input event is exactly
// what we want so fall through here and trigger an abstract event
return topLevelTargetID;
}
}
// For IE8 and IE9.
function handleEventsForInputEventIE(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topFocus) {
// In IE8, we can capture almost all .value changes by adding a
// propertychange handler and looking for events with propertyName
// equal to 'value'
// In IE9, propertychange fires for most input events but is buggy and
// doesn't fire when text is deleted, but conveniently, selectionchange
// appears to fire in all of the remaining cases so we catch those and
// forward the event if the value has changed
// In either case, we don't want to call the event handler if the value
// is changed from JS so we redefine a setter for `.value` that updates
// our activeElementValue variable, allowing us to ignore those changes
//
// stopWatching() should be a noop here but we call it just in case we
// missed a blur event somehow.
stopWatchingForValueChange();
startWatchingForValueChange(topLevelTarget, topLevelTargetID);
} else if (topLevelType === topLevelTypes.topBlur) {
stopWatchingForValueChange();
}
}
// For IE8 and IE9.
function getTargetIDForInputEventIE(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topSelectionChange || topLevelType === topLevelTypes.topKeyUp || topLevelType === topLevelTypes.topKeyDown) {
// On the selectionchange event, the target is just document which isn't
// helpful for us so just check activeElement instead.
//
// 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire
// propertychange on the first input event after setting `value` from a
// script and fires only keydown, keypress, keyup. Catching keyup usually
// gets it and catching keydown lets us fire an event for the first
// keystroke if user does a key repeat (it'll be a little delayed: right
// before the second keystroke). Other input methods (e.g., paste) seem to
// fire selectionchange normally.
if (activeElement && activeElement.value !== activeElementValue) {
activeElementValue = activeElement.value;
return activeElementID;
}
}
}
/**
* SECTION: handle `click` event
*/
function shouldUseClickEvent(elem) {
// Use the `click` event to detect changes to checkbox and radio inputs.
// This approach works across all browsers, whereas `change` does not fire
// until `blur` in IE8.
return elem.nodeName && elem.nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio');
}
function getTargetIDForClickEvent(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topClick) {
return topLevelTargetID;
}
}
/**
* This plugin creates an `onChange` event that normalizes change events
* across form elements. This event fires at a time when it's possible to
* change the element's value without seeing a flicker.
*
* Supported elements are:
* - input (see `isTextInputElement`)
* - textarea
* - select
*/
var ChangeEventPlugin = {
eventTypes: eventTypes,
/**
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
var getTargetIDFunc, handleEventFunc;
if (shouldUseChangeEvent(topLevelTarget)) {
if (doesChangeEventBubble) {
getTargetIDFunc = getTargetIDForChangeEvent;
} else {
handleEventFunc = handleEventsForChangeEventIE8;
}
} else if (isTextInputElement(topLevelTarget)) {
if (isInputEventSupported) {
getTargetIDFunc = getTargetIDForInputEvent;
} else {
getTargetIDFunc = getTargetIDForInputEventIE;
handleEventFunc = handleEventsForInputEventIE;
}
} else if (shouldUseClickEvent(topLevelTarget)) {
getTargetIDFunc = getTargetIDForClickEvent;
}
if (getTargetIDFunc) {
var targetID = getTargetIDFunc(topLevelType, topLevelTarget, topLevelTargetID);
if (targetID) {
var event = SyntheticEvent.getPooled(eventTypes.change, targetID, nativeEvent, nativeEventTarget);
event.type = 'change';
EventPropagators.accumulateTwoPhaseDispatches(event);
return event;
}
}
if (handleEventFunc) {
handleEventFunc(topLevelType, topLevelTarget, topLevelTargetID);
}
}
};
module.exports = ChangeEventPlugin;
},{"./EventConstants":21,"./EventPluginHub":22,"./EventPropagators":25,"./ReactUpdates":90,"./SyntheticEvent":99,"./getEventTarget":121,"./isEventSupported":126,"./isTextInputElement":127,"fbjs/lib/ExecutionEnvironment":137,"fbjs/lib/keyOf":155}],14:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ClientReactRootIndex
* @typechecks
*/
'use strict';
var nextReactRootIndex = 0;
var ClientReactRootIndex = {
createReactRootIndex: function () {
return nextReactRootIndex++;
}
};
module.exports = ClientReactRootIndex;
},{}],15:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule DOMChildrenOperations
* @typechecks static-only
*/
'use strict';
var Danger = require('./Danger');
var ReactMultiChildUpdateTypes = require('./ReactMultiChildUpdateTypes');
var ReactPerf = require('./ReactPerf');
var setInnerHTML = require('./setInnerHTML');
var setTextContent = require('./setTextContent');
var invariant = require('fbjs/lib/invariant');
/**
* Inserts `childNode` as a child of `parentNode` at the `index`.
*
* @param {DOMElement} parentNode Parent node in which to insert.
* @param {DOMElement} childNode Child node to insert.
* @param {number} index Index at which to insert the child.
* @internal
*/
function insertChildAt(parentNode, childNode, index) {
// By exploiting arrays returning `undefined` for an undefined index, we can
// rely exclusively on `insertBefore(node, null)` instead of also using
// `appendChild(node)`. However, using `undefined` is not allowed by all
// browsers so we must replace it with `null`.
// fix render order error in safari
// IE8 will throw error when index out of list size.
var beforeChild = index >= parentNode.childNodes.length ? null : parentNode.childNodes.item(index);
parentNode.insertBefore(childNode, beforeChild);
}
/**
* Operations for updating with DOM children.
*/
var DOMChildrenOperations = {
dangerouslyReplaceNodeWithMarkup: Danger.dangerouslyReplaceNodeWithMarkup,
updateTextContent: setTextContent,
/**
* Updates a component's children by processing a series of updates. The
* update configurations are each expected to have a `parentNode` property.
*
* @param {array<object>} updates List of update configurations.
* @param {array<string>} markupList List of markup strings.
* @internal
*/
processUpdates: function (updates, markupList) {
var update;
// Mapping from parent IDs to initial child orderings.
var initialChildren = null;
// List of children that will be moved or removed.
var updatedChildren = null;
for (var i = 0; i < updates.length; i++) {
update = updates[i];
if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING || update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) {
var updatedIndex = update.fromIndex;
var updatedChild = update.parentNode.childNodes[updatedIndex];
var parentID = update.parentID;
!updatedChild ? process.env.NODE_ENV !== 'production' ? invariant(false, 'processUpdates(): Unable to find child %s of element. This ' + 'probably means the DOM was unexpectedly mutated (e.g., by the ' + 'browser), usually due to forgetting a <tbody> when using tables, ' + 'nesting tags like <form>, <p>, or <a>, or using non-SVG elements ' + 'in an <svg> parent. Try inspecting the child nodes of the element ' + 'with React ID `%s`.', updatedIndex, parentID) : invariant(false) : undefined;
initialChildren = initialChildren || {};
initialChildren[parentID] = initialChildren[parentID] || [];
initialChildren[parentID][updatedIndex] = updatedChild;
updatedChildren = updatedChildren || [];
updatedChildren.push(updatedChild);
}
}
var renderedMarkup;
// markupList is either a list of markup or just a list of elements
if (markupList.length && typeof markupList[0] === 'string') {
renderedMarkup = Danger.dangerouslyRenderMarkup(markupList);
} else {
renderedMarkup = markupList;
}
// Remove updated children first so that `toIndex` is consistent.
if (updatedChildren) {
for (var j = 0; j < updatedChildren.length; j++) {
updatedChildren[j].parentNode.removeChild(updatedChildren[j]);
}
}
for (var k = 0; k < updates.length; k++) {
update = updates[k];
switch (update.type) {
case ReactMultiChildUpdateTypes.INSERT_MARKUP:
insertChildAt(update.parentNode, renderedMarkup[update.markupIndex], update.toIndex);
break;
case ReactMultiChildUpdateTypes.MOVE_EXISTING:
insertChildAt(update.parentNode, initialChildren[update.parentID][update.fromIndex], update.toIndex);
break;
case ReactMultiChildUpdateTypes.SET_MARKUP:
setInnerHTML(update.parentNode, update.content);
break;
case ReactMultiChildUpdateTypes.TEXT_CONTENT:
setTextContent(update.parentNode, update.content);
break;
case ReactMultiChildUpdateTypes.REMOVE_NODE:
// Already removed by the for-loop above.
break;
}
}
}
};
ReactPerf.measureMethods(DOMChildrenOperations, 'DOMChildrenOperations', {
updateTextContent: 'updateTextContent'
});
module.exports = DOMChildrenOperations;
}).call(this,require('_process'))
},{"./Danger":18,"./ReactMultiChildUpdateTypes":74,"./ReactPerf":78,"./setInnerHTML":131,"./setTextContent":132,"_process":164,"fbjs/lib/invariant":151}],16:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule DOMProperty
* @typechecks static-only
*/
'use strict';
var invariant = require('fbjs/lib/invariant');
function checkMask(value, bitmask) {
return (value & bitmask) === bitmask;
}
var DOMPropertyInjection = {
/**
* Mapping from normalized, camelcased property names to a configuration that
* specifies how the associated DOM property should be accessed or rendered.
*/
MUST_USE_ATTRIBUTE: 0x1,
MUST_USE_PROPERTY: 0x2,
HAS_SIDE_EFFECTS: 0x4,
HAS_BOOLEAN_VALUE: 0x8,
HAS_NUMERIC_VALUE: 0x10,
HAS_POSITIVE_NUMERIC_VALUE: 0x20 | 0x10,
HAS_OVERLOADED_BOOLEAN_VALUE: 0x40,
/**
* Inject some specialized knowledge about the DOM. This takes a config object
* with the following properties:
*
* isCustomAttribute: function that given an attribute name will return true
* if it can be inserted into the DOM verbatim. Useful for data-* or aria-*
* attributes where it's impossible to enumerate all of the possible
* attribute names,
*
* Properties: object mapping DOM property name to one of the
* DOMPropertyInjection constants or null. If your attribute isn't in here,
* it won't get written to the DOM.
*
* DOMAttributeNames: object mapping React attribute name to the DOM
* attribute name. Attribute names not specified use the **lowercase**
* normalized name.
*
* DOMAttributeNamespaces: object mapping React attribute name to the DOM
* attribute namespace URL. (Attribute names not specified use no namespace.)
*
* DOMPropertyNames: similar to DOMAttributeNames but for DOM properties.
* Property names not specified use the normalized name.
*
* DOMMutationMethods: Properties that require special mutation methods. If
* `value` is undefined, the mutation method should unset the property.
*
* @param {object} domPropertyConfig the config as described above.
*/
injectDOMPropertyConfig: function (domPropertyConfig) {
var Injection = DOMPropertyInjection;
var Properties = domPropertyConfig.Properties || {};
var DOMAttributeNamespaces = domPropertyConfig.DOMAttributeNamespaces || {};
var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {};
var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {};
var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {};
if (domPropertyConfig.isCustomAttribute) {
DOMProperty._isCustomAttributeFunctions.push(domPropertyConfig.isCustomAttribute);
}
for (var propName in Properties) {
!!DOMProperty.properties.hasOwnProperty(propName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property ' + '\'%s\' which has already been injected. You may be accidentally ' + 'injecting the same DOM property config twice, or you may be ' + 'injecting two configs that have conflicting property names.', propName) : invariant(false) : undefined;
var lowerCased = propName.toLowerCase();
var propConfig = Properties[propName];
var propertyInfo = {
attributeName: lowerCased,
attributeNamespace: null,
propertyName: propName,
mutationMethod: null,
mustUseAttribute: checkMask(propConfig, Injection.MUST_USE_ATTRIBUTE),
mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY),
hasSideEffects: checkMask(propConfig, Injection.HAS_SIDE_EFFECTS),
hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE),
hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE),
hasPositiveNumericValue: checkMask(propConfig, Injection.HAS_POSITIVE_NUMERIC_VALUE),
hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE)
};
!(!propertyInfo.mustUseAttribute || !propertyInfo.mustUseProperty) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'DOMProperty: Cannot require using both attribute and property: %s', propName) : invariant(false) : undefined;
!(propertyInfo.mustUseProperty || !propertyInfo.hasSideEffects) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'DOMProperty: Properties that have side effects must use property: %s', propName) : invariant(false) : undefined;
!(propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'DOMProperty: Value can be one of boolean, overloaded boolean, or ' + 'numeric value, but not a combination: %s', propName) : invariant(false) : undefined;
if (process.env.NODE_ENV !== 'production') {
DOMProperty.getPossibleStandardName[lowerCased] = propName;
}
if (DOMAttributeNames.hasOwnProperty(propName)) {
var attributeName = DOMAttributeNames[propName];
propertyInfo.attributeName = attributeName;
if (process.env.NODE_ENV !== 'production') {
DOMProperty.getPossibleStandardName[attributeName] = propName;
}
}
if (DOMAttributeNamespaces.hasOwnProperty(propName)) {
propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName];
}
if (DOMPropertyNames.hasOwnProperty(propName)) {
propertyInfo.propertyName = DOMPropertyNames[propName];
}
if (DOMMutationMethods.hasOwnProperty(propName)) {
propertyInfo.mutationMethod = DOMMutationMethods[propName];
}
DOMProperty.properties[propName] = propertyInfo;
}
}
};
var defaultValueCache = {};
/**
* DOMProperty exports lookup objects that can be used like functions:
*
* > DOMProperty.isValid['id']
* true
* > DOMProperty.isValid['foobar']
* undefined
*
* Although this may be confusing, it performs better in general.
*
* @see http://jsperf.com/key-exists
* @see http://jsperf.com/key-missing
*/
var DOMProperty = {
ID_ATTRIBUTE_NAME: 'data-reactid',
/**
* Map from property "standard name" to an object with info about how to set
* the property in the DOM. Each object contains:
*
* attributeName:
* Used when rendering markup or with `*Attribute()`.
* attributeNamespace
* propertyName:
* Used on DOM node instances. (This includes properties that mutate due to
* external factors.)
* mutationMethod:
* If non-null, used instead of the property or `setAttribute()` after
* initial render.
* mustUseAttribute:
* Whether the property must be accessed and mutated using `*Attribute()`.
* (This includes anything that fails `<propName> in <element>`.)
* mustUseProperty:
* Whether the property must be accessed and mutated as an object property.
* hasSideEffects:
* Whether or not setting a value causes side effects such as triggering
* resources to be loaded or text selection changes. If true, we read from
* the DOM before updating to ensure that the value is only set if it has
* changed.
* hasBooleanValue:
* Whether the property should be removed when set to a falsey value.
* hasNumericValue:
* Whether the property must be numeric or parse as a numeric and should be
* removed when set to a falsey value.
* hasPositiveNumericValue:
* Whether the property must be positive numeric or parse as a positive
* numeric and should be removed when set to a falsey value.
* hasOverloadedBooleanValue:
* Whether the property can be used as a flag as well as with a value.
* Removed when strictly equal to false; present without a value when
* strictly equal to true; present with a value otherwise.
*/
properties: {},
/**
* Mapping from lowercase property names to the properly cased version, used
* to warn in the case of missing properties. Available only in __DEV__.
* @type {Object}
*/
getPossibleStandardName: process.env.NODE_ENV !== 'production' ? {} : null,
/**
* All of the isCustomAttribute() functions that have been injected.
*/
_isCustomAttributeFunctions: [],
/**
* Checks whether a property name is a custom attribute.
* @method
*/
isCustomAttribute: function (attributeName) {
for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) {
var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i];
if (isCustomAttributeFn(attributeName)) {
return true;
}
}
return false;
},
/**
* Returns the default property value for a DOM property (i.e., not an
* attribute). Most default values are '' or false, but not all. Worse yet,
* some (in particular, `type`) vary depending on the type of element.
*
* TODO: Is it better to grab all the possible properties when creating an
* element to avoid having to create the same element twice?
*/
getDefaultValueForProperty: function (nodeName, prop) {
var nodeDefaults = defaultValueCache[nodeName];
var testElement;
if (!nodeDefaults) {
defaultValueCache[nodeName] = nodeDefaults = {};
}
if (!(prop in nodeDefaults)) {
testElement = document.createElement(nodeName);
nodeDefaults[prop] = testElement[prop];
}
return nodeDefaults[prop];
},
injection: DOMPropertyInjection
};
module.exports = DOMProperty;
}).call(this,require('_process'))
},{"_process":164,"fbjs/lib/invariant":151}],17:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule DOMPropertyOperations
* @typechecks static-only
*/
'use strict';
var DOMProperty = require('./DOMProperty');
var ReactPerf = require('./ReactPerf');
var quoteAttributeValueForBrowser = require('./quoteAttributeValueForBrowser');
var warning = require('fbjs/lib/warning');
// Simplified subset
var VALID_ATTRIBUTE_NAME_REGEX = /^[a-zA-Z_][\w\.\-]*$/;
var illegalAttributeNameCache = {};
var validatedAttributeNameCache = {};
function isAttributeNameSafe(attributeName) {
if (validatedAttributeNameCache.hasOwnProperty(attributeName)) {
return true;
}
if (illegalAttributeNameCache.hasOwnProperty(attributeName)) {
return false;
}
if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
validatedAttributeNameCache[attributeName] = true;
return true;
}
illegalAttributeNameCache[attributeName] = true;
process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid attribute name: `%s`', attributeName) : undefined;
return false;
}
function shouldIgnoreValue(propertyInfo, value) {
return value == null || propertyInfo.hasBooleanValue && !value || propertyInfo.hasNumericValue && isNaN(value) || propertyInfo.hasPositiveNumericValue && value < 1 || propertyInfo.hasOverloadedBooleanValue && value === false;
}
if (process.env.NODE_ENV !== 'production') {
var reactProps = {
children: true,
dangerouslySetInnerHTML: true,
key: true,
ref: true
};
var warnedProperties = {};
var warnUnknownProperty = function (name) {
if (reactProps.hasOwnProperty(name) && reactProps[name] || warnedProperties.hasOwnProperty(name) && warnedProperties[name]) {
return;
}
warnedProperties[name] = true;
var lowerCasedName = name.toLowerCase();
// data-* attributes should be lowercase; suggest the lowercase version
var standardName = DOMProperty.isCustomAttribute(lowerCasedName) ? lowerCasedName : DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ? DOMProperty.getPossibleStandardName[lowerCasedName] : null;
// For now, only warn when we have a suggested correction. This prevents
// logging too much when using transferPropsTo.
process.env.NODE_ENV !== 'production' ? warning(standardName == null, 'Unknown DOM property %s. Did you mean %s?', name, standardName) : undefined;
};
}
/**
* Operations for dealing with DOM properties.
*/
var DOMPropertyOperations = {
/**
* Creates markup for the ID property.
*
* @param {string} id Unescaped ID.
* @return {string} Markup string.
*/
createMarkupForID: function (id) {
return DOMProperty.ID_ATTRIBUTE_NAME + '=' + quoteAttributeValueForBrowser(id);
},
setAttributeForID: function (node, id) {
node.setAttribute(DOMProperty.ID_ATTRIBUTE_NAME, id);
},
/**
* Creates markup for a property.
*
* @param {string} name
* @param {*} value
* @return {?string} Markup string, or null if the property was invalid.
*/
createMarkupForProperty: function (name, value) {
var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
if (propertyInfo) {
if (shouldIgnoreValue(propertyInfo, value)) {
return '';
}
var attributeName = propertyInfo.attributeName;
if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
return attributeName + '=""';
}
return attributeName + '=' + quoteAttributeValueForBrowser(value);
} else if (DOMProperty.isCustomAttribute(name)) {
if (value == null) {
return '';
}
return name + '=' + quoteAttributeValueForBrowser(value);
} else if (process.env.NODE_ENV !== 'production') {
warnUnknownProperty(name);
}
return null;
},
/**
* Creates markup for a custom property.
*
* @param {string} name
* @param {*} value
* @return {string} Markup string, or empty string if the property was invalid.
*/
createMarkupForCustomAttribute: function (name, value) {
if (!isAttributeNameSafe(name) || value == null) {
return '';
}
return name + '=' + quoteAttributeValueForBrowser(value);
},
/**
* Sets the value for a property on a node.
*
* @param {DOMElement} node
* @param {string} name
* @param {*} value
*/
setValueForProperty: function (node, name, value) {
var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
if (propertyInfo) {
var mutationMethod = propertyInfo.mutationMethod;
if (mutationMethod) {
mutationMethod(node, value);
} else if (shouldIgnoreValue(propertyInfo, value)) {
this.deleteValueForProperty(node, name);
} else if (propertyInfo.mustUseAttribute) {
var attributeName = propertyInfo.attributeName;
var namespace = propertyInfo.attributeNamespace;
// `setAttribute` with objects becomes only `[object]` in IE8/9,
// ('' + value) makes it output the correct toString()-value.
if (namespace) {
node.setAttributeNS(namespace, attributeName, '' + value);
} else if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
node.setAttribute(attributeName, '');
} else {
node.setAttribute(attributeName, '' + value);
}
} else {
var propName = propertyInfo.propertyName;
// Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the
// property type before comparing; only `value` does and is string.
if (!propertyInfo.hasSideEffects || '' + node[propName] !== '' + value) {
// Contrary to `setAttribute`, object properties are properly
// `toString`ed by IE8/9.
node[propName] = value;
}
}
} else if (DOMProperty.isCustomAttribute(name)) {
DOMPropertyOperations.setValueForAttribute(node, name, value);
} else if (process.env.NODE_ENV !== 'production') {
warnUnknownProperty(name);
}
},
setValueForAttribute: function (node, name, value) {
if (!isAttributeNameSafe(name)) {
return;
}
if (value == null) {
node.removeAttribute(name);
} else {
node.setAttribute(name, '' + value);
}
},
/**
* Deletes the value for a property on a node.
*
* @param {DOMElement} node
* @param {string} name
*/
deleteValueForProperty: function (node, name) {
var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
if (propertyInfo) {
var mutationMethod = propertyInfo.mutationMethod;
if (mutationMethod) {
mutationMethod(node, undefined);
} else if (propertyInfo.mustUseAttribute) {
node.removeAttribute(propertyInfo.attributeName);
} else {
var propName = propertyInfo.propertyName;
var defaultValue = DOMProperty.getDefaultValueForProperty(node.nodeName, propName);
if (!propertyInfo.hasSideEffects || '' + node[propName] !== defaultValue) {
node[propName] = defaultValue;
}
}
} else if (DOMProperty.isCustomAttribute(name)) {
node.removeAttribute(name);
} else if (process.env.NODE_ENV !== 'production') {
warnUnknownProperty(name);
}
}
};
ReactPerf.measureMethods(DOMPropertyOperations, 'DOMPropertyOperations', {
setValueForProperty: 'setValueForProperty',
setValueForAttribute: 'setValueForAttribute',
deleteValueForProperty: 'deleteValueForProperty'
});
module.exports = DOMPropertyOperations;
}).call(this,require('_process'))
},{"./DOMProperty":16,"./ReactPerf":78,"./quoteAttributeValueForBrowser":129,"_process":164,"fbjs/lib/warning":162}],18:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule Danger
* @typechecks static-only
*/
'use strict';
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
var createNodesFromMarkup = require('fbjs/lib/createNodesFromMarkup');
var emptyFunction = require('fbjs/lib/emptyFunction');
var getMarkupWrap = require('fbjs/lib/getMarkupWrap');
var invariant = require('fbjs/lib/invariant');
var OPEN_TAG_NAME_EXP = /^(<[^ \/>]+)/;
var RESULT_INDEX_ATTR = 'data-danger-index';
/**
* Extracts the `nodeName` from a string of markup.
*
* NOTE: Extracting the `nodeName` does not require a regular expression match
* because we make assumptions about React-generated markup (i.e. there are no
* spaces surrounding the opening tag and there is at least one attribute).
*
* @param {string} markup String of markup.
* @return {string} Node name of the supplied markup.
* @see http://jsperf.com/extract-nodename
*/
function getNodeName(markup) {
return markup.substring(1, markup.indexOf(' '));
}
var Danger = {
/**
* Renders markup into an array of nodes. The markup is expected to render
* into a list of root nodes. Also, the length of `resultList` and
* `markupList` should be the same.
*
* @param {array<string>} markupList List of markup strings to render.
* @return {array<DOMElement>} List of rendered nodes.
* @internal
*/
dangerouslyRenderMarkup: function (markupList) {
!ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Cannot render markup in a worker ' + 'thread. Make sure `window` and `document` are available globally ' + 'before requiring React when unit testing or use ' + 'ReactDOMServer.renderToString for server rendering.') : invariant(false) : undefined;
var nodeName;
var markupByNodeName = {};
// Group markup by `nodeName` if a wrap is necessary, else by '*'.
for (var i = 0; i < markupList.length; i++) {
!markupList[i] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Missing markup.') : invariant(false) : undefined;
nodeName = getNodeName(markupList[i]);
nodeName = getMarkupWrap(nodeName) ? nodeName : '*';
markupByNodeName[nodeName] = markupByNodeName[nodeName] || [];
markupByNodeName[nodeName][i] = markupList[i];
}
var resultList = [];
var resultListAssignmentCount = 0;
for (nodeName in markupByNodeName) {
if (!markupByNodeName.hasOwnProperty(nodeName)) {
continue;
}
var markupListByNodeName = markupByNodeName[nodeName];
// This for-in loop skips the holes of the sparse array. The order of
// iteration should follow the order of assignment, which happens to match
// numerical index order, but we don't rely on that.
var resultIndex;
for (resultIndex in markupListByNodeName) {
if (markupListByNodeName.hasOwnProperty(resultIndex)) {
var markup = markupListByNodeName[resultIndex];
// Push the requested markup with an additional RESULT_INDEX_ATTR
// attribute. If the markup does not start with a < character, it
// will be discarded below (with an appropriate console.error).
markupListByNodeName[resultIndex] = markup.replace(OPEN_TAG_NAME_EXP,
// This index will be parsed back out below.
'$1 ' + RESULT_INDEX_ATTR + '="' + resultIndex + '" ');
}
}
// Render each group of markup with similar wrapping `nodeName`.
var renderNodes = createNodesFromMarkup(markupListByNodeName.join(''), emptyFunction // Do nothing special with <script> tags.
);
for (var j = 0; j < renderNodes.length; ++j) {
var renderNode = renderNodes[j];
if (renderNode.hasAttribute && renderNode.hasAttribute(RESULT_INDEX_ATTR)) {
resultIndex = +renderNode.getAttribute(RESULT_INDEX_ATTR);
renderNode.removeAttribute(RESULT_INDEX_ATTR);
!!resultList.hasOwnProperty(resultIndex) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Danger: Assigning to an already-occupied result index.') : invariant(false) : undefined;
resultList[resultIndex] = renderNode;
// This should match resultList.length and markupList.length when
// we're done.
resultListAssignmentCount += 1;
} else if (process.env.NODE_ENV !== 'production') {
console.error('Danger: Discarding unexpected node:', renderNode);
}
}
}
// Although resultList was populated out of order, it should now be a dense
// array.
!(resultListAssignmentCount === resultList.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Danger: Did not assign to every index of resultList.') : invariant(false) : undefined;
!(resultList.length === markupList.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Danger: Expected markup to render %s nodes, but rendered %s.', markupList.length, resultList.length) : invariant(false) : undefined;
return resultList;
},
/**
* Replaces a node with a string of markup at its current position within its
* parent. The markup must render into a single root node.
*
* @param {DOMElement} oldChild Child node to replace.
* @param {string} markup Markup to render in place of the child node.
* @internal
*/
dangerouslyReplaceNodeWithMarkup: function (oldChild, markup) {
!ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a ' + 'worker thread. Make sure `window` and `document` are available ' + 'globally before requiring React when unit testing or use ' + 'ReactDOMServer.renderToString() for server rendering.') : invariant(false) : undefined;
!markup ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(false) : undefined;
!(oldChild.tagName.toLowerCase() !== 'html') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the ' + '<html> node. This is because browser quirks make this unreliable ' + 'and/or slow. If you want to render to the root you must use ' + 'server rendering. See ReactDOMServer.renderToString().') : invariant(false) : undefined;
var newChild;
if (typeof markup === 'string') {
newChild = createNodesFromMarkup(markup, emptyFunction)[0];
} else {
newChild = markup;
}
oldChild.parentNode.replaceChild(newChild, oldChild);
}
};
module.exports = Danger;
}).call(this,require('_process'))
},{"_process":164,"fbjs/lib/ExecutionEnvironment":137,"fbjs/lib/createNodesFromMarkup":142,"fbjs/lib/emptyFunction":143,"fbjs/lib/getMarkupWrap":147,"fbjs/lib/invariant":151}],19:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule DefaultEventPluginOrder
*/
'use strict';
var keyOf = require('fbjs/lib/keyOf');
/**
* Module that is injectable into `EventPluginHub`, that specifies a
* deterministic ordering of `EventPlugin`s. A convenient way to reason about
* plugins, without having to package every one of them. This is better than
* having plugins be ordered in the same order that they are injected because
* that ordering would be influenced by the packaging order.
* `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
* preventing default on events is convenient in `SimpleEventPlugin` handlers.
*/
var DefaultEventPluginOrder = [keyOf({ ResponderEventPlugin: null }), keyOf({ SimpleEventPlugin: null }), keyOf({ TapEventPlugin: null }), keyOf({ EnterLeaveEventPlugin: null }), keyOf({ ChangeEventPlugin: null }), keyOf({ SelectEventPlugin: null }), keyOf({ BeforeInputEventPlugin: null })];
module.exports = DefaultEventPluginOrder;
},{"fbjs/lib/keyOf":155}],20:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule EnterLeaveEventPlugin
* @typechecks static-only
*/
'use strict';
var EventConstants = require('./EventConstants');
var EventPropagators = require('./EventPropagators');
var SyntheticMouseEvent = require('./SyntheticMouseEvent');
var ReactMount = require('./ReactMount');
var keyOf = require('fbjs/lib/keyOf');
var topLevelTypes = EventConstants.topLevelTypes;
var getFirstReactDOM = ReactMount.getFirstReactDOM;
var eventTypes = {
mouseEnter: {
registrationName: keyOf({ onMouseEnter: null }),
dependencies: [topLevelTypes.topMouseOut, topLevelTypes.topMouseOver]
},
mouseLeave: {
registrationName: keyOf({ onMouseLeave: null }),
dependencies: [topLevelTypes.topMouseOut, topLevelTypes.topMouseOver]
}
};
var extractedEvents = [null, null];
var EnterLeaveEventPlugin = {
eventTypes: eventTypes,
/**
* For almost every interaction we care about, there will be both a top-level
* `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that
* we do not extract duplicate events. However, moving the mouse into the
* browser from outside will not fire a `mouseout` event. In this case, we use
* the `mouseover` top-level event.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
if (topLevelType === topLevelTypes.topMouseOver && (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
return null;
}
if (topLevelType !== topLevelTypes.topMouseOut && topLevelType !== topLevelTypes.topMouseOver) {
// Must not be a mouse in or mouse out - ignoring.
return null;
}
var win;
if (topLevelTarget.window === topLevelTarget) {
// `topLevelTarget` is probably a window object.
win = topLevelTarget;
} else {
// TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
var doc = topLevelTarget.ownerDocument;
if (doc) {
win = doc.defaultView || doc.parentWindow;
} else {
win = window;
}
}
var from;
var to;
var fromID = '';
var toID = '';
if (topLevelType === topLevelTypes.topMouseOut) {
from = topLevelTarget;
fromID = topLevelTargetID;
to = getFirstReactDOM(nativeEvent.relatedTarget || nativeEvent.toElement);
if (to) {
toID = ReactMount.getID(to);
} else {
to = win;
}
to = to || win;
} else {
from = win;
to = topLevelTarget;
toID = topLevelTargetID;
}
if (from === to) {
// Nothing pertains to our managed components.
return null;
}
var leave = SyntheticMouseEvent.getPooled(eventTypes.mouseLeave, fromID, nativeEvent, nativeEventTarget);
leave.type = 'mouseleave';
leave.target = from;
leave.relatedTarget = to;
var enter = SyntheticMouseEvent.getPooled(eventTypes.mouseEnter, toID, nativeEvent, nativeEventTarget);
enter.type = 'mouseenter';
enter.target = to;
enter.relatedTarget = from;
EventPropagators.accumulateEnterLeaveDispatches(leave, enter, fromID, toID);
extractedEvents[0] = leave;
extractedEvents[1] = enter;
return extractedEvents;
}
};
module.exports = EnterLeaveEventPlugin;
},{"./EventConstants":21,"./EventPropagators":25,"./ReactMount":72,"./SyntheticMouseEvent":103,"fbjs/lib/keyOf":155}],21:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule EventConstants
*/
'use strict';
var keyMirror = require('fbjs/lib/keyMirror');
var PropagationPhases = keyMirror({ bubbled: null, captured: null });
/**
* Types of raw signals from the browser caught at the top level.
*/
var topLevelTypes = keyMirror({
topAbort: null,
topBlur: null,
topCanPlay: null,
topCanPlayThrough: null,
topChange: null,
topClick: null,
topCompositionEnd: null,
topCompositionStart: null,
topCompositionUpdate: null,
topContextMenu: null,
topCopy: null,
topCut: null,
topDoubleClick: null,
topDrag: null,
topDragEnd: null,
topDragEnter: null,
topDragExit: null,
topDragLeave: null,
topDragOver: null,
topDragStart: null,
topDrop: null,
topDurationChange: null,
topEmptied: null,
topEncrypted: null,
topEnded: null,
topError: null,
topFocus: null,
topInput: null,
topKeyDown: null,
topKeyPress: null,
topKeyUp: null,
topLoad: null,
topLoadedData: null,
topLoadedMetadata: null,
topLoadStart: null,
topMouseDown: null,
topMouseMove: null,
topMouseOut: null,
topMouseOver: null,
topMouseUp: null,
topPaste: null,
topPause: null,
topPlay: null,
topPlaying: null,
topProgress: null,
topRateChange: null,
topReset: null,
topScroll: null,
topSeeked: null,
topSeeking: null,
topSelectionChange: null,
topStalled: null,
topSubmit: null,
topSuspend: null,
topTextInput: null,
topTimeUpdate: null,
topTouchCancel: null,
topTouchEnd: null,
topTouchMove: null,
topTouchStart: null,
topVolumeChange: null,
topWaiting: null,
topWheel: null
});
var EventConstants = {
topLevelTypes: topLevelTypes,
PropagationPhases: PropagationPhases
};
module.exports = EventConstants;
},{"fbjs/lib/keyMirror":154}],22:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule EventPluginHub
*/
'use strict';
var EventPluginRegistry = require('./EventPluginRegistry');
var EventPluginUtils = require('./EventPluginUtils');
var ReactErrorUtils = require('./ReactErrorUtils');
var accumulateInto = require('./accumulateInto');
var forEachAccumulated = require('./forEachAccumulated');
var invariant = require('fbjs/lib/invariant');
var warning = require('fbjs/lib/warning');
/**
* Internal store for event listeners
*/
var listenerBank = {};
/**
* Internal queue of events that have accumulated their dispatches and are
* waiting to have their dispatches executed.
*/
var eventQueue = null;
/**
* Dispatches an event and releases it back into the pool, unless persistent.
*
* @param {?object} event Synthetic event to be dispatched.
* @param {boolean} simulated If the event is simulated (changes exn behavior)
* @private
*/
var executeDispatchesAndRelease = function (event, simulated) {
if (event) {
EventPluginUtils.executeDispatchesInOrder(event, simulated);
if (!event.isPersistent()) {
event.constructor.release(event);
}
}
};
var executeDispatchesAndReleaseSimulated = function (e) {
return executeDispatchesAndRelease(e, true);
};
var executeDispatchesAndReleaseTopLevel = function (e) {
return executeDispatchesAndRelease(e, false);
};
/**
* - `InstanceHandle`: [required] Module that performs logical traversals of DOM
* hierarchy given ids of the logical DOM elements involved.
*/
var InstanceHandle = null;
function validateInstanceHandle() {
var valid = InstanceHandle && InstanceHandle.traverseTwoPhase && InstanceHandle.traverseEnterLeave;
process.env.NODE_ENV !== 'production' ? warning(valid, 'InstanceHandle not injected before use!') : undefined;
}
/**
* This is a unified interface for event plugins to be installed and configured.
*
* Event plugins can implement the following properties:
*
* `extractEvents` {function(string, DOMEventTarget, string, object): *}
* Required. When a top-level event is fired, this method is expected to
* extract synthetic events that will in turn be queued and dispatched.
*
* `eventTypes` {object}
* Optional, plugins that fire events must publish a mapping of registration
* names that are used to register listeners. Values of this mapping must
* be objects that contain `registrationName` or `phasedRegistrationNames`.
*
* `executeDispatch` {function(object, function, string)}
* Optional, allows plugins to override how an event gets dispatched. By
* default, the listener is simply invoked.
*
* Each plugin that is injected into `EventsPluginHub` is immediately operable.
*
* @public
*/
var EventPluginHub = {
/**
* Methods for injecting dependencies.
*/
injection: {
/**
* @param {object} InjectedMount
* @public
*/
injectMount: EventPluginUtils.injection.injectMount,
/**
* @param {object} InjectedInstanceHandle
* @public
*/
injectInstanceHandle: function (InjectedInstanceHandle) {
InstanceHandle = InjectedInstanceHandle;
if (process.env.NODE_ENV !== 'production') {
validateInstanceHandle();
}
},
getInstanceHandle: function () {
if (process.env.NODE_ENV !== 'production') {
validateInstanceHandle();
}
return InstanceHandle;
},
/**
* @param {array} InjectedEventPluginOrder
* @public
*/
injectEventPluginOrder: EventPluginRegistry.injectEventPluginOrder,
/**
* @param {object} injectedNamesToPlugins Map from names to plugin modules.
*/
injectEventPluginsByName: EventPluginRegistry.injectEventPluginsByName
},
eventNameDispatchConfigs: EventPluginRegistry.eventNameDispatchConfigs,
registrationNameModules: EventPluginRegistry.registrationNameModules,
/**
* Stores `listener` at `listenerBank[registrationName][id]`. Is idempotent.
*
* @param {string} id ID of the DOM element.
* @param {string} registrationName Name of listener (e.g. `onClick`).
* @param {?function} listener The callback to store.
*/
putListener: function (id, registrationName, listener) {
!(typeof listener === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected %s listener to be a function, instead got type %s', registrationName, typeof listener) : invariant(false) : undefined;
var bankForRegistrationName = listenerBank[registrationName] || (listenerBank[registrationName] = {});
bankForRegistrationName[id] = listener;
var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
if (PluginModule && PluginModule.didPutListener) {
PluginModule.didPutListener(id, registrationName, listener);
}
},
/**
* @param {string} id ID of the DOM element.
* @param {string} registrationName Name of listener (e.g. `onClick`).
* @return {?function} The stored callback.
*/
getListener: function (id, registrationName) {
var bankForRegistrationName = listenerBank[registrationName];
return bankForRegistrationName && bankForRegistrationName[id];
},
/**
* Deletes a listener from the registration bank.
*
* @param {string} id ID of the DOM element.
* @param {string} registrationName Name of listener (e.g. `onClick`).
*/
deleteListener: function (id, registrationName) {
var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
if (PluginModule && PluginModule.willDeleteListener) {
PluginModule.willDeleteListener(id, registrationName);
}
var bankForRegistrationName = listenerBank[registrationName];
// TODO: This should never be null -- when is it?
if (bankForRegistrationName) {
delete bankForRegistrationName[id];
}
},
/**
* Deletes all listeners for the DOM element with the supplied ID.
*
* @param {string} id ID of the DOM element.
*/
deleteAllListeners: function (id) {
for (var registrationName in listenerBank) {
if (!listenerBank[registrationName][id]) {
continue;
}
var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
if (PluginModule && PluginModule.willDeleteListener) {
PluginModule.willDeleteListener(id, registrationName);
}
delete listenerBank[registrationName][id];
}
},
/**
* Allows registered plugins an opportunity to extract events from top-level
* native browser events.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {*} An accumulation of synthetic events.
* @internal
*/
extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
var events;
var plugins = EventPluginRegistry.plugins;
for (var i = 0; i < plugins.length; i++) {
// Not every plugin in the ordering may be loaded at runtime.
var possiblePlugin = plugins[i];
if (possiblePlugin) {
var extractedEvents = possiblePlugin.extractEvents(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget);
if (extractedEvents) {
events = accumulateInto(events, extractedEvents);
}
}
}
return events;
},
/**
* Enqueues a synthetic event that should be dispatched when
* `processEventQueue` is invoked.
*
* @param {*} events An accumulation of synthetic events.
* @internal
*/
enqueueEvents: function (events) {
if (events) {
eventQueue = accumulateInto(eventQueue, events);
}
},
/**
* Dispatches all synthetic events on the event queue.
*
* @internal
*/
processEventQueue: function (simulated) {
// Set `eventQueue` to null before processing it so that we can tell if more
// events get enqueued while processing.
var processingEventQueue = eventQueue;
eventQueue = null;
if (simulated) {
forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseSimulated);
} else {
forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel);
}
!!eventQueue ? process.env.NODE_ENV !== 'production' ? invariant(false, 'processEventQueue(): Additional events were enqueued while processing ' + 'an event queue. Support for this has not yet been implemented.') : invariant(false) : undefined;
// This would be a good time to rethrow if any of the event handlers threw.
ReactErrorUtils.rethrowCaughtError();
},
/**
* These are needed for tests only. Do not use!
*/
__purge: function () {
listenerBank = {};
},
__getListenerBank: function () {
return listenerBank;
}
};
module.exports = EventPluginHub;
}).call(this,require('_process'))
},{"./EventPluginRegistry":23,"./EventPluginUtils":24,"./ReactErrorUtils":63,"./accumulateInto":109,"./forEachAccumulated":117,"_process":164,"fbjs/lib/invariant":151,"fbjs/lib/warning":162}],23:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule EventPluginRegistry
* @typechecks static-only
*/
'use strict';
var invariant = require('fbjs/lib/invariant');
/**
* Injectable ordering of event plugins.
*/
var EventPluginOrder = null;
/**
* Injectable mapping from names to event plugin modules.
*/
var namesToPlugins = {};
/**
* Recomputes the plugin list using the injected plugins and plugin ordering.
*
* @private
*/
function recomputePluginOrdering() {
if (!EventPluginOrder) {
// Wait until an `EventPluginOrder` is injected.
return;
}
for (var pluginName in namesToPlugins) {
var PluginModule = namesToPlugins[pluginName];
var pluginIndex = EventPluginOrder.indexOf(pluginName);
!(pluginIndex > -1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in ' + 'the plugin ordering, `%s`.', pluginName) : invariant(false) : undefined;
if (EventPluginRegistry.plugins[pluginIndex]) {
continue;
}
!PluginModule.extractEvents ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` ' + 'method, but `%s` does not.', pluginName) : invariant(false) : undefined;
EventPluginRegistry.plugins[pluginIndex] = PluginModule;
var publishedEvents = PluginModule.eventTypes;
for (var eventName in publishedEvents) {
!publishEventForPlugin(publishedEvents[eventName], PluginModule, eventName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : invariant(false) : undefined;
}
}
}
/**
* Publishes an event so that it can be dispatched by the supplied plugin.
*
* @param {object} dispatchConfig Dispatch configuration for the event.
* @param {object} PluginModule Plugin publishing the event.
* @return {boolean} True if the event was successfully published.
* @private
*/
function publishEventForPlugin(dispatchConfig, PluginModule, eventName) {
!!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same ' + 'event name, `%s`.', eventName) : invariant(false) : undefined;
EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig;
var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
if (phasedRegistrationNames) {
for (var phaseName in phasedRegistrationNames) {
if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
var phasedRegistrationName = phasedRegistrationNames[phaseName];
publishRegistrationName(phasedRegistrationName, PluginModule, eventName);
}
}
return true;
} else if (dispatchConfig.registrationName) {
publishRegistrationName(dispatchConfig.registrationName, PluginModule, eventName);
return true;
}
return false;
}
/**
* Publishes a registration name that is used to identify dispatched events and
* can be used with `EventPluginHub.putListener` to register listeners.
*
* @param {string} registrationName Registration name to add.
* @param {object} PluginModule Plugin publishing the event.
* @private
*/
function publishRegistrationName(registrationName, PluginModule, eventName) {
!!EventPluginRegistry.registrationNameModules[registrationName] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same ' + 'registration name, `%s`.', registrationName) : invariant(false) : undefined;
EventPluginRegistry.registrationNameModules[registrationName] = PluginModule;
EventPluginRegistry.registrationNameDependencies[registrationName] = PluginModule.eventTypes[eventName].dependencies;
}
/**
* Registers plugins so that they can extract and dispatch events.
*
* @see {EventPluginHub}
*/
var EventPluginRegistry = {
/**
* Ordered list of injected plugins.
*/
plugins: [],
/**
* Mapping from event name to dispatch config
*/
eventNameDispatchConfigs: {},
/**
* Mapping from registration name to plugin module
*/
registrationNameModules: {},
/**
* Mapping from registration name to event name
*/
registrationNameDependencies: {},
/**
* Injects an ordering of plugins (by plugin name). This allows the ordering
* to be decoupled from injection of the actual plugins so that ordering is
* always deterministic regardless of packaging, on-the-fly injection, etc.
*
* @param {array} InjectedEventPluginOrder
* @internal
* @see {EventPluginHub.injection.injectEventPluginOrder}
*/
injectEventPluginOrder: function (InjectedEventPluginOrder) {
!!EventPluginOrder ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than ' + 'once. You are likely trying to load more than one copy of React.') : invariant(false) : undefined;
// Clone the ordering so it cannot be dynamically mutated.
EventPluginOrder = Array.prototype.slice.call(InjectedEventPluginOrder);
recomputePluginOrdering();
},
/**
* Injects plugins to be used by `EventPluginHub`. The plugin names must be
* in the ordering injected by `injectEventPluginOrder`.
*
* Plugins can be injected as part of page initialization or on-the-fly.
*
* @param {object} injectedNamesToPlugins Map from names to plugin modules.
* @internal
* @see {EventPluginHub.injection.injectEventPluginsByName}
*/
injectEventPluginsByName: function (injectedNamesToPlugins) {
var isOrderingDirty = false;
for (var pluginName in injectedNamesToPlugins) {
if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
continue;
}
var PluginModule = injectedNamesToPlugins[pluginName];
if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== PluginModule) {
!!namesToPlugins[pluginName] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins ' + 'using the same name, `%s`.', pluginName) : invariant(false) : undefined;
namesToPlugins[pluginName] = PluginModule;
isOrderingDirty = true;
}
}
if (isOrderingDirty) {
recomputePluginOrdering();
}
},
/**
* Looks up the plugin for the supplied event.
*
* @param {object} event A synthetic event.
* @return {?object} The plugin that created the supplied event.
* @internal
*/
getPluginModuleForEvent: function (event) {
var dispatchConfig = event.dispatchConfig;
if (dispatchConfig.registrationName) {
return EventPluginRegistry.registrationNameModules[dispatchConfig.registrationName] || null;
}
for (var phase in dispatchConfig.phasedRegistrationNames) {
if (!dispatchConfig.phasedRegistrationNames.hasOwnProperty(phase)) {
continue;
}
var PluginModule = EventPluginRegistry.registrationNameModules[dispatchConfig.phasedRegistrationNames[phase]];
if (PluginModule) {
return PluginModule;
}
}
return null;
},
/**
* Exposed for unit testing.
* @private
*/
_resetEventPlugins: function () {
EventPluginOrder = null;
for (var pluginName in namesToPlugins) {
if (namesToPlugins.hasOwnProperty(pluginName)) {
delete namesToPlugins[pluginName];
}
}
EventPluginRegistry.plugins.length = 0;
var eventNameDispatchConfigs = EventPluginRegistry.eventNameDispatchConfigs;
for (var eventName in eventNameDispatchConfigs) {
if (eventNameDispatchConfigs.hasOwnProperty(eventName)) {
delete eventNameDispatchConfigs[eventName];
}
}
var registrationNameModules = EventPluginRegistry.registrationNameModules;
for (var registrationName in registrationNameModules) {
if (registrationNameModules.hasOwnProperty(registrationName)) {
delete registrationNameModules[registrationName];
}
}
}
};
module.exports = EventPluginRegistry;
}).call(this,require('_process'))
},{"_process":164,"fbjs/lib/invariant":151}],24:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule EventPluginUtils
*/
'use strict';
var EventConstants = require('./EventConstants');
var ReactErrorUtils = require('./ReactErrorUtils');
var invariant = require('fbjs/lib/invariant');
var warning = require('fbjs/lib/warning');
/**
* Injected dependencies:
*/
/**
* - `Mount`: [required] Module that can convert between React dom IDs and
* actual node references.
*/
var injection = {
Mount: null,
injectMount: function (InjectedMount) {
injection.Mount = InjectedMount;
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(InjectedMount && InjectedMount.getNode && InjectedMount.getID, 'EventPluginUtils.injection.injectMount(...): Injected Mount ' + 'module is missing getNode or getID.') : undefined;
}
}
};
var topLevelTypes = EventConstants.topLevelTypes;
function isEndish(topLevelType) {
return topLevelType === topLevelTypes.topMouseUp || topLevelType === topLevelTypes.topTouchEnd || topLevelType === topLevelTypes.topTouchCancel;
}
function isMoveish(topLevelType) {
return topLevelType === topLevelTypes.topMouseMove || topLevelType === topLevelTypes.topTouchMove;
}
function isStartish(topLevelType) {
return topLevelType === topLevelTypes.topMouseDown || topLevelType === topLevelTypes.topTouchStart;
}
var validateEventDispatches;
if (process.env.NODE_ENV !== 'production') {
validateEventDispatches = function (event) {
var dispatchListeners = event._dispatchListeners;
var dispatchIDs = event._dispatchIDs;
var listenersIsArr = Array.isArray(dispatchListeners);
var idsIsArr = Array.isArray(dispatchIDs);
var IDsLen = idsIsArr ? dispatchIDs.length : dispatchIDs ? 1 : 0;
var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0;
process.env.NODE_ENV !== 'production' ? warning(idsIsArr === listenersIsArr && IDsLen === listenersLen, 'EventPluginUtils: Invalid `event`.') : undefined;
};
}
/**
* Dispatch the event to the listener.
* @param {SyntheticEvent} event SyntheticEvent to handle
* @param {boolean} simulated If the event is simulated (changes exn behavior)
* @param {function} listener Application-level callback
* @param {string} domID DOM id to pass to the callback.
*/
function executeDispatch(event, simulated, listener, domID) {
var type = event.type || 'unknown-event';
event.currentTarget = injection.Mount.getNode(domID);
if (simulated) {
ReactErrorUtils.invokeGuardedCallbackWithCatch(type, listener, event, domID);
} else {
ReactErrorUtils.invokeGuardedCallback(type, listener, event, domID);
}
event.currentTarget = null;
}
/**
* Standard/simple iteration through an event's collected dispatches.
*/
function executeDispatchesInOrder(event, simulated) {
var dispatchListeners = event._dispatchListeners;
var dispatchIDs = event._dispatchIDs;
if (process.env.NODE_ENV !== 'production') {
validateEventDispatches(event);
}
if (Array.isArray(dispatchListeners)) {
for (var i = 0; i < dispatchListeners.length; i++) {
if (event.isPropagationStopped()) {
break;
}
// Listeners and IDs are two parallel arrays that are always in sync.
executeDispatch(event, simulated, dispatchListeners[i], dispatchIDs[i]);
}
} else if (dispatchListeners) {
executeDispatch(event, simulated, dispatchListeners, dispatchIDs);
}
event._dispatchListeners = null;
event._dispatchIDs = null;
}
/**
* Standard/simple iteration through an event's collected dispatches, but stops
* at the first dispatch execution returning true, and returns that id.
*
* @return {?string} id of the first dispatch execution who's listener returns
* true, or null if no listener returned true.
*/
function executeDispatchesInOrderStopAtTrueImpl(event) {
var dispatchListeners = event._dispatchListeners;
var dispatchIDs = event._dispatchIDs;
if (process.env.NODE_ENV !== 'production') {
validateEventDispatches(event);
}
if (Array.isArray(dispatchListeners)) {
for (var i = 0; i < dispatchListeners.length; i++) {
if (event.isPropagationStopped()) {
break;
}
// Listeners and IDs are two parallel arrays that are always in sync.
if (dispatchListeners[i](event, dispatchIDs[i])) {
return dispatchIDs[i];
}
}
} else if (dispatchListeners) {
if (dispatchListeners(event, dispatchIDs)) {
return dispatchIDs;
}
}
return null;
}
/**
* @see executeDispatchesInOrderStopAtTrueImpl
*/
function executeDispatchesInOrderStopAtTrue(event) {
var ret = executeDispatchesInOrderStopAtTrueImpl(event);
event._dispatchIDs = null;
event._dispatchListeners = null;
return ret;
}
/**
* Execution of a "direct" dispatch - there must be at most one dispatch
* accumulated on the event or it is considered an error. It doesn't really make
* sense for an event with multiple dispatches (bubbled) to keep track of the
* return values at each dispatch execution, but it does tend to make sense when
* dealing with "direct" dispatches.
*
* @return {*} The return value of executing the single dispatch.
*/
function executeDirectDispatch(event) {
if (process.env.NODE_ENV !== 'production') {
validateEventDispatches(event);
}
var dispatchListener = event._dispatchListeners;
var dispatchID = event._dispatchIDs;
!!Array.isArray(dispatchListener) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : invariant(false) : undefined;
var res = dispatchListener ? dispatchListener(event, dispatchID) : null;
event._dispatchListeners = null;
event._dispatchIDs = null;
return res;
}
/**
* @param {SyntheticEvent} event
* @return {boolean} True iff number of dispatches accumulated is greater than 0.
*/
function hasDispatches(event) {
return !!event._dispatchListeners;
}
/**
* General utilities that are useful in creating custom Event Plugins.
*/
var EventPluginUtils = {
isEndish: isEndish,
isMoveish: isMoveish,
isStartish: isStartish,
executeDirectDispatch: executeDirectDispatch,
executeDispatchesInOrder: executeDispatchesInOrder,
executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue,
hasDispatches: hasDispatches,
getNode: function (id) {
return injection.Mount.getNode(id);
},
getID: function (node) {
return injection.Mount.getID(node);
},
injection: injection
};
module.exports = EventPluginUtils;
}).call(this,require('_process'))
},{"./EventConstants":21,"./ReactErrorUtils":63,"_process":164,"fbjs/lib/invariant":151,"fbjs/lib/warning":162}],25:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule EventPropagators
*/
'use strict';
var EventConstants = require('./EventConstants');
var EventPluginHub = require('./EventPluginHub');
var warning = require('fbjs/lib/warning');
var accumulateInto = require('./accumulateInto');
var forEachAccumulated = require('./forEachAccumulated');
var PropagationPhases = EventConstants.PropagationPhases;
var getListener = EventPluginHub.getListener;
/**
* Some event types have a notion of different registration names for different
* "phases" of propagation. This finds listeners by a given phase.
*/
function listenerAtPhase(id, event, propagationPhase) {
var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase];
return getListener(id, registrationName);
}
/**
* Tags a `SyntheticEvent` with dispatched listeners. Creating this function
* here, allows us to not have to bind or create functions for each event.
* Mutating the event's members allows us to not have to create a wrapping
* "dispatch" object that pairs the event with the listener.
*/
function accumulateDirectionalDispatches(domID, upwards, event) {
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(domID, 'Dispatching id must not be null') : undefined;
}
var phase = upwards ? PropagationPhases.bubbled : PropagationPhases.captured;
var listener = listenerAtPhase(domID, event, phase);
if (listener) {
event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
event._dispatchIDs = accumulateInto(event._dispatchIDs, domID);
}
}
/**
* Collect dispatches (must be entirely collected before dispatching - see unit
* tests). Lazily allocate the array to conserve memory. We must loop through
* each event and perform the traversal for each one. We cannot perform a
* single traversal for the entire collection of events because each event may
* have a different target.
*/
function accumulateTwoPhaseDispatchesSingle(event) {
if (event && event.dispatchConfig.phasedRegistrationNames) {
EventPluginHub.injection.getInstanceHandle().traverseTwoPhase(event.dispatchMarker, accumulateDirectionalDispatches, event);
}
}
/**
* Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID.
*/
function accumulateTwoPhaseDispatchesSingleSkipTarget(event) {
if (event && event.dispatchConfig.phasedRegistrationNames) {
EventPluginHub.injection.getInstanceHandle().traverseTwoPhaseSkipTarget(event.dispatchMarker, accumulateDirectionalDispatches, event);
}
}
/**
* Accumulates without regard to direction, does not look for phased
* registration names. Same as `accumulateDirectDispatchesSingle` but without
* requiring that the `dispatchMarker` be the same as the dispatched ID.
*/
function accumulateDispatches(id, ignoredDirection, event) {
if (event && event.dispatchConfig.registrationName) {
var registrationName = event.dispatchConfig.registrationName;
var listener = getListener(id, registrationName);
if (listener) {
event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
event._dispatchIDs = accumulateInto(event._dispatchIDs, id);
}
}
}
/**
* Accumulates dispatches on an `SyntheticEvent`, but only for the
* `dispatchMarker`.
* @param {SyntheticEvent} event
*/
function accumulateDirectDispatchesSingle(event) {
if (event && event.dispatchConfig.registrationName) {
accumulateDispatches(event.dispatchMarker, null, event);
}
}
function accumulateTwoPhaseDispatches(events) {
forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
}
function accumulateTwoPhaseDispatchesSkipTarget(events) {
forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget);
}
function accumulateEnterLeaveDispatches(leave, enter, fromID, toID) {
EventPluginHub.injection.getInstanceHandle().traverseEnterLeave(fromID, toID, accumulateDispatches, leave, enter);
}
function accumulateDirectDispatches(events) {
forEachAccumulated(events, accumulateDirectDispatchesSingle);
}
/**
* A small set of propagation patterns, each of which will accept a small amount
* of information, and generate a set of "dispatch ready event objects" - which
* are sets of events that have already been annotated with a set of dispatched
* listener functions/ids. The API is designed this way to discourage these
* propagation strategies from actually executing the dispatches, since we
* always want to collect the entire set of dispatches before executing event a
* single one.
*
* @constructor EventPropagators
*/
var EventPropagators = {
accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches,
accumulateTwoPhaseDispatchesSkipTarget: accumulateTwoPhaseDispatchesSkipTarget,
accumulateDirectDispatches: accumulateDirectDispatches,
accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches
};
module.exports = EventPropagators;
}).call(this,require('_process'))
},{"./EventConstants":21,"./EventPluginHub":22,"./accumulateInto":109,"./forEachAccumulated":117,"_process":164,"fbjs/lib/warning":162}],26:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule FallbackCompositionState
* @typechecks static-only
*/
'use strict';
var PooledClass = require('./PooledClass');
var assign = require('./Object.assign');
var getTextContentAccessor = require('./getTextContentAccessor');
/**
* This helper class stores information about text content of a target node,
* allowing comparison of content before and after a given event.
*
* Identify the node where selection currently begins, then observe
* both its text content and its current position in the DOM. Since the
* browser may natively replace the target node during composition, we can
* use its position to find its replacement.
*
* @param {DOMEventTarget} root
*/
function FallbackCompositionState(root) {
this._root = root;
this._startText = this.getText();
this._fallbackText = null;
}
assign(FallbackCompositionState.prototype, {
destructor: function () {
this._root = null;
this._startText = null;
this._fallbackText = null;
},
/**
* Get current text of input.
*
* @return {string}
*/
getText: function () {
if ('value' in this._root) {
return this._root.value;
}
return this._root[getTextContentAccessor()];
},
/**
* Determine the differing substring between the initially stored
* text content and the current content.
*
* @return {string}
*/
getData: function () {
if (this._fallbackText) {
return this._fallbackText;
}
var start;
var startValue = this._startText;
var startLength = startValue.length;
var end;
var endValue = this.getText();
var endLength = endValue.length;
for (start = 0; start < startLength; start++) {
if (startValue[start] !== endValue[start]) {
break;
}
}
var minEnd = startLength - start;
for (end = 1; end <= minEnd; end++) {
if (startValue[startLength - end] !== endValue[endLength - end]) {
break;
}
}
var sliceTail = end > 1 ? 1 - end : undefined;
this._fallbackText = endValue.slice(start, sliceTail);
return this._fallbackText;
}
});
PooledClass.addPoolingTo(FallbackCompositionState);
module.exports = FallbackCompositionState;
},{"./Object.assign":29,"./PooledClass":30,"./getTextContentAccessor":124}],27:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule HTMLDOMPropertyConfig
*/
'use strict';
var DOMProperty = require('./DOMProperty');
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;
var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE;
var HAS_SIDE_EFFECTS = DOMProperty.injection.HAS_SIDE_EFFECTS;
var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE;
var HAS_POSITIVE_NUMERIC_VALUE = DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE;
var HAS_OVERLOADED_BOOLEAN_VALUE = DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE;
var hasSVG;
if (ExecutionEnvironment.canUseDOM) {
var implementation = document.implementation;
hasSVG = implementation && implementation.hasFeature && implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#BasicStructure', '1.1');
}
var HTMLDOMPropertyConfig = {
isCustomAttribute: RegExp.prototype.test.bind(/^(data|aria)-[a-z_][a-z\d_.\-]*$/),
Properties: {
/**
* Standard Properties
*/
accept: null,
acceptCharset: null,
accessKey: null,
action: null,
allowFullScreen: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
allowTransparency: MUST_USE_ATTRIBUTE,
alt: null,
async: HAS_BOOLEAN_VALUE,
autoComplete: null,
// autoFocus is polyfilled/normalized by AutoFocusUtils
// autoFocus: HAS_BOOLEAN_VALUE,
autoPlay: HAS_BOOLEAN_VALUE,
capture: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
cellPadding: null,
cellSpacing: null,
charSet: MUST_USE_ATTRIBUTE,
challenge: MUST_USE_ATTRIBUTE,
checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
classID: MUST_USE_ATTRIBUTE,
// To set className on SVG elements, it's necessary to use .setAttribute;
// this works on HTML elements too in all browsers except IE8. Conveniently,
// IE8 doesn't support SVG and so we can simply use the attribute in
// browsers that support SVG and the property in browsers that don't,
// regardless of whether the element is HTML or SVG.
className: hasSVG ? MUST_USE_ATTRIBUTE : MUST_USE_PROPERTY,
cols: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
colSpan: null,
content: null,
contentEditable: null,
contextMenu: MUST_USE_ATTRIBUTE,
controls: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
coords: null,
crossOrigin: null,
data: null, // For `<object />` acts as `src`.
dateTime: MUST_USE_ATTRIBUTE,
'default': HAS_BOOLEAN_VALUE,
defer: HAS_BOOLEAN_VALUE,
dir: null,
disabled: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
download: HAS_OVERLOADED_BOOLEAN_VALUE,
draggable: null,
encType: null,
form: MUST_USE_ATTRIBUTE,
formAction: MUST_USE_ATTRIBUTE,
formEncType: MUST_USE_ATTRIBUTE,
formMethod: MUST_USE_ATTRIBUTE,
formNoValidate: HAS_BOOLEAN_VALUE,
formTarget: MUST_USE_ATTRIBUTE,
frameBorder: MUST_USE_ATTRIBUTE,
headers: null,
height: MUST_USE_ATTRIBUTE,
hidden: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
high: null,
href: null,
hrefLang: null,
htmlFor: null,
httpEquiv: null,
icon: null,
id: MUST_USE_PROPERTY,
inputMode: MUST_USE_ATTRIBUTE,
integrity: null,
is: MUST_USE_ATTRIBUTE,
keyParams: MUST_USE_ATTRIBUTE,
keyType: MUST_USE_ATTRIBUTE,
kind: null,
label: null,
lang: null,
list: MUST_USE_ATTRIBUTE,
loop: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
low: null,
manifest: MUST_USE_ATTRIBUTE,
marginHeight: null,
marginWidth: null,
max: null,
maxLength: MUST_USE_ATTRIBUTE,
media: MUST_USE_ATTRIBUTE,
mediaGroup: null,
method: null,
min: null,
minLength: MUST_USE_ATTRIBUTE,
multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
name: null,
nonce: MUST_USE_ATTRIBUTE,
noValidate: HAS_BOOLEAN_VALUE,
open: HAS_BOOLEAN_VALUE,
optimum: null,
pattern: null,
placeholder: null,
poster: null,
preload: null,
radioGroup: null,
readOnly: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
rel: null,
required: HAS_BOOLEAN_VALUE,
reversed: HAS_BOOLEAN_VALUE,
role: MUST_USE_ATTRIBUTE,
rows: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
rowSpan: null,
sandbox: null,
scope: null,
scoped: HAS_BOOLEAN_VALUE,
scrolling: null,
seamless: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
shape: null,
size: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
sizes: MUST_USE_ATTRIBUTE,
span: HAS_POSITIVE_NUMERIC_VALUE,
spellCheck: null,
src: null,
srcDoc: MUST_USE_PROPERTY,
srcLang: null,
srcSet: MUST_USE_ATTRIBUTE,
start: HAS_NUMERIC_VALUE,
step: null,
style: null,
summary: null,
tabIndex: null,
target: null,
title: null,
type: null,
useMap: null,
value: MUST_USE_PROPERTY | HAS_SIDE_EFFECTS,
width: MUST_USE_ATTRIBUTE,
wmode: MUST_USE_ATTRIBUTE,
wrap: null,
/**
* RDFa Properties
*/
about: MUST_USE_ATTRIBUTE,
datatype: MUST_USE_ATTRIBUTE,
inlist: MUST_USE_ATTRIBUTE,
prefix: MUST_USE_ATTRIBUTE,
// property is also supported for OpenGraph in meta tags.
property: MUST_USE_ATTRIBUTE,
resource: MUST_USE_ATTRIBUTE,
'typeof': MUST_USE_ATTRIBUTE,
vocab: MUST_USE_ATTRIBUTE,
/**
* Non-standard Properties
*/
// autoCapitalize and autoCorrect are supported in Mobile Safari for
// keyboard hints.
autoCapitalize: MUST_USE_ATTRIBUTE,
autoCorrect: MUST_USE_ATTRIBUTE,
// autoSave allows WebKit/Blink to persist values of input fields on page reloads
autoSave: null,
// color is for Safari mask-icon link
color: null,
// itemProp, itemScope, itemType are for
// Microdata support. See http://schema.org/docs/gs.html
itemProp: MUST_USE_ATTRIBUTE,
itemScope: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
itemType: MUST_USE_ATTRIBUTE,
// itemID and itemRef are for Microdata support as well but
// only specified in the the WHATWG spec document. See
// https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api
itemID: MUST_USE_ATTRIBUTE,
itemRef: MUST_USE_ATTRIBUTE,
// results show looking glass icon and recent searches on input
// search fields in WebKit/Blink
results: null,
// IE-only attribute that specifies security restrictions on an iframe
// as an alternative to the sandbox attribute on IE<10
security: MUST_USE_ATTRIBUTE,
// IE-only attribute that controls focus behavior
unselectable: MUST_USE_ATTRIBUTE
},
DOMAttributeNames: {
acceptCharset: 'accept-charset',
className: 'class',
htmlFor: 'for',
httpEquiv: 'http-equiv'
},
DOMPropertyNames: {
autoComplete: 'autocomplete',
autoFocus: 'autofocus',
autoPlay: 'autoplay',
autoSave: 'autosave',
// `encoding` is equivalent to `enctype`, IE8 lacks an `enctype` setter.
// http://www.w3.org/TR/html5/forms.html#dom-fs-encoding
encType: 'encoding',
hrefLang: 'hreflang',
radioGroup: 'radiogroup',
spellCheck: 'spellcheck',
srcDoc: 'srcdoc',
srcSet: 'srcset'
}
};
module.exports = HTMLDOMPropertyConfig;
},{"./DOMProperty":16,"fbjs/lib/ExecutionEnvironment":137}],28:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule LinkedValueUtils
* @typechecks static-only
*/
'use strict';
var ReactPropTypes = require('./ReactPropTypes');
var ReactPropTypeLocations = require('./ReactPropTypeLocations');
var invariant = require('fbjs/lib/invariant');
var warning = require('fbjs/lib/warning');
var hasReadOnlyValue = {
'button': true,
'checkbox': true,
'image': true,
'hidden': true,
'radio': true,
'reset': true,
'submit': true
};
function _assertSingleLink(inputProps) {
!(inputProps.checkedLink == null || inputProps.valueLink == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a valueLink. If you want to use ' + 'checkedLink, you probably don\'t want to use valueLink and vice versa.') : invariant(false) : undefined;
}
function _assertValueLink(inputProps) {
_assertSingleLink(inputProps);
!(inputProps.value == null && inputProps.onChange == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a valueLink and a value or onChange event. If you want ' + 'to use value or onChange, you probably don\'t want to use valueLink.') : invariant(false) : undefined;
}
function _assertCheckedLink(inputProps) {
_assertSingleLink(inputProps);
!(inputProps.checked == null && inputProps.onChange == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a checked property or onChange event. ' + 'If you want to use checked or onChange, you probably don\'t want to ' + 'use checkedLink') : invariant(false) : undefined;
}
var propTypes = {
value: function (props, propName, componentName) {
if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) {
return null;
}
return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
},
checked: function (props, propName, componentName) {
if (!props[propName] || props.onChange || props.readOnly || props.disabled) {
return null;
}
return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
},
onChange: ReactPropTypes.func
};
var loggedTypeFailures = {};
function getDeclarationErrorAddendum(owner) {
if (owner) {
var name = owner.getName();
if (name) {
return ' Check the render method of `' + name + '`.';
}
}
return '';
}
/**
* Provide a linked `value` attribute for controlled forms. You should not use
* this outside of the ReactDOM controlled form components.
*/
var LinkedValueUtils = {
checkPropTypes: function (tagName, props, owner) {
for (var propName in propTypes) {
if (propTypes.hasOwnProperty(propName)) {
var error = propTypes[propName](props, propName, tagName, ReactPropTypeLocations.prop);
}
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
// Only monitor this failure once because there tends to be a lot of the
// same error.
loggedTypeFailures[error.message] = true;
var addendum = getDeclarationErrorAddendum(owner);
process.env.NODE_ENV !== 'production' ? warning(false, 'Failed form propType: %s%s', error.message, addendum) : undefined;
}
}
},
/**
* @param {object} inputProps Props for form component
* @return {*} current value of the input either from value prop or link.
*/
getValue: function (inputProps) {
if (inputProps.valueLink) {
_assertValueLink(inputProps);
return inputProps.valueLink.value;
}
return inputProps.value;
},
/**
* @param {object} inputProps Props for form component
* @return {*} current checked status of the input either from checked prop
* or link.
*/
getChecked: function (inputProps) {
if (inputProps.checkedLink) {
_assertCheckedLink(inputProps);
return inputProps.checkedLink.value;
}
return inputProps.checked;
},
/**
* @param {object} inputProps Props for form component
* @param {SyntheticEvent} event change event to handle
*/
executeOnChange: function (inputProps, event) {
if (inputProps.valueLink) {
_assertValueLink(inputProps);
return inputProps.valueLink.requestChange(event.target.value);
} else if (inputProps.checkedLink) {
_assertCheckedLink(inputProps);
return inputProps.checkedLink.requestChange(event.target.checked);
} else if (inputProps.onChange) {
return inputProps.onChange.call(undefined, event);
}
}
};
module.exports = LinkedValueUtils;
}).call(this,require('_process'))
},{"./ReactPropTypeLocations":80,"./ReactPropTypes":81,"_process":164,"fbjs/lib/invariant":151,"fbjs/lib/warning":162}],29:[function(require,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule Object.assign
*/
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign
'use strict';
function assign(target, sources) {
if (target == null) {
throw new TypeError('Object.assign target cannot be null or undefined');
}
var to = Object(target);
var hasOwnProperty = Object.prototype.hasOwnProperty;
for (var nextIndex = 1; nextIndex < arguments.length; nextIndex++) {
var nextSource = arguments[nextIndex];
if (nextSource == null) {
continue;
}
var from = Object(nextSource);
// We don't currently support accessors nor proxies. Therefore this
// copy cannot throw. If we ever supported this then we must handle
// exceptions and side-effects. We don't support symbols so they won't
// be transferred.
for (var key in from) {
if (hasOwnProperty.call(from, key)) {
to[key] = from[key];
}
}
}
return to;
}
module.exports = assign;
},{}],30:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule PooledClass
*/
'use strict';
var invariant = require('fbjs/lib/invariant');
/**
* Static poolers. Several custom versions for each potential number of
* arguments. A completely generic pooler is easy to implement, but would
* require accessing the `arguments` object. In each of these, `this` refers to
* the Class itself, not an instance. If any others are needed, simply add them
* here, or in their own files.
*/
var oneArgumentPooler = function (copyFieldsFrom) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
Klass.call(instance, copyFieldsFrom);
return instance;
} else {
return new Klass(copyFieldsFrom);
}
};
var twoArgumentPooler = function (a1, a2) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
Klass.call(instance, a1, a2);
return instance;
} else {
return new Klass(a1, a2);
}
};
var threeArgumentPooler = function (a1, a2, a3) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
Klass.call(instance, a1, a2, a3);
return instance;
} else {
return new Klass(a1, a2, a3);
}
};
var fourArgumentPooler = function (a1, a2, a3, a4) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
Klass.call(instance, a1, a2, a3, a4);
return instance;
} else {
return new Klass(a1, a2, a3, a4);
}
};
var fiveArgumentPooler = function (a1, a2, a3, a4, a5) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
Klass.call(instance, a1, a2, a3, a4, a5);
return instance;
} else {
return new Klass(a1, a2, a3, a4, a5);
}
};
var standardReleaser = function (instance) {
var Klass = this;
!(instance instanceof Klass) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : invariant(false) : undefined;
instance.destructor();
if (Klass.instancePool.length < Klass.poolSize) {
Klass.instancePool.push(instance);
}
};
var DEFAULT_POOL_SIZE = 10;
var DEFAULT_POOLER = oneArgumentPooler;
/**
* Augments `CopyConstructor` to be a poolable class, augmenting only the class
* itself (statically) not adding any prototypical fields. Any CopyConstructor
* you give this may have a `poolSize` property, and will look for a
* prototypical `destructor` on instances (optional).
*
* @param {Function} CopyConstructor Constructor that can be used to reset.
* @param {Function} pooler Customizable pooler.
*/
var addPoolingTo = function (CopyConstructor, pooler) {
var NewKlass = CopyConstructor;
NewKlass.instancePool = [];
NewKlass.getPooled = pooler || DEFAULT_POOLER;
if (!NewKlass.poolSize) {
NewKlass.poolSize = DEFAULT_POOL_SIZE;
}
NewKlass.release = standardReleaser;
return NewKlass;
};
var PooledClass = {
addPoolingTo: addPoolingTo,
oneArgumentPooler: oneArgumentPooler,
twoArgumentPooler: twoArgumentPooler,
threeArgumentPooler: threeArgumentPooler,
fourArgumentPooler: fourArgumentPooler,
fiveArgumentPooler: fiveArgumentPooler
};
module.exports = PooledClass;
}).call(this,require('_process'))
},{"_process":164,"fbjs/lib/invariant":151}],31:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule React
*/
'use strict';
var ReactDOM = require('./ReactDOM');
var ReactDOMServer = require('./ReactDOMServer');
var ReactIsomorphic = require('./ReactIsomorphic');
var assign = require('./Object.assign');
var deprecated = require('./deprecated');
// `version` will be added here by ReactIsomorphic.
var React = {};
assign(React, ReactIsomorphic);
assign(React, {
// ReactDOM
findDOMNode: deprecated('findDOMNode', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.findDOMNode),
render: deprecated('render', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.render),
unmountComponentAtNode: deprecated('unmountComponentAtNode', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.unmountComponentAtNode),
// ReactDOMServer
renderToString: deprecated('renderToString', 'ReactDOMServer', 'react-dom/server', ReactDOMServer, ReactDOMServer.renderToString),
renderToStaticMarkup: deprecated('renderToStaticMarkup', 'ReactDOMServer', 'react-dom/server', ReactDOMServer, ReactDOMServer.renderToStaticMarkup)
});
React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOM;
React.__SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOMServer;
module.exports = React;
},{"./Object.assign":29,"./ReactDOM":42,"./ReactDOMServer":52,"./ReactIsomorphic":70,"./deprecated":113}],32:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactBrowserComponentMixin
*/
'use strict';
var ReactInstanceMap = require('./ReactInstanceMap');
var findDOMNode = require('./findDOMNode');
var warning = require('fbjs/lib/warning');
var didWarnKey = '_getDOMNodeDidWarn';
var ReactBrowserComponentMixin = {
/**
* Returns the DOM node rendered by this component.
*
* @return {DOMElement} The root node of this component.
* @final
* @protected
*/
getDOMNode: function () {
process.env.NODE_ENV !== 'production' ? warning(this.constructor[didWarnKey], '%s.getDOMNode(...) is deprecated. Please use ' + 'ReactDOM.findDOMNode(instance) instead.', ReactInstanceMap.get(this).getName() || this.tagName || 'Unknown') : undefined;
this.constructor[didWarnKey] = true;
return findDOMNode(this);
}
};
module.exports = ReactBrowserComponentMixin;
}).call(this,require('_process'))
},{"./ReactInstanceMap":69,"./findDOMNode":115,"_process":164,"fbjs/lib/warning":162}],33:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactBrowserEventEmitter
* @typechecks static-only
*/
'use strict';
var EventConstants = require('./EventConstants');
var EventPluginHub = require('./EventPluginHub');
var EventPluginRegistry = require('./EventPluginRegistry');
var ReactEventEmitterMixin = require('./ReactEventEmitterMixin');
var ReactPerf = require('./ReactPerf');
var ViewportMetrics = require('./ViewportMetrics');
var assign = require('./Object.assign');
var isEventSupported = require('./isEventSupported');
/**
* Summary of `ReactBrowserEventEmitter` event handling:
*
* - Top-level delegation is used to trap most native browser events. This
* may only occur in the main thread and is the responsibility of
* ReactEventListener, which is injected and can therefore support pluggable
* event sources. This is the only work that occurs in the main thread.
*
* - We normalize and de-duplicate events to account for browser quirks. This
* may be done in the worker thread.
*
* - Forward these native events (with the associated top-level type used to
* trap it) to `EventPluginHub`, which in turn will ask plugins if they want
* to extract any synthetic events.
*
* - The `EventPluginHub` will then process each event by annotating them with
* "dispatches", a sequence of listeners and IDs that care about that event.
*
* - The `EventPluginHub` then dispatches the events.
*
* Overview of React and the event system:
*
* +------------+ .
* | DOM | .
* +------------+ .
* | .
* v .
* +------------+ .
* | ReactEvent | .
* | Listener | .
* +------------+ . +-----------+
* | . +--------+|SimpleEvent|
* | . | |Plugin |
* +-----|------+ . v +-----------+
* | | | . +--------------+ +------------+
* | +-----------.--->|EventPluginHub| | Event |
* | | . | | +-----------+ | Propagators|
* | ReactEvent | . | | |TapEvent | |------------|
* | Emitter | . | |<---+|Plugin | |other plugin|
* | | . | | +-----------+ | utilities |
* | +-----------.--->| | +------------+
* | | | . +--------------+
* +-----|------+ . ^ +-----------+
* | . | |Enter/Leave|
* + . +-------+|Plugin |
* +-------------+ . +-----------+
* | application | .
* |-------------| .
* | | .
* | | .
* +-------------+ .
* .
* React Core . General Purpose Event Plugin System
*/
var alreadyListeningTo = {};
var isMonitoringScrollValue = false;
var reactTopListenersCounter = 0;
// For events like 'submit' which don't consistently bubble (which we trap at a
// lower node than `document`), binding at `document` would cause duplicate
// events so we don't include them here
var topEventMapping = {
topAbort: 'abort',
topBlur: 'blur',
topCanPlay: 'canplay',
topCanPlayThrough: 'canplaythrough',
topChange: 'change',
topClick: 'click',
topCompositionEnd: 'compositionend',
topCompositionStart: 'compositionstart',
topCompositionUpdate: 'compositionupdate',
topContextMenu: 'contextmenu',
topCopy: 'copy',
topCut: 'cut',
topDoubleClick: 'dblclick',
topDrag: 'drag',
topDragEnd: 'dragend',
topDragEnter: 'dragenter',
topDragExit: 'dragexit',
topDragLeave: 'dragleave',
topDragOver: 'dragover',
topDragStart: 'dragstart',
topDrop: 'drop',
topDurationChange: 'durationchange',
topEmptied: 'emptied',
topEncrypted: 'encrypted',
topEnded: 'ended',
topError: 'error',
topFocus: 'focus',
topInput: 'input',
topKeyDown: 'keydown',
topKeyPress: 'keypress',
topKeyUp: 'keyup',
topLoadedData: 'loadeddata',
topLoadedMetadata: 'loadedmetadata',
topLoadStart: 'loadstart',
topMouseDown: 'mousedown',
topMouseMove: 'mousemove',
topMouseOut: 'mouseout',
topMouseOver: 'mouseover',
topMouseUp: 'mouseup',
topPaste: 'paste',
topPause: 'pause',
topPlay: 'play',
topPlaying: 'playing',
topProgress: 'progress',
topRateChange: 'ratechange',
topScroll: 'scroll',
topSeeked: 'seeked',
topSeeking: 'seeking',
topSelectionChange: 'selectionchange',
topStalled: 'stalled',
topSuspend: 'suspend',
topTextInput: 'textInput',
topTimeUpdate: 'timeupdate',
topTouchCancel: 'touchcancel',
topTouchEnd: 'touchend',
topTouchMove: 'touchmove',
topTouchStart: 'touchstart',
topVolumeChange: 'volumechange',
topWaiting: 'waiting',
topWheel: 'wheel'
};
/**
* To ensure no conflicts with other potential React instances on the page
*/
var topListenersIDKey = '_reactListenersID' + String(Math.random()).slice(2);
function getListeningForDocument(mountAt) {
// In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty`
// directly.
if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) {
mountAt[topListenersIDKey] = reactTopListenersCounter++;
alreadyListeningTo[mountAt[topListenersIDKey]] = {};
}
return alreadyListeningTo[mountAt[topListenersIDKey]];
}
/**
* `ReactBrowserEventEmitter` is used to attach top-level event listeners. For
* example:
*
* ReactBrowserEventEmitter.putListener('myID', 'onClick', myFunction);
*
* This would allocate a "registration" of `('onClick', myFunction)` on 'myID'.
*
* @internal
*/
var ReactBrowserEventEmitter = assign({}, ReactEventEmitterMixin, {
/**
* Injectable event backend
*/
ReactEventListener: null,
injection: {
/**
* @param {object} ReactEventListener
*/
injectReactEventListener: function (ReactEventListener) {
ReactEventListener.setHandleTopLevel(ReactBrowserEventEmitter.handleTopLevel);
ReactBrowserEventEmitter.ReactEventListener = ReactEventListener;
}
},
/**
* Sets whether or not any created callbacks should be enabled.
*
* @param {boolean} enabled True if callbacks should be enabled.
*/
setEnabled: function (enabled) {
if (ReactBrowserEventEmitter.ReactEventListener) {
ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled);
}
},
/**
* @return {boolean} True if callbacks are enabled.
*/
isEnabled: function () {
return !!(ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled());
},
/**
* We listen for bubbled touch events on the document object.
*
* Firefox v8.01 (and possibly others) exhibited strange behavior when
* mounting `onmousemove` events at some node that was not the document
* element. The symptoms were that if your mouse is not moving over something
* contained within that mount point (for example on the background) the
* top-level listeners for `onmousemove` won't be called. However, if you
* register the `mousemove` on the document object, then it will of course
* catch all `mousemove`s. This along with iOS quirks, justifies restricting
* top-level listeners to the document object only, at least for these
* movement types of events and possibly all events.
*
* @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
*
* Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but
* they bubble to document.
*
* @param {string} registrationName Name of listener (e.g. `onClick`).
* @param {object} contentDocumentHandle Document which owns the container
*/
listenTo: function (registrationName, contentDocumentHandle) {
var mountAt = contentDocumentHandle;
var isListening = getListeningForDocument(mountAt);
var dependencies = EventPluginRegistry.registrationNameDependencies[registrationName];
var topLevelTypes = EventConstants.topLevelTypes;
for (var i = 0; i < dependencies.length; i++) {
var dependency = dependencies[i];
if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) {
if (dependency === topLevelTypes.topWheel) {
if (isEventSupported('wheel')) {
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'wheel', mountAt);
} else if (isEventSupported('mousewheel')) {
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'mousewheel', mountAt);
} else {
// Firefox needs to capture a different mouse scroll event.
// @see http://www.quirksmode.org/dom/events/tests/scroll.html
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'DOMMouseScroll', mountAt);
}
} else if (dependency === topLevelTypes.topScroll) {
if (isEventSupported('scroll', true)) {
ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topScroll, 'scroll', mountAt);
} else {
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topScroll, 'scroll', ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE);
}
} else if (dependency === topLevelTypes.topFocus || dependency === topLevelTypes.topBlur) {
if (isEventSupported('focus', true)) {
ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topFocus, 'focus', mountAt);
ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topBlur, 'blur', mountAt);
} else if (isEventSupported('focusin')) {
// IE has `focusin` and `focusout` events which bubble.
// @see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topFocus, 'focusin', mountAt);
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topBlur, 'focusout', mountAt);
}
// to make sure blur and focus event listeners are only attached once
isListening[topLevelTypes.topBlur] = true;
isListening[topLevelTypes.topFocus] = true;
} else if (topEventMapping.hasOwnProperty(dependency)) {
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(dependency, topEventMapping[dependency], mountAt);
}
isListening[dependency] = true;
}
}
},
trapBubbledEvent: function (topLevelType, handlerBaseName, handle) {
return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelType, handlerBaseName, handle);
},
trapCapturedEvent: function (topLevelType, handlerBaseName, handle) {
return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelType, handlerBaseName, handle);
},
/**
* Listens to window scroll and resize events. We cache scroll values so that
* application code can access them without triggering reflows.
*
* NOTE: Scroll events do not bubble.
*
* @see http://www.quirksmode.org/dom/events/scroll.html
*/
ensureScrollValueMonitoring: function () {
if (!isMonitoringScrollValue) {
var refresh = ViewportMetrics.refreshScrollValues;
ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh);
isMonitoringScrollValue = true;
}
},
eventNameDispatchConfigs: EventPluginHub.eventNameDispatchConfigs,
registrationNameModules: EventPluginHub.registrationNameModules,
putListener: EventPluginHub.putListener,
getListener: EventPluginHub.getListener,
deleteListener: EventPluginHub.deleteListener,
deleteAllListeners: EventPluginHub.deleteAllListeners
});
ReactPerf.measureMethods(ReactBrowserEventEmitter, 'ReactBrowserEventEmitter', {
putListener: 'putListener',
deleteListener: 'deleteListener'
});
module.exports = ReactBrowserEventEmitter;
},{"./EventConstants":21,"./EventPluginHub":22,"./EventPluginRegistry":23,"./Object.assign":29,"./ReactEventEmitterMixin":64,"./ReactPerf":78,"./ViewportMetrics":108,"./isEventSupported":126}],34:[function(require,module,exports){
(function (process){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactChildReconciler
* @typechecks static-only
*/
'use strict';
var ReactReconciler = require('./ReactReconciler');
var instantiateReactComponent = require('./instantiateReactComponent');
var shouldUpdateReactComponent = require('./shouldUpdateReactComponent');
var traverseAllChildren = require('./traverseAllChildren');
var warning = require('fbjs/lib/warning');
function instantiateChild(childInstances, child, name) {
// We found a component instance.
var keyUnique = childInstances[name] === undefined;
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', name) : undefined;
}
if (child != null && keyUnique) {
childInstances[name] = instantiateReactComponent(child, null);
}
}
/**
* ReactChildReconciler provides helpers for initializing or updating a set of
* children. Its output is suitable for passing it onto ReactMultiChild which
* does diffed reordering and insertion.
*/
var ReactChildReconciler = {
/**
* Generates a "mount image" for each of the supplied children. In the case
* of `ReactDOMComponent`, a mount image is a string of markup.
*
* @param {?object} nestedChildNodes Nested child maps.
* @return {?object} A set of child instances.
* @internal
*/
instantiateChildren: function (nestedChildNodes, transaction, context) {
if (nestedChildNodes == null) {
return null;
}
var childInstances = {};
traverseAllChildren(nestedChildNodes, instantiateChild, childInstances);
return childInstances;
},
/**
* Updates the rendered children and returns a new set of children.
*
* @param {?object} prevChildren Previously initialized set of children.
* @param {?object} nextChildren Flat child element maps.
* @param {ReactReconcileTransaction} transaction
* @param {object} context
* @return {?object} A new set of child instances.
* @internal
*/
updateChildren: function (prevChildren, nextChildren, transaction, context) {
// We currently don't have a way to track moves here but if we use iterators
// instead of for..in we can zip the iterators and check if an item has
// moved.
// TODO: If nothing has changed, return the prevChildren object so that we
// can quickly bailout if nothing has changed.
if (!nextChildren && !prevChildren) {
return null;
}
var name;
for (name in nextChildren) {
if (!nextChildren.hasOwnProperty(name)) {
continue;
}
var prevChild = prevChildren && prevChildren[name];
var prevElement = prevChild && prevChild._currentElement;
var nextElement = nextChildren[name];
if (prevChild != null && shouldUpdateReactComponent(prevElement, nextElement)) {
ReactReconciler.receiveComponent(prevChild, nextElement, transaction, context);
nextChildren[name] = prevChild;
} else {
if (prevChild) {
ReactReconciler.unmountComponent(prevChild, name);
}
// The child must be instantiated before it's mounted.
var nextChildInstance = instantiateReactComponent(nextElement, null);
nextChildren[name] = nextChildInstance;
}
}
// Unmount children that are no longer present.
for (name in prevChildren) {
if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) {
ReactReconciler.unmountComponent(prevChildren[name]);
}
}
return nextChildren;
},
/**
* Unmounts all rendered children. This should be used to clean up children
* when this component is unmounted.
*
* @param {?object} renderedChildren Previously initialized set of children.
* @internal
*/
unmountChildren: function (renderedChildren) {
for (var name in renderedChildren) {
if (renderedChildren.hasOwnProperty(name)) {
var renderedChild = renderedChildren[name];
ReactReconciler.unmountComponent(renderedChild);
}
}
}
};
module.exports = ReactChildReconciler;
}).call(this,require('_process'))
},{"./ReactReconciler":83,"./instantiateReactComponent":125,"./shouldUpdateReactComponent":133,"./traverseAllChildren":134,"_process":164,"fbjs/lib/warning":162}],35:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactChildren
*/
'use strict';
var PooledClass = require('./PooledClass');
var ReactElement = require('./ReactElement');
var emptyFunction = require('fbjs/lib/emptyFunction');
var traverseAllChildren = require('./traverseAllChildren');
var twoArgumentPooler = PooledClass.twoArgumentPooler;
var fourArgumentPooler = PooledClass.fourArgumentPooler;
var userProvidedKeyEscapeRegex = /\/(?!\/)/g;
function escapeUserProvidedKey(text) {
return ('' + text).replace(userProvidedKeyEscapeRegex, '//');
}
/**
* PooledClass representing the bookkeeping associated with performing a child
* traversal. Allows avoiding binding callbacks.
*
* @constructor ForEachBookKeeping
* @param {!function} forEachFunction Function to perform traversal with.
* @param {?*} forEachContext Context to perform context with.
*/
function ForEachBookKeeping(forEachFunction, forEachContext) {
this.func = forEachFunction;
this.context = forEachContext;
this.count = 0;
}
ForEachBookKeeping.prototype.destructor = function () {
this.func = null;
this.context = null;
this.count = 0;
};
PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);
function forEachSingleChild(bookKeeping, child, name) {
var func = bookKeeping.func;
var context = bookKeeping.context;
func.call(context, child, bookKeeping.count++);
}
/**
* Iterates through children that are typically specified as `props.children`.
*
* The provided forEachFunc(child, index) will be called for each
* leaf child.
*
* @param {?*} children Children tree container.
* @param {function(*, int)} forEachFunc
* @param {*} forEachContext Context for forEachContext.
*/
function forEachChildren(children, forEachFunc, forEachContext) {
if (children == null) {
return children;
}
var traverseContext = ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
traverseAllChildren(children, forEachSingleChild, traverseContext);
ForEachBookKeeping.release(traverseContext);
}
/**
* PooledClass representing the bookkeeping associated with performing a child
* mapping. Allows avoiding binding callbacks.
*
* @constructor MapBookKeeping
* @param {!*} mapResult Object containing the ordered map of results.
* @param {!function} mapFunction Function to perform mapping with.
* @param {?*} mapContext Context to perform mapping with.
*/
function MapBookKeeping(mapResult, keyPrefix, mapFunction, mapContext) {
this.result = mapResult;
this.keyPrefix = keyPrefix;
this.func = mapFunction;
this.context = mapContext;
this.count = 0;
}
MapBookKeeping.prototype.destructor = function () {
this.result = null;
this.keyPrefix = null;
this.func = null;
this.context = null;
this.count = 0;
};
PooledClass.addPoolingTo(MapBookKeeping, fourArgumentPooler);
function mapSingleChildIntoContext(bookKeeping, child, childKey) {
var result = bookKeeping.result;
var keyPrefix = bookKeeping.keyPrefix;
var func = bookKeeping.func;
var context = bookKeeping.context;
var mappedChild = func.call(context, child, bookKeeping.count++);
if (Array.isArray(mappedChild)) {
mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument);
} else if (mappedChild != null) {
if (ReactElement.isValidElement(mappedChild)) {
mappedChild = ReactElement.cloneAndReplaceKey(mappedChild,
// Keep both the (mapped) and old keys if they differ, just as
// traverseAllChildren used to do for objects as children
keyPrefix + (mappedChild !== child ? escapeUserProvidedKey(mappedChild.key || '') + '/' : '') + childKey);
}
result.push(mappedChild);
}
}
function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
var escapedPrefix = '';
if (prefix != null) {
escapedPrefix = escapeUserProvidedKey(prefix) + '/';
}
var traverseContext = MapBookKeeping.getPooled(array, escapedPrefix, func, context);
traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
MapBookKeeping.release(traverseContext);
}
/**
* Maps children that are typically specified as `props.children`.
*
* The provided mapFunction(child, key, index) will be called for each
* leaf child.
*
* @param {?*} children Children tree container.
* @param {function(*, int)} func The map function.
* @param {*} context Context for mapFunction.
* @return {object} Object containing the ordered map of results.
*/
function mapChildren(children, func, context) {
if (children == null) {
return children;
}
var result = [];
mapIntoWithKeyPrefixInternal(children, result, null, func, context);
return result;
}
function forEachSingleChildDummy(traverseContext, child, name) {
return null;
}
/**
* Count the number of children that are typically specified as
* `props.children`.
*
* @param {?*} children Children tree container.
* @return {number} The number of children.
*/
function countChildren(children, context) {
return traverseAllChildren(children, forEachSingleChildDummy, null);
}
/**
* Flatten a children object (typically specified as `props.children`) and
* return an array with appropriately re-keyed children.
*/
function toArray(children) {
var result = [];
mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument);
return result;
}
var ReactChildren = {
forEach: forEachChildren,
map: mapChildren,
mapIntoWithKeyPrefixInternal: mapIntoWithKeyPrefixInternal,
count: countChildren,
toArray: toArray
};
module.exports = ReactChildren;
},{"./PooledClass":30,"./ReactElement":59,"./traverseAllChildren":134,"fbjs/lib/emptyFunction":143}],36:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactClass
*/
'use strict';
var ReactComponent = require('./ReactComponent');
var ReactElement = require('./ReactElement');
var ReactPropTypeLocations = require('./ReactPropTypeLocations');
var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames');
var ReactNoopUpdateQueue = require('./ReactNoopUpdateQueue');
var assign = require('./Object.assign');
var emptyObject = require('fbjs/lib/emptyObject');
var invariant = require('fbjs/lib/invariant');
var keyMirror = require('fbjs/lib/keyMirror');
var keyOf = require('fbjs/lib/keyOf');
var warning = require('fbjs/lib/warning');
var MIXINS_KEY = keyOf({ mixins: null });
/**
* Policies that describe methods in `ReactClassInterface`.
*/
var SpecPolicy = keyMirror({
/**
* These methods may be defined only once by the class specification or mixin.
*/
DEFINE_ONCE: null,
/**
* These methods may be defined by both the class specification and mixins.
* Subsequent definitions will be chained. These methods must return void.
*/
DEFINE_MANY: null,
/**
* These methods are overriding the base class.
*/
OVERRIDE_BASE: null,
/**
* These methods are similar to DEFINE_MANY, except we assume they return
* objects. We try to merge the keys of the return values of all the mixed in
* functions. If there is a key conflict we throw.
*/
DEFINE_MANY_MERGED: null
});
var injectedMixins = [];
var warnedSetProps = false;
function warnSetProps() {
if (!warnedSetProps) {
warnedSetProps = true;
process.env.NODE_ENV !== 'production' ? warning(false, 'setProps(...) and replaceProps(...) are deprecated. ' + 'Instead, call render again at the top level.') : undefined;
}
}
/**
* Composite components are higher-level components that compose other composite
* or native components.
*
* To create a new type of `ReactClass`, pass a specification of
* your new class to `React.createClass`. The only requirement of your class
* specification is that you implement a `render` method.
*
* var MyComponent = React.createClass({
* render: function() {
* return <div>Hello World</div>;
* }
* });
*
* The class specification supports a specific protocol of methods that have
* special meaning (e.g. `render`). See `ReactClassInterface` for
* more the comprehensive protocol. Any other properties and methods in the
* class specification will be available on the prototype.
*
* @interface ReactClassInterface
* @internal
*/
var ReactClassInterface = {
/**
* An array of Mixin objects to include when defining your component.
*
* @type {array}
* @optional
*/
mixins: SpecPolicy.DEFINE_MANY,
/**
* An object containing properties and methods that should be defined on
* the component's constructor instead of its prototype (static methods).
*
* @type {object}
* @optional
*/
statics: SpecPolicy.DEFINE_MANY,
/**
* Definition of prop types for this component.
*
* @type {object}
* @optional
*/
propTypes: SpecPolicy.DEFINE_MANY,
/**
* Definition of context types for this component.
*
* @type {object}
* @optional
*/
contextTypes: SpecPolicy.DEFINE_MANY,
/**
* Definition of context types this component sets for its children.
*
* @type {object}
* @optional
*/
childContextTypes: SpecPolicy.DEFINE_MANY,
// ==== Definition methods ====
/**
* Invoked when the component is mounted. Values in the mapping will be set on
* `this.props` if that prop is not specified (i.e. using an `in` check).
*
* This method is invoked before `getInitialState` and therefore cannot rely
* on `this.state` or use `this.setState`.
*
* @return {object}
* @optional
*/
getDefaultProps: SpecPolicy.DEFINE_MANY_MERGED,
/**
* Invoked once before the component is mounted. The return value will be used
* as the initial value of `this.state`.
*
* getInitialState: function() {
* return {
* isOn: false,
* fooBaz: new BazFoo()
* }
* }
*
* @return {object}
* @optional
*/
getInitialState: SpecPolicy.DEFINE_MANY_MERGED,
/**
* @return {object}
* @optional
*/
getChildContext: SpecPolicy.DEFINE_MANY_MERGED,
/**
* Uses props from `this.props` and state from `this.state` to render the
* structure of the component.
*
* No guarantees are made about when or how often this method is invoked, so
* it must not have side effects.
*
* render: function() {
* var name = this.props.name;
* return <div>Hello, {name}!</div>;
* }
*
* @return {ReactComponent}
* @nosideeffects
* @required
*/
render: SpecPolicy.DEFINE_ONCE,
// ==== Delegate methods ====
/**
* Invoked when the component is initially created and about to be mounted.
* This may have side effects, but any external subscriptions or data created
* by this method must be cleaned up in `componentWillUnmount`.
*
* @optional
*/
componentWillMount: SpecPolicy.DEFINE_MANY,
/**
* Invoked when the component has been mounted and has a DOM representation.
* However, there is no guarantee that the DOM node is in the document.
*
* Use this as an opportunity to operate on the DOM when the component has
* been mounted (initialized and rendered) for the first time.
*
* @param {DOMElement} rootNode DOM element representing the component.
* @optional
*/
componentDidMount: SpecPolicy.DEFINE_MANY,
/**
* Invoked before the component receives new props.
*
* Use this as an opportunity to react to a prop transition by updating the
* state using `this.setState`. Current props are accessed via `this.props`.
*
* componentWillReceiveProps: function(nextProps, nextContext) {
* this.setState({
* likesIncreasing: nextProps.likeCount > this.props.likeCount
* });
* }
*
* NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop
* transition may cause a state change, but the opposite is not true. If you
* need it, you are probably looking for `componentWillUpdate`.
*
* @param {object} nextProps
* @optional
*/
componentWillReceiveProps: SpecPolicy.DEFINE_MANY,
/**
* Invoked while deciding if the component should be updated as a result of
* receiving new props, state and/or context.
*
* Use this as an opportunity to `return false` when you're certain that the
* transition to the new props/state/context will not require a component
* update.
*
* shouldComponentUpdate: function(nextProps, nextState, nextContext) {
* return !equal(nextProps, this.props) ||
* !equal(nextState, this.state) ||
* !equal(nextContext, this.context);
* }
*
* @param {object} nextProps
* @param {?object} nextState
* @param {?object} nextContext
* @return {boolean} True if the component should update.
* @optional
*/
shouldComponentUpdate: SpecPolicy.DEFINE_ONCE,
/**
* Invoked when the component is about to update due to a transition from
* `this.props`, `this.state` and `this.context` to `nextProps`, `nextState`
* and `nextContext`.
*
* Use this as an opportunity to perform preparation before an update occurs.
*
* NOTE: You **cannot** use `this.setState()` in this method.
*
* @param {object} nextProps
* @param {?object} nextState
* @param {?object} nextContext
* @param {ReactReconcileTransaction} transaction
* @optional
*/
componentWillUpdate: SpecPolicy.DEFINE_MANY,
/**
* Invoked when the component's DOM representation has been updated.
*
* Use this as an opportunity to operate on the DOM when the component has
* been updated.
*
* @param {object} prevProps
* @param {?object} prevState
* @param {?object} prevContext
* @param {DOMElement} rootNode DOM element representing the component.
* @optional
*/
componentDidUpdate: SpecPolicy.DEFINE_MANY,
/**
* Invoked when the component is about to be removed from its parent and have
* its DOM representation destroyed.
*
* Use this as an opportunity to deallocate any external resources.
*
* NOTE: There is no `componentDidUnmount` since your component will have been
* destroyed by that point.
*
* @optional
*/
componentWillUnmount: SpecPolicy.DEFINE_MANY,
// ==== Advanced methods ====
/**
* Updates the component's currently mounted DOM representation.
*
* By default, this implements React's rendering and reconciliation algorithm.
* Sophisticated clients may wish to override this.
*
* @param {ReactReconcileTransaction} transaction
* @internal
* @overridable
*/
updateComponent: SpecPolicy.OVERRIDE_BASE
};
/**
* Mapping from class specification keys to special processing functions.
*
* Although these are declared like instance properties in the specification
* when defining classes using `React.createClass`, they are actually static
* and are accessible on the constructor instead of the prototype. Despite
* being static, they must be defined outside of the "statics" key under
* which all other static methods are defined.
*/
var RESERVED_SPEC_KEYS = {
displayName: function (Constructor, displayName) {
Constructor.displayName = displayName;
},
mixins: function (Constructor, mixins) {
if (mixins) {
for (var i = 0; i < mixins.length; i++) {
mixSpecIntoComponent(Constructor, mixins[i]);
}
}
},
childContextTypes: function (Constructor, childContextTypes) {
if (process.env.NODE_ENV !== 'production') {
validateTypeDef(Constructor, childContextTypes, ReactPropTypeLocations.childContext);
}
Constructor.childContextTypes = assign({}, Constructor.childContextTypes, childContextTypes);
},
contextTypes: function (Constructor, contextTypes) {
if (process.env.NODE_ENV !== 'production') {
validateTypeDef(Constructor, contextTypes, ReactPropTypeLocations.context);
}
Constructor.contextTypes = assign({}, Constructor.contextTypes, contextTypes);
},
/**
* Special case getDefaultProps which should move into statics but requires
* automatic merging.
*/
getDefaultProps: function (Constructor, getDefaultProps) {
if (Constructor.getDefaultProps) {
Constructor.getDefaultProps = createMergedResultFunction(Constructor.getDefaultProps, getDefaultProps);
} else {
Constructor.getDefaultProps = getDefaultProps;
}
},
propTypes: function (Constructor, propTypes) {
if (process.env.NODE_ENV !== 'production') {
validateTypeDef(Constructor, propTypes, ReactPropTypeLocations.prop);
}
Constructor.propTypes = assign({}, Constructor.propTypes, propTypes);
},
statics: function (Constructor, statics) {
mixStaticSpecIntoComponent(Constructor, statics);
},
autobind: function () {} };
// noop
function validateTypeDef(Constructor, typeDef, location) {
for (var propName in typeDef) {
if (typeDef.hasOwnProperty(propName)) {
// use a warning instead of an invariant so components
// don't show up in prod but not in __DEV__
process.env.NODE_ENV !== 'production' ? warning(typeof typeDef[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', Constructor.displayName || 'ReactClass', ReactPropTypeLocationNames[location], propName) : undefined;
}
}
}
function validateMethodOverride(proto, name) {
var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null;
// Disallow overriding of base class methods unless explicitly allowed.
if (ReactClassMixin.hasOwnProperty(name)) {
!(specPolicy === SpecPolicy.OVERRIDE_BASE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to override ' + '`%s` from your class specification. Ensure that your method names ' + 'do not overlap with React methods.', name) : invariant(false) : undefined;
}
// Disallow defining methods more than once unless explicitly allowed.
if (proto.hasOwnProperty(name)) {
!(specPolicy === SpecPolicy.DEFINE_MANY || specPolicy === SpecPolicy.DEFINE_MANY_MERGED) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to define ' + '`%s` on your component more than once. This conflict may be due ' + 'to a mixin.', name) : invariant(false) : undefined;
}
}
/**
* Mixin helper which handles policy validation and reserved
* specification keys when building React classses.
*/
function mixSpecIntoComponent(Constructor, spec) {
if (!spec) {
return;
}
!(typeof spec !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component class as a mixin. Instead, just use a regular object.') : invariant(false) : undefined;
!!ReactElement.isValidElement(spec) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component as a mixin. Instead, just use a regular object.') : invariant(false) : undefined;
var proto = Constructor.prototype;
// By handling mixins before any other properties, we ensure the same
// chaining order is applied to methods with DEFINE_MANY policy, whether
// mixins are listed before or after these methods in the spec.
if (spec.hasOwnProperty(MIXINS_KEY)) {
RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins);
}
for (var name in spec) {
if (!spec.hasOwnProperty(name)) {
continue;
}
if (name === MIXINS_KEY) {
// We have already handled mixins in a special case above.
continue;
}
var property = spec[name];
validateMethodOverride(proto, name);
if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) {
RESERVED_SPEC_KEYS[name](Constructor, property);
} else {
// Setup methods on prototype:
// The following member methods should not be automatically bound:
// 1. Expected ReactClass methods (in the "interface").
// 2. Overridden methods (that were mixed in).
var isReactClassMethod = ReactClassInterface.hasOwnProperty(name);
var isAlreadyDefined = proto.hasOwnProperty(name);
var isFunction = typeof property === 'function';
var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false;
if (shouldAutoBind) {
if (!proto.__reactAutoBindMap) {
proto.__reactAutoBindMap = {};
}
proto.__reactAutoBindMap[name] = property;
proto[name] = property;
} else {
if (isAlreadyDefined) {
var specPolicy = ReactClassInterface[name];
// These cases should already be caught by validateMethodOverride.
!(isReactClassMethod && (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: Unexpected spec policy %s for key %s ' + 'when mixing in component specs.', specPolicy, name) : invariant(false) : undefined;
// For methods which are defined more than once, call the existing
// methods before calling the new property, merging if appropriate.
if (specPolicy === SpecPolicy.DEFINE_MANY_MERGED) {
proto[name] = createMergedResultFunction(proto[name], property);
} else if (specPolicy === SpecPolicy.DEFINE_MANY) {
proto[name] = createChainedFunction(proto[name], property);
}
} else {
proto[name] = property;
if (process.env.NODE_ENV !== 'production') {
// Add verbose displayName to the function, which helps when looking
// at profiling tools.
if (typeof property === 'function' && spec.displayName) {
proto[name].displayName = spec.displayName + '_' + name;
}
}
}
}
}
}
}
function mixStaticSpecIntoComponent(Constructor, statics) {
if (!statics) {
return;
}
for (var name in statics) {
var property = statics[name];
if (!statics.hasOwnProperty(name)) {
continue;
}
var isReserved = (name in RESERVED_SPEC_KEYS);
!!isReserved ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You are attempting to define a reserved ' + 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' + 'as an instance property instead; it will still be accessible on the ' + 'constructor.', name) : invariant(false) : undefined;
var isInherited = (name in Constructor);
!!isInherited ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You are attempting to define ' + '`%s` on your component more than once. This conflict may be ' + 'due to a mixin.', name) : invariant(false) : undefined;
Constructor[name] = property;
}
}
/**
* Merge two objects, but throw if both contain the same key.
*
* @param {object} one The first object, which is mutated.
* @param {object} two The second object
* @return {object} one after it has been mutated to contain everything in two.
*/
function mergeIntoWithNoDuplicateKeys(one, two) {
!(one && two && typeof one === 'object' && typeof two === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : invariant(false) : undefined;
for (var key in two) {
if (two.hasOwnProperty(key)) {
!(one[key] === undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): ' + 'Tried to merge two objects with the same key: `%s`. This conflict ' + 'may be due to a mixin; in particular, this may be caused by two ' + 'getInitialState() or getDefaultProps() methods returning objects ' + 'with clashing keys.', key) : invariant(false) : undefined;
one[key] = two[key];
}
}
return one;
}
/**
* Creates a function that invokes two functions and merges their return values.
*
* @param {function} one Function to invoke first.
* @param {function} two Function to invoke second.
* @return {function} Function that invokes the two argument functions.
* @private
*/
function createMergedResultFunction(one, two) {
return function mergedResult() {
var a = one.apply(this, arguments);
var b = two.apply(this, arguments);
if (a == null) {
return b;
} else if (b == null) {
return a;
}
var c = {};
mergeIntoWithNoDuplicateKeys(c, a);
mergeIntoWithNoDuplicateKeys(c, b);
return c;
};
}
/**
* Creates a function that invokes two functions and ignores their return vales.
*
* @param {function} one Function to invoke first.
* @param {function} two Function to invoke second.
* @return {function} Function that invokes the two argument functions.
* @private
*/
function createChainedFunction(one, two) {
return function chainedFunction() {
one.apply(this, arguments);
two.apply(this, arguments);
};
}
/**
* Binds a method to the component.
*
* @param {object} component Component whose method is going to be bound.
* @param {function} method Method to be bound.
* @return {function} The bound method.
*/
function bindAutoBindMethod(component, method) {
var boundMethod = method.bind(component);
if (process.env.NODE_ENV !== 'production') {
boundMethod.__reactBoundContext = component;
boundMethod.__reactBoundMethod = method;
boundMethod.__reactBoundArguments = null;
var componentName = component.constructor.displayName;
var _bind = boundMethod.bind;
/* eslint-disable block-scoped-var, no-undef */
boundMethod.bind = function (newThis) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
// User is trying to bind() an autobound method; we effectively will
// ignore the value of "this" that the user is trying to use, so
// let's warn.
if (newThis !== component && newThis !== null) {
process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : undefined;
} else if (!args.length) {
process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See %s', componentName) : undefined;
return boundMethod;
}
var reboundMethod = _bind.apply(boundMethod, arguments);
reboundMethod.__reactBoundContext = component;
reboundMethod.__reactBoundMethod = method;
reboundMethod.__reactBoundArguments = args;
return reboundMethod;
/* eslint-enable */
};
}
return boundMethod;
}
/**
* Binds all auto-bound methods in a component.
*
* @param {object} component Component whose method is going to be bound.
*/
function bindAutoBindMethods(component) {
for (var autoBindKey in component.__reactAutoBindMap) {
if (component.__reactAutoBindMap.hasOwnProperty(autoBindKey)) {
var method = component.__reactAutoBindMap[autoBindKey];
component[autoBindKey] = bindAutoBindMethod(component, method);
}
}
}
/**
* Add more to the ReactClass base class. These are all legacy features and
* therefore not already part of the modern ReactComponent.
*/
var ReactClassMixin = {
/**
* TODO: This will be deprecated because state should always keep a consistent
* type signature and the only use case for this, is to avoid that.
*/
replaceState: function (newState, callback) {
this.updater.enqueueReplaceState(this, newState);
if (callback) {
this.updater.enqueueCallback(this, callback);
}
},
/**
* Checks whether or not this composite component is mounted.
* @return {boolean} True if mounted, false otherwise.
* @protected
* @final
*/
isMounted: function () {
return this.updater.isMounted(this);
},
/**
* Sets a subset of the props.
*
* @param {object} partialProps Subset of the next props.
* @param {?function} callback Called after props are updated.
* @final
* @public
* @deprecated
*/
setProps: function (partialProps, callback) {
if (process.env.NODE_ENV !== 'production') {
warnSetProps();
}
this.updater.enqueueSetProps(this, partialProps);
if (callback) {
this.updater.enqueueCallback(this, callback);
}
},
/**
* Replace all the props.
*
* @param {object} newProps Subset of the next props.
* @param {?function} callback Called after props are updated.
* @final
* @public
* @deprecated
*/
replaceProps: function (newProps, callback) {
if (process.env.NODE_ENV !== 'production') {
warnSetProps();
}
this.updater.enqueueReplaceProps(this, newProps);
if (callback) {
this.updater.enqueueCallback(this, callback);
}
}
};
var ReactClassComponent = function () {};
assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin);
/**
* Module for creating composite components.
*
* @class ReactClass
*/
var ReactClass = {
/**
* Creates a composite component class given a class specification.
*
* @param {object} spec Class specification (which must define `render`).
* @return {function} Component constructor function.
* @public
*/
createClass: function (spec) {
var Constructor = function (props, context, updater) {
// This constructor is overridden by mocks. The argument is used
// by mocks to assert on what gets mounted.
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : undefined;
}
// Wire up auto-binding
if (this.__reactAutoBindMap) {
bindAutoBindMethods(this);
}
this.props = props;
this.context = context;
this.refs = emptyObject;
this.updater = updater || ReactNoopUpdateQueue;
this.state = null;
// ReactClasses doesn't have constructors. Instead, they use the
// getInitialState and componentWillMount methods for initialization.
var initialState = this.getInitialState ? this.getInitialState() : null;
if (process.env.NODE_ENV !== 'production') {
// We allow auto-mocks to proceed as if they're returning null.
if (typeof initialState === 'undefined' && this.getInitialState._isMockFunction) {
// This is probably bad practice. Consider warning here and
// deprecating this convenience.
initialState = null;
}
}
!(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : invariant(false) : undefined;
this.state = initialState;
};
Constructor.prototype = new ReactClassComponent();
Constructor.prototype.constructor = Constructor;
injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor));
mixSpecIntoComponent(Constructor, spec);
// Initialize the defaultProps property after all mixins have been merged.
if (Constructor.getDefaultProps) {
Constructor.defaultProps = Constructor.getDefaultProps();
}
if (process.env.NODE_ENV !== 'production') {
// This is a tag to indicate that the use of these method names is ok,
// since it's used with createClass. If it's not, then it's likely a
// mistake so we'll warn you to use the static property, property
// initializer or constructor respectively.
if (Constructor.getDefaultProps) {
Constructor.getDefaultProps.isReactClassApproved = {};
}
if (Constructor.prototype.getInitialState) {
Constructor.prototype.getInitialState.isReactClassApproved = {};
}
}
!Constructor.prototype.render ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : invariant(false) : undefined;
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentShouldUpdate, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', spec.displayName || 'A component') : undefined;
process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') : undefined;
}
// Reduce time spent doing lookups by setting these on the prototype.
for (var methodName in ReactClassInterface) {
if (!Constructor.prototype[methodName]) {
Constructor.prototype[methodName] = null;
}
}
return Constructor;
},
injection: {
injectMixin: function (mixin) {
injectedMixins.push(mixin);
}
}
};
module.exports = ReactClass;
}).call(this,require('_process'))
},{"./Object.assign":29,"./ReactComponent":37,"./ReactElement":59,"./ReactNoopUpdateQueue":76,"./ReactPropTypeLocationNames":79,"./ReactPropTypeLocations":80,"_process":164,"fbjs/lib/emptyObject":144,"fbjs/lib/invariant":151,"fbjs/lib/keyMirror":154,"fbjs/lib/keyOf":155,"fbjs/lib/warning":162}],37:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactComponent
*/
'use strict';
var ReactNoopUpdateQueue = require('./ReactNoopUpdateQueue');
var canDefineProperty = require('./canDefineProperty');
var emptyObject = require('fbjs/lib/emptyObject');
var invariant = require('fbjs/lib/invariant');
var warning = require('fbjs/lib/warning');
/**
* Base class helpers for the updating state of a component.
*/
function ReactComponent(props, context, updater) {
this.props = props;
this.context = context;
this.refs = emptyObject;
// We initialize the default updater but the real one gets injected by the
// renderer.
this.updater = updater || ReactNoopUpdateQueue;
}
ReactComponent.prototype.isReactComponent = {};
/**
* Sets a subset of the state. Always use this to mutate
* state. You should treat `this.state` as immutable.
*
* There is no guarantee that `this.state` will be immediately updated, so
* accessing `this.state` after calling this method may return the old value.
*
* There is no guarantee that calls to `setState` will run synchronously,
* as they may eventually be batched together. You can provide an optional
* callback that will be executed when the call to setState is actually
* completed.
*
* When a function is provided to setState, it will be called at some point in
* the future (not synchronously). It will be called with the up to date
* component arguments (state, props, context). These values can be different
* from this.* because your function may be called after receiveProps but before
* shouldComponentUpdate, and this new state, props, and context will not yet be
* assigned to this.
*
* @param {object|function} partialState Next partial state or function to
* produce next partial state to be merged with current state.
* @param {?function} callback Called after state is updated.
* @final
* @protected
*/
ReactComponent.prototype.setState = function (partialState, callback) {
!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.') : invariant(false) : undefined;
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : undefined;
}
this.updater.enqueueSetState(this, partialState);
if (callback) {
this.updater.enqueueCallback(this, callback);
}
};
/**
* Forces an update. This should only be invoked when it is known with
* certainty that we are **not** in a DOM transaction.
*
* You may want to call this when you know that some deeper aspect of the
* component's state has changed but `setState` was not called.
*
* This will not invoke `shouldComponentUpdate`, but it will invoke
* `componentWillUpdate` and `componentDidUpdate`.
*
* @param {?function} callback Called after update is complete.
* @final
* @protected
*/
ReactComponent.prototype.forceUpdate = function (callback) {
this.updater.enqueueForceUpdate(this);
if (callback) {
this.updater.enqueueCallback(this, callback);
}
};
/**
* Deprecated APIs. These APIs used to exist on classic React classes but since
* we would like to deprecate them, we're not going to move them over to this
* modern base class. Instead, we define a getter that warns if it's accessed.
*/
if (process.env.NODE_ENV !== 'production') {
var deprecatedAPIs = {
getDOMNode: ['getDOMNode', 'Use ReactDOM.findDOMNode(component) instead.'],
isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
replaceProps: ['replaceProps', 'Instead, call render again at the top level.'],
replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).'],
setProps: ['setProps', 'Instead, call render again at the top level.']
};
var defineDeprecationWarning = function (methodName, info) {
if (canDefineProperty) {
Object.defineProperty(ReactComponent.prototype, methodName, {
get: function () {
process.env.NODE_ENV !== 'production' ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) : undefined;
return undefined;
}
});
}
};
for (var fnName in deprecatedAPIs) {
if (deprecatedAPIs.hasOwnProperty(fnName)) {
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
}
}
}
module.exports = ReactComponent;
}).call(this,require('_process'))
},{"./ReactNoopUpdateQueue":76,"./canDefineProperty":111,"_process":164,"fbjs/lib/emptyObject":144,"fbjs/lib/invariant":151,"fbjs/lib/warning":162}],38:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactComponentBrowserEnvironment
*/
'use strict';
var ReactDOMIDOperations = require('./ReactDOMIDOperations');
var ReactMount = require('./ReactMount');
/**
* Abstracts away all functionality of the reconciler that requires knowledge of
* the browser context. TODO: These callers should be refactored to avoid the
* need for this injection.
*/
var ReactComponentBrowserEnvironment = {
processChildrenUpdates: ReactDOMIDOperations.dangerouslyProcessChildrenUpdates,
replaceNodeWithMarkupByID: ReactDOMIDOperations.dangerouslyReplaceNodeWithMarkupByID,
/**
* If a particular environment requires that some resources be cleaned up,
* specify this in the injected Mixin. In the DOM, we would likely want to
* purge any cached node ID lookups.
*
* @private
*/
unmountIDFromEnvironment: function (rootNodeID) {
ReactMount.purgeID(rootNodeID);
}
};
module.exports = ReactComponentBrowserEnvironment;
},{"./ReactDOMIDOperations":47,"./ReactMount":72}],39:[function(require,module,exports){
(function (process){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactComponentEnvironment
*/
'use strict';
var invariant = require('fbjs/lib/invariant');
var injected = false;
var ReactComponentEnvironment = {
/**
* Optionally injectable environment dependent cleanup hook. (server vs.
* browser etc). Example: A browser system caches DOM nodes based on component
* ID and must remove that cache entry when this instance is unmounted.
*/
unmountIDFromEnvironment: null,
/**
* Optionally injectable hook for swapping out mount images in the middle of
* the tree.
*/
replaceNodeWithMarkupByID: null,
/**
* Optionally injectable hook for processing a queue of child updates. Will
* later move into MultiChildComponents.
*/
processChildrenUpdates: null,
injection: {
injectEnvironment: function (environment) {
!!injected ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactCompositeComponent: injectEnvironment() can only be called once.') : invariant(false) : undefined;
ReactComponentEnvironment.unmountIDFromEnvironment = environment.unmountIDFromEnvironment;
ReactComponentEnvironment.replaceNodeWithMarkupByID = environment.replaceNodeWithMarkupByID;
ReactComponentEnvironment.processChildrenUpdates = environment.processChildrenUpdates;
injected = true;
}
}
};
module.exports = ReactComponentEnvironment;
}).call(this,require('_process'))
},{"_process":164,"fbjs/lib/invariant":151}],40:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactCompositeComponent
*/
'use strict';
var ReactComponentEnvironment = require('./ReactComponentEnvironment');
var ReactCurrentOwner = require('./ReactCurrentOwner');
var ReactElement = require('./ReactElement');
var ReactInstanceMap = require('./ReactInstanceMap');
var ReactPerf = require('./ReactPerf');
var ReactPropTypeLocations = require('./ReactPropTypeLocations');
var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames');
var ReactReconciler = require('./ReactReconciler');
var ReactUpdateQueue = require('./ReactUpdateQueue');
var assign = require('./Object.assign');
var emptyObject = require('fbjs/lib/emptyObject');
var invariant = require('fbjs/lib/invariant');
var shouldUpdateReactComponent = require('./shouldUpdateReactComponent');
var warning = require('fbjs/lib/warning');
function getDeclarationErrorAddendum(component) {
var owner = component._currentElement._owner || null;
if (owner) {
var name = owner.getName();
if (name) {
return ' Check the render method of `' + name + '`.';
}
}
return '';
}
function StatelessComponent(Component) {}
StatelessComponent.prototype.render = function () {
var Component = ReactInstanceMap.get(this)._currentElement.type;
return Component(this.props, this.context, this.updater);
};
/**
* ------------------ The Life-Cycle of a Composite Component ------------------
*
* - constructor: Initialization of state. The instance is now retained.
* - componentWillMount
* - render
* - [children's constructors]
* - [children's componentWillMount and render]
* - [children's componentDidMount]
* - componentDidMount
*
* Update Phases:
* - componentWillReceiveProps (only called if parent updated)
* - shouldComponentUpdate
* - componentWillUpdate
* - render
* - [children's constructors or receive props phases]
* - componentDidUpdate
*
* - componentWillUnmount
* - [children's componentWillUnmount]
* - [children destroyed]
* - (destroyed): The instance is now blank, released by React and ready for GC.
*
* -----------------------------------------------------------------------------
*/
/**
* An incrementing ID assigned to each component when it is mounted. This is
* used to enforce the order in which `ReactUpdates` updates dirty components.
*
* @private
*/
var nextMountID = 1;
/**
* @lends {ReactCompositeComponent.prototype}
*/
var ReactCompositeComponentMixin = {
/**
* Base constructor for all composite component.
*
* @param {ReactElement} element
* @final
* @internal
*/
construct: function (element) {
this._currentElement = element;
this._rootNodeID = null;
this._instance = null;
// See ReactUpdateQueue
this._pendingElement = null;
this._pendingStateQueue = null;
this._pendingReplaceState = false;
this._pendingForceUpdate = false;
this._renderedComponent = null;
this._context = null;
this._mountOrder = 0;
this._topLevelWrapper = null;
// See ReactUpdates and ReactUpdateQueue.
this._pendingCallbacks = null;
},
/**
* Initializes the component, renders markup, and registers event listeners.
*
* @param {string} rootID DOM ID of the root node.
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @return {?string} Rendered markup to be inserted into the DOM.
* @final
* @internal
*/
mountComponent: function (rootID, transaction, context) {
this._context = context;
this._mountOrder = nextMountID++;
this._rootNodeID = rootID;
var publicProps = this._processProps(this._currentElement.props);
var publicContext = this._processContext(context);
var Component = this._currentElement.type;
// Initialize the public class
var inst;
var renderedElement;
// This is a way to detect if Component is a stateless arrow function
// component, which is not newable. It might not be 100% reliable but is
// something we can do until we start detecting that Component extends
// React.Component. We already assume that typeof Component === 'function'.
var canInstantiate = ('prototype' in Component);
if (canInstantiate) {
if (process.env.NODE_ENV !== 'production') {
ReactCurrentOwner.current = this;
try {
inst = new Component(publicProps, publicContext, ReactUpdateQueue);
} finally {
ReactCurrentOwner.current = null;
}
} else {
inst = new Component(publicProps, publicContext, ReactUpdateQueue);
}
}
if (!canInstantiate || inst === null || inst === false || ReactElement.isValidElement(inst)) {
renderedElement = inst;
inst = new StatelessComponent(Component);
}
if (process.env.NODE_ENV !== 'production') {
// This will throw later in _renderValidatedComponent, but add an early
// warning now to help debugging
if (inst.render == null) {
process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`, returned ' + 'null/false from a stateless component, or tried to render an ' + 'element whose type is a function that isn\'t a React component.', Component.displayName || Component.name || 'Component') : undefined;
} else {
// We support ES6 inheriting from React.Component, the module pattern,
// and stateless components, but not ES6 classes that don't extend
process.env.NODE_ENV !== 'production' ? warning(Component.prototype && Component.prototype.isReactComponent || !canInstantiate || !(inst instanceof Component), '%s(...): React component classes must extend React.Component.', Component.displayName || Component.name || 'Component') : undefined;
}
}
// These should be set up in the constructor, but as a convenience for
// simpler class abstractions, we set them up after the fact.
inst.props = publicProps;
inst.context = publicContext;
inst.refs = emptyObject;
inst.updater = ReactUpdateQueue;
this._instance = inst;
// Store a reference from the instance back to the internal representation
ReactInstanceMap.set(inst, this);
if (process.env.NODE_ENV !== 'production') {
// Since plain JS classes are defined without any special initialization
// logic, we can not catch common errors early. Therefore, we have to
// catch them here, at initialization time, instead.
process.env.NODE_ENV !== 'production' ? warning(!inst.getInitialState || inst.getInitialState.isReactClassApproved, 'getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', this.getName() || 'a component') : undefined;
process.env.NODE_ENV !== 'production' ? warning(!inst.getDefaultProps || inst.getDefaultProps.isReactClassApproved, 'getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', this.getName() || 'a component') : undefined;
process.env.NODE_ENV !== 'production' ? warning(!inst.propTypes, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', this.getName() || 'a component') : undefined;
process.env.NODE_ENV !== 'production' ? warning(!inst.contextTypes, 'contextTypes was defined as an instance property on %s. Use a ' + 'static property to define contextTypes instead.', this.getName() || 'a component') : undefined;
process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentShouldUpdate !== 'function', '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', this.getName() || 'A component') : undefined;
process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentDidUnmount !== 'function', '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', this.getName() || 'A component') : undefined;
process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentWillRecieveProps !== 'function', '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', this.getName() || 'A component') : undefined;
}
var initialState = inst.state;
if (initialState === undefined) {
inst.state = initialState = null;
}
!(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.state: must be set to an object or null', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
this._pendingStateQueue = null;
this._pendingReplaceState = false;
this._pendingForceUpdate = false;
if (inst.componentWillMount) {
inst.componentWillMount();
// When mounting, calls to `setState` by `componentWillMount` will set
// `this._pendingStateQueue` without triggering a re-render.
if (this._pendingStateQueue) {
inst.state = this._processPendingState(inst.props, inst.context);
}
}
// If not a stateless component, we now render
if (renderedElement === undefined) {
renderedElement = this._renderValidatedComponent();
}
this._renderedComponent = this._instantiateReactComponent(renderedElement);
var markup = ReactReconciler.mountComponent(this._renderedComponent, rootID, transaction, this._processChildContext(context));
if (inst.componentDidMount) {
transaction.getReactMountReady().enqueue(inst.componentDidMount, inst);
}
return markup;
},
/**
* Releases any resources allocated by `mountComponent`.
*
* @final
* @internal
*/
unmountComponent: function () {
var inst = this._instance;
if (inst.componentWillUnmount) {
inst.componentWillUnmount();
}
ReactReconciler.unmountComponent(this._renderedComponent);
this._renderedComponent = null;
this._instance = null;
// Reset pending fields
// Even if this component is scheduled for another update in ReactUpdates,
// it would still be ignored because these fields are reset.
this._pendingStateQueue = null;
this._pendingReplaceState = false;
this._pendingForceUpdate = false;
this._pendingCallbacks = null;
this._pendingElement = null;
// These fields do not really need to be reset since this object is no
// longer accessible.
this._context = null;
this._rootNodeID = null;
this._topLevelWrapper = null;
// Delete the reference from the instance to this internal representation
// which allow the internals to be properly cleaned up even if the user
// leaks a reference to the public instance.
ReactInstanceMap.remove(inst);
// Some existing components rely on inst.props even after they've been
// destroyed (in event handlers).
// TODO: inst.props = null;
// TODO: inst.state = null;
// TODO: inst.context = null;
},
/**
* Filters the context object to only contain keys specified in
* `contextTypes`
*
* @param {object} context
* @return {?object}
* @private
*/
_maskContext: function (context) {
var maskedContext = null;
var Component = this._currentElement.type;
var contextTypes = Component.contextTypes;
if (!contextTypes) {
return emptyObject;
}
maskedContext = {};
for (var contextName in contextTypes) {
maskedContext[contextName] = context[contextName];
}
return maskedContext;
},
/**
* Filters the context object to only contain keys specified in
* `contextTypes`, and asserts that they are valid.
*
* @param {object} context
* @return {?object}
* @private
*/
_processContext: function (context) {
var maskedContext = this._maskContext(context);
if (process.env.NODE_ENV !== 'production') {
var Component = this._currentElement.type;
if (Component.contextTypes) {
this._checkPropTypes(Component.contextTypes, maskedContext, ReactPropTypeLocations.context);
}
}
return maskedContext;
},
/**
* @param {object} currentContext
* @return {object}
* @private
*/
_processChildContext: function (currentContext) {
var Component = this._currentElement.type;
var inst = this._instance;
var childContext = inst.getChildContext && inst.getChildContext();
if (childContext) {
!(typeof Component.childContextTypes === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
if (process.env.NODE_ENV !== 'production') {
this._checkPropTypes(Component.childContextTypes, childContext, ReactPropTypeLocations.childContext);
}
for (var name in childContext) {
!(name in Component.childContextTypes) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', this.getName() || 'ReactCompositeComponent', name) : invariant(false) : undefined;
}
return assign({}, currentContext, childContext);
}
return currentContext;
},
/**
* Processes props by setting default values for unspecified props and
* asserting that the props are valid. Does not mutate its argument; returns
* a new props object with defaults merged in.
*
* @param {object} newProps
* @return {object}
* @private
*/
_processProps: function (newProps) {
if (process.env.NODE_ENV !== 'production') {
var Component = this._currentElement.type;
if (Component.propTypes) {
this._checkPropTypes(Component.propTypes, newProps, ReactPropTypeLocations.prop);
}
}
return newProps;
},
/**
* Assert that the props are valid
*
* @param {object} propTypes Map of prop name to a ReactPropType
* @param {object} props
* @param {string} location e.g. "prop", "context", "child context"
* @private
*/
_checkPropTypes: function (propTypes, props, location) {
// TODO: Stop validating prop types here and only use the element
// validation.
var componentName = this.getName();
for (var propName in propTypes) {
if (propTypes.hasOwnProperty(propName)) {
var error;
try {
// This is intentionally an invariant that gets caught. It's the same
// behavior as without this statement except with a better message.
!(typeof propTypes[propName] === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually ' + 'from React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], propName) : invariant(false) : undefined;
error = propTypes[propName](props, propName, componentName, location);
} catch (ex) {
error = ex;
}
if (error instanceof Error) {
// We may want to extend this logic for similar errors in
// top-level render calls, so I'm abstracting it away into
// a function to minimize refactoring in the future
var addendum = getDeclarationErrorAddendum(this);
if (location === ReactPropTypeLocations.prop) {
// Preface gives us something to blacklist in warning module
process.env.NODE_ENV !== 'production' ? warning(false, 'Failed Composite propType: %s%s', error.message, addendum) : undefined;
} else {
process.env.NODE_ENV !== 'production' ? warning(false, 'Failed Context Types: %s%s', error.message, addendum) : undefined;
}
}
}
}
},
receiveComponent: function (nextElement, transaction, nextContext) {
var prevElement = this._currentElement;
var prevContext = this._context;
this._pendingElement = null;
this.updateComponent(transaction, prevElement, nextElement, prevContext, nextContext);
},
/**
* If any of `_pendingElement`, `_pendingStateQueue`, or `_pendingForceUpdate`
* is set, update the component.
*
* @param {ReactReconcileTransaction} transaction
* @internal
*/
performUpdateIfNecessary: function (transaction) {
if (this._pendingElement != null) {
ReactReconciler.receiveComponent(this, this._pendingElement || this._currentElement, transaction, this._context);
}
if (this._pendingStateQueue !== null || this._pendingForceUpdate) {
this.updateComponent(transaction, this._currentElement, this._currentElement, this._context, this._context);
}
},
/**
* Perform an update to a mounted component. The componentWillReceiveProps and
* shouldComponentUpdate methods are called, then (assuming the update isn't
* skipped) the remaining update lifecycle methods are called and the DOM
* representation is updated.
*
* By default, this implements React's rendering and reconciliation algorithm.
* Sophisticated clients may wish to override this.
*
* @param {ReactReconcileTransaction} transaction
* @param {ReactElement} prevParentElement
* @param {ReactElement} nextParentElement
* @internal
* @overridable
*/
updateComponent: function (transaction, prevParentElement, nextParentElement, prevUnmaskedContext, nextUnmaskedContext) {
var inst = this._instance;
var nextContext = this._context === nextUnmaskedContext ? inst.context : this._processContext(nextUnmaskedContext);
var nextProps;
// Distinguish between a props update versus a simple state update
if (prevParentElement === nextParentElement) {
// Skip checking prop types again -- we don't read inst.props to avoid
// warning for DOM component props in this upgrade
nextProps = nextParentElement.props;
} else {
nextProps = this._processProps(nextParentElement.props);
// An update here will schedule an update but immediately set
// _pendingStateQueue which will ensure that any state updates gets
// immediately reconciled instead of waiting for the next batch.
if (inst.componentWillReceiveProps) {
inst.componentWillReceiveProps(nextProps, nextContext);
}
}
var nextState = this._processPendingState(nextProps, nextContext);
var shouldUpdate = this._pendingForceUpdate || !inst.shouldComponentUpdate || inst.shouldComponentUpdate(nextProps, nextState, nextContext);
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(typeof shouldUpdate !== 'undefined', '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', this.getName() || 'ReactCompositeComponent') : undefined;
}
if (shouldUpdate) {
this._pendingForceUpdate = false;
// Will set `this.props`, `this.state` and `this.context`.
this._performComponentUpdate(nextParentElement, nextProps, nextState, nextContext, transaction, nextUnmaskedContext);
} else {
// If it's determined that a component should not update, we still want
// to set props and state but we shortcut the rest of the update.
this._currentElement = nextParentElement;
this._context = nextUnmaskedContext;
inst.props = nextProps;
inst.state = nextState;
inst.context = nextContext;
}
},
_processPendingState: function (props, context) {
var inst = this._instance;
var queue = this._pendingStateQueue;
var replace = this._pendingReplaceState;
this._pendingReplaceState = false;
this._pendingStateQueue = null;
if (!queue) {
return inst.state;
}
if (replace && queue.length === 1) {
return queue[0];
}
var nextState = assign({}, replace ? queue[0] : inst.state);
for (var i = replace ? 1 : 0; i < queue.length; i++) {
var partial = queue[i];
assign(nextState, typeof partial === 'function' ? partial.call(inst, nextState, props, context) : partial);
}
return nextState;
},
/**
* Merges new props and state, notifies delegate methods of update and
* performs update.
*
* @param {ReactElement} nextElement Next element
* @param {object} nextProps Next public object to set as properties.
* @param {?object} nextState Next object to set as state.
* @param {?object} nextContext Next public object to set as context.
* @param {ReactReconcileTransaction} transaction
* @param {?object} unmaskedContext
* @private
*/
_performComponentUpdate: function (nextElement, nextProps, nextState, nextContext, transaction, unmaskedContext) {
var inst = this._instance;
var hasComponentDidUpdate = Boolean(inst.componentDidUpdate);
var prevProps;
var prevState;
var prevContext;
if (hasComponentDidUpdate) {
prevProps = inst.props;
prevState = inst.state;
prevContext = inst.context;
}
if (inst.componentWillUpdate) {
inst.componentWillUpdate(nextProps, nextState, nextContext);
}
this._currentElement = nextElement;
this._context = unmaskedContext;
inst.props = nextProps;
inst.state = nextState;
inst.context = nextContext;
this._updateRenderedComponent(transaction, unmaskedContext);
if (hasComponentDidUpdate) {
transaction.getReactMountReady().enqueue(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), inst);
}
},
/**
* Call the component's `render` method and update the DOM accordingly.
*
* @param {ReactReconcileTransaction} transaction
* @internal
*/
_updateRenderedComponent: function (transaction, context) {
var prevComponentInstance = this._renderedComponent;
var prevRenderedElement = prevComponentInstance._currentElement;
var nextRenderedElement = this._renderValidatedComponent();
if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) {
ReactReconciler.receiveComponent(prevComponentInstance, nextRenderedElement, transaction, this._processChildContext(context));
} else {
// These two IDs are actually the same! But nothing should rely on that.
var thisID = this._rootNodeID;
var prevComponentID = prevComponentInstance._rootNodeID;
ReactReconciler.unmountComponent(prevComponentInstance);
this._renderedComponent = this._instantiateReactComponent(nextRenderedElement);
var nextMarkup = ReactReconciler.mountComponent(this._renderedComponent, thisID, transaction, this._processChildContext(context));
this._replaceNodeWithMarkupByID(prevComponentID, nextMarkup);
}
},
/**
* @protected
*/
_replaceNodeWithMarkupByID: function (prevComponentID, nextMarkup) {
ReactComponentEnvironment.replaceNodeWithMarkupByID(prevComponentID, nextMarkup);
},
/**
* @protected
*/
_renderValidatedComponentWithoutOwnerOrContext: function () {
var inst = this._instance;
var renderedComponent = inst.render();
if (process.env.NODE_ENV !== 'production') {
// We allow auto-mocks to proceed as if they're returning null.
if (typeof renderedComponent === 'undefined' && inst.render._isMockFunction) {
// This is probably bad practice. Consider warning here and
// deprecating this convenience.
renderedComponent = null;
}
}
return renderedComponent;
},
/**
* @private
*/
_renderValidatedComponent: function () {
var renderedComponent;
ReactCurrentOwner.current = this;
try {
renderedComponent = this._renderValidatedComponentWithoutOwnerOrContext();
} finally {
ReactCurrentOwner.current = null;
}
!(
// TODO: An `isValidNode` function would probably be more appropriate
renderedComponent === null || renderedComponent === false || ReactElement.isValidElement(renderedComponent)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.render(): A valid ReactComponent must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
return renderedComponent;
},
/**
* Lazily allocates the refs object and stores `component` as `ref`.
*
* @param {string} ref Reference name.
* @param {component} component Component to store as `ref`.
* @final
* @private
*/
attachRef: function (ref, component) {
var inst = this.getPublicInstance();
!(inst != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Stateless function components cannot have refs.') : invariant(false) : undefined;
var publicComponentInstance = component.getPublicInstance();
if (process.env.NODE_ENV !== 'production') {
var componentName = component && component.getName ? component.getName() : 'a component';
process.env.NODE_ENV !== 'production' ? warning(publicComponentInstance != null, 'Stateless function components cannot be given refs ' + '(See ref "%s" in %s created by %s). ' + 'Attempts to access this ref will fail.', ref, componentName, this.getName()) : undefined;
}
var refs = inst.refs === emptyObject ? inst.refs = {} : inst.refs;
refs[ref] = publicComponentInstance;
},
/**
* Detaches a reference name.
*
* @param {string} ref Name to dereference.
* @final
* @private
*/
detachRef: function (ref) {
var refs = this.getPublicInstance().refs;
delete refs[ref];
},
/**
* Get a text description of the component that can be used to identify it
* in error messages.
* @return {string} The name or null.
* @internal
*/
getName: function () {
var type = this._currentElement.type;
var constructor = this._instance && this._instance.constructor;
return type.displayName || constructor && constructor.displayName || type.name || constructor && constructor.name || null;
},
/**
* Get the publicly accessible representation of this component - i.e. what
* is exposed by refs and returned by render. Can be null for stateless
* components.
*
* @return {ReactComponent} the public component instance.
* @internal
*/
getPublicInstance: function () {
var inst = this._instance;
if (inst instanceof StatelessComponent) {
return null;
}
return inst;
},
// Stub
_instantiateReactComponent: null
};
ReactPerf.measureMethods(ReactCompositeComponentMixin, 'ReactCompositeComponent', {
mountComponent: 'mountComponent',
updateComponent: 'updateComponent',
_renderValidatedComponent: '_renderValidatedComponent'
});
var ReactCompositeComponent = {
Mixin: ReactCompositeComponentMixin
};
module.exports = ReactCompositeComponent;
}).call(this,require('_process'))
},{"./Object.assign":29,"./ReactComponentEnvironment":39,"./ReactCurrentOwner":41,"./ReactElement":59,"./ReactInstanceMap":69,"./ReactPerf":78,"./ReactPropTypeLocationNames":79,"./ReactPropTypeLocations":80,"./ReactReconciler":83,"./ReactUpdateQueue":89,"./shouldUpdateReactComponent":133,"_process":164,"fbjs/lib/emptyObject":144,"fbjs/lib/invariant":151,"fbjs/lib/warning":162}],41:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactCurrentOwner
*/
'use strict';
/**
* Keeps track of the current owner.
*
* The current owner is the component who should own any components that are
* currently being constructed.
*/
var ReactCurrentOwner = {
/**
* @internal
* @type {ReactComponent}
*/
current: null
};
module.exports = ReactCurrentOwner;
},{}],42:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOM
*/
/* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/
'use strict';
var ReactCurrentOwner = require('./ReactCurrentOwner');
var ReactDOMTextComponent = require('./ReactDOMTextComponent');
var ReactDefaultInjection = require('./ReactDefaultInjection');
var ReactInstanceHandles = require('./ReactInstanceHandles');
var ReactMount = require('./ReactMount');
var ReactPerf = require('./ReactPerf');
var ReactReconciler = require('./ReactReconciler');
var ReactUpdates = require('./ReactUpdates');
var ReactVersion = require('./ReactVersion');
var findDOMNode = require('./findDOMNode');
var renderSubtreeIntoContainer = require('./renderSubtreeIntoContainer');
var warning = require('fbjs/lib/warning');
ReactDefaultInjection.inject();
var render = ReactPerf.measure('React', 'render', ReactMount.render);
var React = {
findDOMNode: findDOMNode,
render: render,
unmountComponentAtNode: ReactMount.unmountComponentAtNode,
version: ReactVersion,
/* eslint-disable camelcase */
unstable_batchedUpdates: ReactUpdates.batchedUpdates,
unstable_renderSubtreeIntoContainer: renderSubtreeIntoContainer
};
// Inject the runtime into a devtools global hook regardless of browser.
// Allows for debugging when the hook is injected on the page.
/* eslint-enable camelcase */
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {
__REACT_DEVTOOLS_GLOBAL_HOOK__.inject({
CurrentOwner: ReactCurrentOwner,
InstanceHandles: ReactInstanceHandles,
Mount: ReactMount,
Reconciler: ReactReconciler,
TextComponent: ReactDOMTextComponent
});
}
if (process.env.NODE_ENV !== 'production') {
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
if (ExecutionEnvironment.canUseDOM && window.top === window.self) {
// First check if devtools is not installed
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
// If we're in Chrome or Firefox, provide a download link if not installed.
if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) {
console.debug('Download the React DevTools for a better development experience: ' + 'https://fb.me/react-devtools');
}
}
// If we're in IE8, check to see if we are in compatibility mode and provide
// information on preventing compatibility mode
var ieCompatibilityMode = document.documentMode && document.documentMode < 8;
process.env.NODE_ENV !== 'production' ? warning(!ieCompatibilityMode, 'Internet Explorer is running in compatibility mode; please add the ' + 'following tag to your HTML to prevent this from happening: ' + '<meta http-equiv="X-UA-Compatible" content="IE=edge" />') : undefined;
var expectedFeatures = [
// shims
Array.isArray, Array.prototype.every, Array.prototype.forEach, Array.prototype.indexOf, Array.prototype.map, Date.now, Function.prototype.bind, Object.keys, String.prototype.split, String.prototype.trim,
// shams
Object.create, Object.freeze];
for (var i = 0; i < expectedFeatures.length; i++) {
if (!expectedFeatures[i]) {
console.error('One or more ES5 shim/shams expected by React are not available: ' + 'https://fb.me/react-warning-polyfills');
break;
}
}
}
}
module.exports = React;
}).call(this,require('_process'))
},{"./ReactCurrentOwner":41,"./ReactDOMTextComponent":53,"./ReactDefaultInjection":56,"./ReactInstanceHandles":68,"./ReactMount":72,"./ReactPerf":78,"./ReactReconciler":83,"./ReactUpdates":90,"./ReactVersion":91,"./findDOMNode":115,"./renderSubtreeIntoContainer":130,"_process":164,"fbjs/lib/ExecutionEnvironment":137,"fbjs/lib/warning":162}],43:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOMButton
*/
'use strict';
var mouseListenerNames = {
onClick: true,
onDoubleClick: true,
onMouseDown: true,
onMouseMove: true,
onMouseUp: true,
onClickCapture: true,
onDoubleClickCapture: true,
onMouseDownCapture: true,
onMouseMoveCapture: true,
onMouseUpCapture: true
};
/**
* Implements a <button> native component that does not receive mouse events
* when `disabled` is set.
*/
var ReactDOMButton = {
getNativeProps: function (inst, props, context) {
if (!props.disabled) {
return props;
}
// Copy the props, except the mouse listeners
var nativeProps = {};
for (var key in props) {
if (props.hasOwnProperty(key) && !mouseListenerNames[key]) {
nativeProps[key] = props[key];
}
}
return nativeProps;
}
};
module.exports = ReactDOMButton;
},{}],44:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOMComponent
* @typechecks static-only
*/
/* global hasOwnProperty:true */
'use strict';
var AutoFocusUtils = require('./AutoFocusUtils');
var CSSPropertyOperations = require('./CSSPropertyOperations');
var DOMProperty = require('./DOMProperty');
var DOMPropertyOperations = require('./DOMPropertyOperations');
var EventConstants = require('./EventConstants');
var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
var ReactComponentBrowserEnvironment = require('./ReactComponentBrowserEnvironment');
var ReactDOMButton = require('./ReactDOMButton');
var ReactDOMInput = require('./ReactDOMInput');
var ReactDOMOption = require('./ReactDOMOption');
var ReactDOMSelect = require('./ReactDOMSelect');
var ReactDOMTextarea = require('./ReactDOMTextarea');
var ReactMount = require('./ReactMount');
var ReactMultiChild = require('./ReactMultiChild');
var ReactPerf = require('./ReactPerf');
var ReactUpdateQueue = require('./ReactUpdateQueue');
var assign = require('./Object.assign');
var canDefineProperty = require('./canDefineProperty');
var escapeTextContentForBrowser = require('./escapeTextContentForBrowser');
var invariant = require('fbjs/lib/invariant');
var isEventSupported = require('./isEventSupported');
var keyOf = require('fbjs/lib/keyOf');
var setInnerHTML = require('./setInnerHTML');
var setTextContent = require('./setTextContent');
var shallowEqual = require('fbjs/lib/shallowEqual');
var validateDOMNesting = require('./validateDOMNesting');
var warning = require('fbjs/lib/warning');
var deleteListener = ReactBrowserEventEmitter.deleteListener;
var listenTo = ReactBrowserEventEmitter.listenTo;
var registrationNameModules = ReactBrowserEventEmitter.registrationNameModules;
// For quickly matching children type, to test if can be treated as content.
var CONTENT_TYPES = { 'string': true, 'number': true };
var CHILDREN = keyOf({ children: null });
var STYLE = keyOf({ style: null });
var HTML = keyOf({ __html: null });
var ELEMENT_NODE_TYPE = 1;
function getDeclarationErrorAddendum(internalInstance) {
if (internalInstance) {
var owner = internalInstance._currentElement._owner || null;
if (owner) {
var name = owner.getName();
if (name) {
return ' This DOM node was rendered by `' + name + '`.';
}
}
}
return '';
}
var legacyPropsDescriptor;
if (process.env.NODE_ENV !== 'production') {
legacyPropsDescriptor = {
props: {
enumerable: false,
get: function () {
var component = this._reactInternalComponent;
process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .props of a DOM node; instead, ' + 'recreate the props as `render` did originally or read the DOM ' + 'properties/attributes directly from this node (e.g., ' + 'this.refs.box.className).%s', getDeclarationErrorAddendum(component)) : undefined;
return component._currentElement.props;
}
}
};
}
function legacyGetDOMNode() {
if (process.env.NODE_ENV !== 'production') {
var component = this._reactInternalComponent;
process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .getDOMNode() of a DOM node; ' + 'instead, use the node directly.%s', getDeclarationErrorAddendum(component)) : undefined;
}
return this;
}
function legacyIsMounted() {
var component = this._reactInternalComponent;
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .isMounted() of a DOM node.%s', getDeclarationErrorAddendum(component)) : undefined;
}
return !!component;
}
function legacySetStateEtc() {
if (process.env.NODE_ENV !== 'production') {
var component = this._reactInternalComponent;
process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .setState(), .replaceState(), or ' + '.forceUpdate() of a DOM node. This is a no-op.%s', getDeclarationErrorAddendum(component)) : undefined;
}
}
function legacySetProps(partialProps, callback) {
var component = this._reactInternalComponent;
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .setProps() of a DOM node. ' + 'Instead, call ReactDOM.render again at the top level.%s', getDeclarationErrorAddendum(component)) : undefined;
}
if (!component) {
return;
}
ReactUpdateQueue.enqueueSetPropsInternal(component, partialProps);
if (callback) {
ReactUpdateQueue.enqueueCallbackInternal(component, callback);
}
}
function legacyReplaceProps(partialProps, callback) {
var component = this._reactInternalComponent;
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .replaceProps() of a DOM node. ' + 'Instead, call ReactDOM.render again at the top level.%s', getDeclarationErrorAddendum(component)) : undefined;
}
if (!component) {
return;
}
ReactUpdateQueue.enqueueReplacePropsInternal(component, partialProps);
if (callback) {
ReactUpdateQueue.enqueueCallbackInternal(component, callback);
}
}
function friendlyStringify(obj) {
if (typeof obj === 'object') {
if (Array.isArray(obj)) {
return '[' + obj.map(friendlyStringify).join(', ') + ']';
} else {
var pairs = [];
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var keyEscaped = /^[a-z$_][\w$_]*$/i.test(key) ? key : JSON.stringify(key);
pairs.push(keyEscaped + ': ' + friendlyStringify(obj[key]));
}
}
return '{' + pairs.join(', ') + '}';
}
} else if (typeof obj === 'string') {
return JSON.stringify(obj);
} else if (typeof obj === 'function') {
return '[function object]';
}
// Differs from JSON.stringify in that undefined becauses undefined and that
// inf and nan don't become null
return String(obj);
}
var styleMutationWarning = {};
function checkAndWarnForMutatedStyle(style1, style2, component) {
if (style1 == null || style2 == null) {
return;
}
if (shallowEqual(style1, style2)) {
return;
}
var componentName = component._tag;
var owner = component._currentElement._owner;
var ownerName;
if (owner) {
ownerName = owner.getName();
}
var hash = ownerName + '|' + componentName;
if (styleMutationWarning.hasOwnProperty(hash)) {
return;
}
styleMutationWarning[hash] = true;
process.env.NODE_ENV !== 'production' ? warning(false, '`%s` was passed a style object that has previously been mutated. ' + 'Mutating `style` is deprecated. Consider cloning it beforehand. Check ' + 'the `render` %s. Previous style: %s. Mutated style: %s.', componentName, owner ? 'of `' + ownerName + '`' : 'using <' + componentName + '>', friendlyStringify(style1), friendlyStringify(style2)) : undefined;
}
/**
* @param {object} component
* @param {?object} props
*/
function assertValidProps(component, props) {
if (!props) {
return;
}
// Note the use of `==` which checks for null or undefined.
if (process.env.NODE_ENV !== 'production') {
if (voidElementTags[component._tag]) {
process.env.NODE_ENV !== 'production' ? warning(props.children == null && props.dangerouslySetInnerHTML == null, '%s is a void element tag and must not have `children` or ' + 'use `props.dangerouslySetInnerHTML`.%s', component._tag, component._currentElement._owner ? ' Check the render method of ' + component._currentElement._owner.getName() + '.' : '') : undefined;
}
}
if (props.dangerouslySetInnerHTML != null) {
!(props.children == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : invariant(false) : undefined;
!(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML) ? process.env.NODE_ENV !== 'production' ? invariant(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' + 'Please visit https://fb.me/react-invariant-dangerously-set-inner-html ' + 'for more information.') : invariant(false) : undefined;
}
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(props.innerHTML == null, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.') : undefined;
process.env.NODE_ENV !== 'production' ? warning(!props.contentEditable || props.children == null, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.') : undefined;
}
!(props.style == null || typeof props.style === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'The `style` prop expects a mapping from style properties to values, ' + 'not a string. For example, style={{marginRight: spacing + \'em\'}} when ' + 'using JSX.%s', getDeclarationErrorAddendum(component)) : invariant(false) : undefined;
}
function enqueuePutListener(id, registrationName, listener, transaction) {
if (process.env.NODE_ENV !== 'production') {
// IE8 has no API for event capturing and the `onScroll` event doesn't
// bubble.
process.env.NODE_ENV !== 'production' ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), 'This browser doesn\'t support the `onScroll` event') : undefined;
}
var container = ReactMount.findReactContainerForID(id);
if (container) {
var doc = container.nodeType === ELEMENT_NODE_TYPE ? container.ownerDocument : container;
listenTo(registrationName, doc);
}
transaction.getReactMountReady().enqueue(putListener, {
id: id,
registrationName: registrationName,
listener: listener
});
}
function putListener() {
var listenerToPut = this;
ReactBrowserEventEmitter.putListener(listenerToPut.id, listenerToPut.registrationName, listenerToPut.listener);
}
// There are so many media events, it makes sense to just
// maintain a list rather than create a `trapBubbledEvent` for each
var mediaEvents = {
topAbort: 'abort',
topCanPlay: 'canplay',
topCanPlayThrough: 'canplaythrough',
topDurationChange: 'durationchange',
topEmptied: 'emptied',
topEncrypted: 'encrypted',
topEnded: 'ended',
topError: 'error',
topLoadedData: 'loadeddata',
topLoadedMetadata: 'loadedmetadata',
topLoadStart: 'loadstart',
topPause: 'pause',
topPlay: 'play',
topPlaying: 'playing',
topProgress: 'progress',
topRateChange: 'ratechange',
topSeeked: 'seeked',
topSeeking: 'seeking',
topStalled: 'stalled',
topSuspend: 'suspend',
topTimeUpdate: 'timeupdate',
topVolumeChange: 'volumechange',
topWaiting: 'waiting'
};
function trapBubbledEventsLocal() {
var inst = this;
// If a component renders to null or if another component fatals and causes
// the state of the tree to be corrupted, `node` here can be null.
!inst._rootNodeID ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Must be mounted to trap events') : invariant(false) : undefined;
var node = ReactMount.getNode(inst._rootNodeID);
!node ? process.env.NODE_ENV !== 'production' ? invariant(false, 'trapBubbledEvent(...): Requires node to be rendered.') : invariant(false) : undefined;
switch (inst._tag) {
case 'iframe':
inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load', node)];
break;
case 'video':
case 'audio':
inst._wrapperState.listeners = [];
// create listener for each media event
for (var event in mediaEvents) {
if (mediaEvents.hasOwnProperty(event)) {
inst._wrapperState.listeners.push(ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes[event], mediaEvents[event], node));
}
}
break;
case 'img':
inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topError, 'error', node), ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load', node)];
break;
case 'form':
inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topReset, 'reset', node), ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topSubmit, 'submit', node)];
break;
}
}
function mountReadyInputWrapper() {
ReactDOMInput.mountReadyWrapper(this);
}
function postUpdateSelectWrapper() {
ReactDOMSelect.postUpdateWrapper(this);
}
// For HTML, certain tags should omit their close tag. We keep a whitelist for
// those special cased tags.
var omittedCloseTags = {
'area': true,
'base': true,
'br': true,
'col': true,
'embed': true,
'hr': true,
'img': true,
'input': true,
'keygen': true,
'link': true,
'meta': true,
'param': true,
'source': true,
'track': true,
'wbr': true
};
// NOTE: menuitem's close tag should be omitted, but that causes problems.
var newlineEatingTags = {
'listing': true,
'pre': true,
'textarea': true
};
// For HTML, certain tags cannot have children. This has the same purpose as
// `omittedCloseTags` except that `menuitem` should still have its closing tag.
var voidElementTags = assign({
'menuitem': true
}, omittedCloseTags);
// We accept any tag to be rendered but since this gets injected into arbitrary
// HTML, we want to make sure that it's a safe tag.
// http://www.w3.org/TR/REC-xml/#NT-Name
var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset
var validatedTagCache = {};
var hasOwnProperty = ({}).hasOwnProperty;
function validateDangerousTag(tag) {
if (!hasOwnProperty.call(validatedTagCache, tag)) {
!VALID_TAG_REGEX.test(tag) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Invalid tag: %s', tag) : invariant(false) : undefined;
validatedTagCache[tag] = true;
}
}
function processChildContextDev(context, inst) {
// Pass down our tag name to child components for validation purposes
context = assign({}, context);
var info = context[validateDOMNesting.ancestorInfoContextKey];
context[validateDOMNesting.ancestorInfoContextKey] = validateDOMNesting.updatedAncestorInfo(info, inst._tag, inst);
return context;
}
function isCustomComponent(tagName, props) {
return tagName.indexOf('-') >= 0 || props.is != null;
}
/**
* Creates a new React class that is idempotent and capable of containing other
* React components. It accepts event listeners and DOM properties that are
* valid according to `DOMProperty`.
*
* - Event listeners: `onClick`, `onMouseDown`, etc.
* - DOM properties: `className`, `name`, `title`, etc.
*
* The `style` property functions differently from the DOM API. It accepts an
* object mapping of style properties to values.
*
* @constructor ReactDOMComponent
* @extends ReactMultiChild
*/
function ReactDOMComponent(tag) {
validateDangerousTag(tag);
this._tag = tag.toLowerCase();
this._renderedChildren = null;
this._previousStyle = null;
this._previousStyleCopy = null;
this._rootNodeID = null;
this._wrapperState = null;
this._topLevelWrapper = null;
this._nodeWithLegacyProperties = null;
if (process.env.NODE_ENV !== 'production') {
this._unprocessedContextDev = null;
this._processedContextDev = null;
}
}
ReactDOMComponent.displayName = 'ReactDOMComponent';
ReactDOMComponent.Mixin = {
construct: function (element) {
this._currentElement = element;
},
/**
* Generates root tag markup then recurses. This method has side effects and
* is not idempotent.
*
* @internal
* @param {string} rootID The root DOM ID for this node.
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @param {object} context
* @return {string} The computed markup.
*/
mountComponent: function (rootID, transaction, context) {
this._rootNodeID = rootID;
var props = this._currentElement.props;
switch (this._tag) {
case 'iframe':
case 'img':
case 'form':
case 'video':
case 'audio':
this._wrapperState = {
listeners: null
};
transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
break;
case 'button':
props = ReactDOMButton.getNativeProps(this, props, context);
break;
case 'input':
ReactDOMInput.mountWrapper(this, props, context);
props = ReactDOMInput.getNativeProps(this, props, context);
break;
case 'option':
ReactDOMOption.mountWrapper(this, props, context);
props = ReactDOMOption.getNativeProps(this, props, context);
break;
case 'select':
ReactDOMSelect.mountWrapper(this, props, context);
props = ReactDOMSelect.getNativeProps(this, props, context);
context = ReactDOMSelect.processChildContext(this, props, context);
break;
case 'textarea':
ReactDOMTextarea.mountWrapper(this, props, context);
props = ReactDOMTextarea.getNativeProps(this, props, context);
break;
}
assertValidProps(this, props);
if (process.env.NODE_ENV !== 'production') {
if (context[validateDOMNesting.ancestorInfoContextKey]) {
validateDOMNesting(this._tag, this, context[validateDOMNesting.ancestorInfoContextKey]);
}
}
if (process.env.NODE_ENV !== 'production') {
this._unprocessedContextDev = context;
this._processedContextDev = processChildContextDev(context, this);
context = this._processedContextDev;
}
var mountImage;
if (transaction.useCreateElement) {
var ownerDocument = context[ReactMount.ownerDocumentContextKey];
var el = ownerDocument.createElement(this._currentElement.type);
DOMPropertyOperations.setAttributeForID(el, this._rootNodeID);
// Populate node cache
ReactMount.getID(el);
this._updateDOMProperties({}, props, transaction, el);
this._createInitialChildren(transaction, props, context, el);
mountImage = el;
} else {
var tagOpen = this._createOpenTagMarkupAndPutListeners(transaction, props);
var tagContent = this._createContentMarkup(transaction, props, context);
if (!tagContent && omittedCloseTags[this._tag]) {
mountImage = tagOpen + '/>';
} else {
mountImage = tagOpen + '>' + tagContent + '</' + this._currentElement.type + '>';
}
}
switch (this._tag) {
case 'input':
transaction.getReactMountReady().enqueue(mountReadyInputWrapper, this);
// falls through
case 'button':
case 'select':
case 'textarea':
if (props.autoFocus) {
transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
}
break;
}
return mountImage;
},
/**
* Creates markup for the open tag and all attributes.
*
* This method has side effects because events get registered.
*
* Iterating over object properties is faster than iterating over arrays.
* @see http://jsperf.com/obj-vs-arr-iteration
*
* @private
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @param {object} props
* @return {string} Markup of opening tag.
*/
_createOpenTagMarkupAndPutListeners: function (transaction, props) {
var ret = '<' + this._currentElement.type;
for (var propKey in props) {
if (!props.hasOwnProperty(propKey)) {
continue;
}
var propValue = props[propKey];
if (propValue == null) {
continue;
}
if (registrationNameModules.hasOwnProperty(propKey)) {
if (propValue) {
enqueuePutListener(this._rootNodeID, propKey, propValue, transaction);
}
} else {
if (propKey === STYLE) {
if (propValue) {
if (process.env.NODE_ENV !== 'production') {
// See `_updateDOMProperties`. style block
this._previousStyle = propValue;
}
propValue = this._previousStyleCopy = assign({}, props.style);
}
propValue = CSSPropertyOperations.createMarkupForStyles(propValue);
}
var markup = null;
if (this._tag != null && isCustomComponent(this._tag, props)) {
if (propKey !== CHILDREN) {
markup = DOMPropertyOperations.createMarkupForCustomAttribute(propKey, propValue);
}
} else {
markup = DOMPropertyOperations.createMarkupForProperty(propKey, propValue);
}
if (markup) {
ret += ' ' + markup;
}
}
}
// For static pages, no need to put React ID and checksum. Saves lots of
// bytes.
if (transaction.renderToStaticMarkup) {
return ret;
}
var markupForID = DOMPropertyOperations.createMarkupForID(this._rootNodeID);
return ret + ' ' + markupForID;
},
/**
* Creates markup for the content between the tags.
*
* @private
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @param {object} props
* @param {object} context
* @return {string} Content markup.
*/
_createContentMarkup: function (transaction, props, context) {
var ret = '';
// Intentional use of != to avoid catching zero/false.
var innerHTML = props.dangerouslySetInnerHTML;
if (innerHTML != null) {
if (innerHTML.__html != null) {
ret = innerHTML.__html;
}
} else {
var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
var childrenToUse = contentToUse != null ? null : props.children;
if (contentToUse != null) {
// TODO: Validate that text is allowed as a child of this node
ret = escapeTextContentForBrowser(contentToUse);
} else if (childrenToUse != null) {
var mountImages = this.mountChildren(childrenToUse, transaction, context);
ret = mountImages.join('');
}
}
if (newlineEatingTags[this._tag] && ret.charAt(0) === '\n') {
// text/html ignores the first character in these tags if it's a newline
// Prefer to break application/xml over text/html (for now) by adding
// a newline specifically to get eaten by the parser. (Alternately for
// textareas, replacing "^\n" with "\r\n" doesn't get eaten, and the first
// \r is normalized out by HTMLTextAreaElement#value.)
// See: <http://www.w3.org/TR/html-polyglot/#newlines-in-textarea-and-pre>
// See: <http://www.w3.org/TR/html5/syntax.html#element-restrictions>
// See: <http://www.w3.org/TR/html5/syntax.html#newlines>
// See: Parsing of "textarea" "listing" and "pre" elements
// from <http://www.w3.org/TR/html5/syntax.html#parsing-main-inbody>
return '\n' + ret;
} else {
return ret;
}
},
_createInitialChildren: function (transaction, props, context, el) {
// Intentional use of != to avoid catching zero/false.
var innerHTML = props.dangerouslySetInnerHTML;
if (innerHTML != null) {
if (innerHTML.__html != null) {
setInnerHTML(el, innerHTML.__html);
}
} else {
var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
var childrenToUse = contentToUse != null ? null : props.children;
if (contentToUse != null) {
// TODO: Validate that text is allowed as a child of this node
setTextContent(el, contentToUse);
} else if (childrenToUse != null) {
var mountImages = this.mountChildren(childrenToUse, transaction, context);
for (var i = 0; i < mountImages.length; i++) {
el.appendChild(mountImages[i]);
}
}
}
},
/**
* Receives a next element and updates the component.
*
* @internal
* @param {ReactElement} nextElement
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @param {object} context
*/
receiveComponent: function (nextElement, transaction, context) {
var prevElement = this._currentElement;
this._currentElement = nextElement;
this.updateComponent(transaction, prevElement, nextElement, context);
},
/**
* Updates a native DOM component after it has already been allocated and
* attached to the DOM. Reconciles the root DOM node, then recurses.
*
* @param {ReactReconcileTransaction} transaction
* @param {ReactElement} prevElement
* @param {ReactElement} nextElement
* @internal
* @overridable
*/
updateComponent: function (transaction, prevElement, nextElement, context) {
var lastProps = prevElement.props;
var nextProps = this._currentElement.props;
switch (this._tag) {
case 'button':
lastProps = ReactDOMButton.getNativeProps(this, lastProps);
nextProps = ReactDOMButton.getNativeProps(this, nextProps);
break;
case 'input':
ReactDOMInput.updateWrapper(this);
lastProps = ReactDOMInput.getNativeProps(this, lastProps);
nextProps = ReactDOMInput.getNativeProps(this, nextProps);
break;
case 'option':
lastProps = ReactDOMOption.getNativeProps(this, lastProps);
nextProps = ReactDOMOption.getNativeProps(this, nextProps);
break;
case 'select':
lastProps = ReactDOMSelect.getNativeProps(this, lastProps);
nextProps = ReactDOMSelect.getNativeProps(this, nextProps);
break;
case 'textarea':
ReactDOMTextarea.updateWrapper(this);
lastProps = ReactDOMTextarea.getNativeProps(this, lastProps);
nextProps = ReactDOMTextarea.getNativeProps(this, nextProps);
break;
}
if (process.env.NODE_ENV !== 'production') {
// If the context is reference-equal to the old one, pass down the same
// processed object so the update bailout in ReactReconciler behaves
// correctly (and identically in dev and prod). See #5005.
if (this._unprocessedContextDev !== context) {
this._unprocessedContextDev = context;
this._processedContextDev = processChildContextDev(context, this);
}
context = this._processedContextDev;
}
assertValidProps(this, nextProps);
this._updateDOMProperties(lastProps, nextProps, transaction, null);
this._updateDOMChildren(lastProps, nextProps, transaction, context);
if (!canDefineProperty && this._nodeWithLegacyProperties) {
this._nodeWithLegacyProperties.props = nextProps;
}
if (this._tag === 'select') {
// <select> value update needs to occur after <option> children
// reconciliation
transaction.getReactMountReady().enqueue(postUpdateSelectWrapper, this);
}
},
/**
* Reconciles the properties by detecting differences in property values and
* updating the DOM as necessary. This function is probably the single most
* critical path for performance optimization.
*
* TODO: Benchmark whether checking for changed values in memory actually
* improves performance (especially statically positioned elements).
* TODO: Benchmark the effects of putting this at the top since 99% of props
* do not change for a given reconciliation.
* TODO: Benchmark areas that can be improved with caching.
*
* @private
* @param {object} lastProps
* @param {object} nextProps
* @param {ReactReconcileTransaction} transaction
* @param {?DOMElement} node
*/
_updateDOMProperties: function (lastProps, nextProps, transaction, node) {
var propKey;
var styleName;
var styleUpdates;
for (propKey in lastProps) {
if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey)) {
continue;
}
if (propKey === STYLE) {
var lastStyle = this._previousStyleCopy;
for (styleName in lastStyle) {
if (lastStyle.hasOwnProperty(styleName)) {
styleUpdates = styleUpdates || {};
styleUpdates[styleName] = '';
}
}
this._previousStyleCopy = null;
} else if (registrationNameModules.hasOwnProperty(propKey)) {
if (lastProps[propKey]) {
// Only call deleteListener if there was a listener previously or
// else willDeleteListener gets called when there wasn't actually a
// listener (e.g., onClick={null})
deleteListener(this._rootNodeID, propKey);
}
} else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
if (!node) {
node = ReactMount.getNode(this._rootNodeID);
}
DOMPropertyOperations.deleteValueForProperty(node, propKey);
}
}
for (propKey in nextProps) {
var nextProp = nextProps[propKey];
var lastProp = propKey === STYLE ? this._previousStyleCopy : lastProps[propKey];
if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp) {
continue;
}
if (propKey === STYLE) {
if (nextProp) {
if (process.env.NODE_ENV !== 'production') {
checkAndWarnForMutatedStyle(this._previousStyleCopy, this._previousStyle, this);
this._previousStyle = nextProp;
}
nextProp = this._previousStyleCopy = assign({}, nextProp);
} else {
this._previousStyleCopy = null;
}
if (lastProp) {
// Unset styles on `lastProp` but not on `nextProp`.
for (styleName in lastProp) {
if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) {
styleUpdates = styleUpdates || {};
styleUpdates[styleName] = '';
}
}
// Update styles that changed since `lastProp`.
for (styleName in nextProp) {
if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) {
styleUpdates = styleUpdates || {};
styleUpdates[styleName] = nextProp[styleName];
}
}
} else {
// Relies on `updateStylesByID` not mutating `styleUpdates`.
styleUpdates = nextProp;
}
} else if (registrationNameModules.hasOwnProperty(propKey)) {
if (nextProp) {
enqueuePutListener(this._rootNodeID, propKey, nextProp, transaction);
} else if (lastProp) {
deleteListener(this._rootNodeID, propKey);
}
} else if (isCustomComponent(this._tag, nextProps)) {
if (!node) {
node = ReactMount.getNode(this._rootNodeID);
}
if (propKey === CHILDREN) {
nextProp = null;
}
DOMPropertyOperations.setValueForAttribute(node, propKey, nextProp);
} else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
if (!node) {
node = ReactMount.getNode(this._rootNodeID);
}
// If we're updating to null or undefined, we should remove the property
// from the DOM node instead of inadvertantly setting to a string. This
// brings us in line with the same behavior we have on initial render.
if (nextProp != null) {
DOMPropertyOperations.setValueForProperty(node, propKey, nextProp);
} else {
DOMPropertyOperations.deleteValueForProperty(node, propKey);
}
}
}
if (styleUpdates) {
if (!node) {
node = ReactMount.getNode(this._rootNodeID);
}
CSSPropertyOperations.setValueForStyles(node, styleUpdates);
}
},
/**
* Reconciles the children with the various properties that affect the
* children content.
*
* @param {object} lastProps
* @param {object} nextProps
* @param {ReactReconcileTransaction} transaction
* @param {object} context
*/
_updateDOMChildren: function (lastProps, nextProps, transaction, context) {
var lastContent = CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null;
var nextContent = CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null;
var lastHtml = lastProps.dangerouslySetInnerHTML && lastProps.dangerouslySetInnerHTML.__html;
var nextHtml = nextProps.dangerouslySetInnerHTML && nextProps.dangerouslySetInnerHTML.__html;
// Note the use of `!=` which checks for null or undefined.
var lastChildren = lastContent != null ? null : lastProps.children;
var nextChildren = nextContent != null ? null : nextProps.children;
// If we're switching from children to content/html or vice versa, remove
// the old content
var lastHasContentOrHtml = lastContent != null || lastHtml != null;
var nextHasContentOrHtml = nextContent != null || nextHtml != null;
if (lastChildren != null && nextChildren == null) {
this.updateChildren(null, transaction, context);
} else if (lastHasContentOrHtml && !nextHasContentOrHtml) {
this.updateTextContent('');
}
if (nextContent != null) {
if (lastContent !== nextContent) {
this.updateTextContent('' + nextContent);
}
} else if (nextHtml != null) {
if (lastHtml !== nextHtml) {
this.updateMarkup('' + nextHtml);
}
} else if (nextChildren != null) {
this.updateChildren(nextChildren, transaction, context);
}
},
/**
* Destroys all event registrations for this instance. Does not remove from
* the DOM. That must be done by the parent.
*
* @internal
*/
unmountComponent: function () {
switch (this._tag) {
case 'iframe':
case 'img':
case 'form':
case 'video':
case 'audio':
var listeners = this._wrapperState.listeners;
if (listeners) {
for (var i = 0; i < listeners.length; i++) {
listeners[i].remove();
}
}
break;
case 'input':
ReactDOMInput.unmountWrapper(this);
break;
case 'html':
case 'head':
case 'body':
/**
* Components like <html> <head> and <body> can't be removed or added
* easily in a cross-browser way, however it's valuable to be able to
* take advantage of React's reconciliation for styling and <title>
* management. So we just document it and throw in dangerous cases.
*/
!false ? process.env.NODE_ENV !== 'production' ? invariant(false, '<%s> tried to unmount. Because of cross-browser quirks it is ' + 'impossible to unmount some top-level components (eg <html>, ' + '<head>, and <body>) reliably and efficiently. To fix this, have a ' + 'single top-level component that never unmounts render these ' + 'elements.', this._tag) : invariant(false) : undefined;
break;
}
this.unmountChildren();
ReactBrowserEventEmitter.deleteAllListeners(this._rootNodeID);
ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
this._rootNodeID = null;
this._wrapperState = null;
if (this._nodeWithLegacyProperties) {
var node = this._nodeWithLegacyProperties;
node._reactInternalComponent = null;
this._nodeWithLegacyProperties = null;
}
},
getPublicInstance: function () {
if (!this._nodeWithLegacyProperties) {
var node = ReactMount.getNode(this._rootNodeID);
node._reactInternalComponent = this;
node.getDOMNode = legacyGetDOMNode;
node.isMounted = legacyIsMounted;
node.setState = legacySetStateEtc;
node.replaceState = legacySetStateEtc;
node.forceUpdate = legacySetStateEtc;
node.setProps = legacySetProps;
node.replaceProps = legacyReplaceProps;
if (process.env.NODE_ENV !== 'production') {
if (canDefineProperty) {
Object.defineProperties(node, legacyPropsDescriptor);
} else {
// updateComponent will update this property on subsequent renders
node.props = this._currentElement.props;
}
} else {
// updateComponent will update this property on subsequent renders
node.props = this._currentElement.props;
}
this._nodeWithLegacyProperties = node;
}
return this._nodeWithLegacyProperties;
}
};
ReactPerf.measureMethods(ReactDOMComponent, 'ReactDOMComponent', {
mountComponent: 'mountComponent',
updateComponent: 'updateComponent'
});
assign(ReactDOMComponent.prototype, ReactDOMComponent.Mixin, ReactMultiChild.Mixin);
module.exports = ReactDOMComponent;
}).call(this,require('_process'))
},{"./AutoFocusUtils":8,"./CSSPropertyOperations":11,"./DOMProperty":16,"./DOMPropertyOperations":17,"./EventConstants":21,"./Object.assign":29,"./ReactBrowserEventEmitter":33,"./ReactComponentBrowserEnvironment":38,"./ReactDOMButton":43,"./ReactDOMInput":48,"./ReactDOMOption":49,"./ReactDOMSelect":50,"./ReactDOMTextarea":54,"./ReactMount":72,"./ReactMultiChild":73,"./ReactPerf":78,"./ReactUpdateQueue":89,"./canDefineProperty":111,"./escapeTextContentForBrowser":114,"./isEventSupported":126,"./setInnerHTML":131,"./setTextContent":132,"./validateDOMNesting":135,"_process":164,"fbjs/lib/invariant":151,"fbjs/lib/keyOf":155,"fbjs/lib/shallowEqual":160,"fbjs/lib/warning":162}],45:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOMFactories
* @typechecks static-only
*/
'use strict';
var ReactElement = require('./ReactElement');
var ReactElementValidator = require('./ReactElementValidator');
var mapObject = require('fbjs/lib/mapObject');
/**
* Create a factory that creates HTML tag elements.
*
* @param {string} tag Tag name (e.g. `div`).
* @private
*/
function createDOMFactory(tag) {
if (process.env.NODE_ENV !== 'production') {
return ReactElementValidator.createFactory(tag);
}
return ReactElement.createFactory(tag);
}
/**
* Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
* This is also accessible via `React.DOM`.
*
* @public
*/
var ReactDOMFactories = mapObject({
a: 'a',
abbr: 'abbr',
address: 'address',
area: 'area',
article: 'article',
aside: 'aside',
audio: 'audio',
b: 'b',
base: 'base',
bdi: 'bdi',
bdo: 'bdo',
big: 'big',
blockquote: 'blockquote',
body: 'body',
br: 'br',
button: 'button',
canvas: 'canvas',
caption: 'caption',
cite: 'cite',
code: 'code',
col: 'col',
colgroup: 'colgroup',
data: 'data',
datalist: 'datalist',
dd: 'dd',
del: 'del',
details: 'details',
dfn: 'dfn',
dialog: 'dialog',
div: 'div',
dl: 'dl',
dt: 'dt',
em: 'em',
embed: 'embed',
fieldset: 'fieldset',
figcaption: 'figcaption',
figure: 'figure',
footer: 'footer',
form: 'form',
h1: 'h1',
h2: 'h2',
h3: 'h3',
h4: 'h4',
h5: 'h5',
h6: 'h6',
head: 'head',
header: 'header',
hgroup: 'hgroup',
hr: 'hr',
html: 'html',
i: 'i',
iframe: 'iframe',
img: 'img',
input: 'input',
ins: 'ins',
kbd: 'kbd',
keygen: 'keygen',
label: 'label',
legend: 'legend',
li: 'li',
link: 'link',
main: 'main',
map: 'map',
mark: 'mark',
menu: 'menu',
menuitem: 'menuitem',
meta: 'meta',
meter: 'meter',
nav: 'nav',
noscript: 'noscript',
object: 'object',
ol: 'ol',
optgroup: 'optgroup',
option: 'option',
output: 'output',
p: 'p',
param: 'param',
picture: 'picture',
pre: 'pre',
progress: 'progress',
q: 'q',
rp: 'rp',
rt: 'rt',
ruby: 'ruby',
s: 's',
samp: 'samp',
script: 'script',
section: 'section',
select: 'select',
small: 'small',
source: 'source',
span: 'span',
strong: 'strong',
style: 'style',
sub: 'sub',
summary: 'summary',
sup: 'sup',
table: 'table',
tbody: 'tbody',
td: 'td',
textarea: 'textarea',
tfoot: 'tfoot',
th: 'th',
thead: 'thead',
time: 'time',
title: 'title',
tr: 'tr',
track: 'track',
u: 'u',
ul: 'ul',
'var': 'var',
video: 'video',
wbr: 'wbr',
// SVG
circle: 'circle',
clipPath: 'clipPath',
defs: 'defs',
ellipse: 'ellipse',
g: 'g',
image: 'image',
line: 'line',
linearGradient: 'linearGradient',
mask: 'mask',
path: 'path',
pattern: 'pattern',
polygon: 'polygon',
polyline: 'polyline',
radialGradient: 'radialGradient',
rect: 'rect',
stop: 'stop',
svg: 'svg',
text: 'text',
tspan: 'tspan'
}, createDOMFactory);
module.exports = ReactDOMFactories;
}).call(this,require('_process'))
},{"./ReactElement":59,"./ReactElementValidator":60,"_process":164,"fbjs/lib/mapObject":156}],46:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOMFeatureFlags
*/
'use strict';
var ReactDOMFeatureFlags = {
useCreateElement: false
};
module.exports = ReactDOMFeatureFlags;
},{}],47:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOMIDOperations
* @typechecks static-only
*/
'use strict';
var DOMChildrenOperations = require('./DOMChildrenOperations');
var DOMPropertyOperations = require('./DOMPropertyOperations');
var ReactMount = require('./ReactMount');
var ReactPerf = require('./ReactPerf');
var invariant = require('fbjs/lib/invariant');
/**
* Errors for properties that should not be updated with `updatePropertyByID()`.
*
* @type {object}
* @private
*/
var INVALID_PROPERTY_ERRORS = {
dangerouslySetInnerHTML: '`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.',
style: '`style` must be set using `updateStylesByID()`.'
};
/**
* Operations used to process updates to DOM nodes.
*/
var ReactDOMIDOperations = {
/**
* Updates a DOM node with new property values. This should only be used to
* update DOM properties in `DOMProperty`.
*
* @param {string} id ID of the node to update.
* @param {string} name A valid property name, see `DOMProperty`.
* @param {*} value New value of the property.
* @internal
*/
updatePropertyByID: function (id, name, value) {
var node = ReactMount.getNode(id);
!!INVALID_PROPERTY_ERRORS.hasOwnProperty(name) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'updatePropertyByID(...): %s', INVALID_PROPERTY_ERRORS[name]) : invariant(false) : undefined;
// If we're updating to null or undefined, we should remove the property
// from the DOM node instead of inadvertantly setting to a string. This
// brings us in line with the same behavior we have on initial render.
if (value != null) {
DOMPropertyOperations.setValueForProperty(node, name, value);
} else {
DOMPropertyOperations.deleteValueForProperty(node, name);
}
},
/**
* Replaces a DOM node that exists in the document with markup.
*
* @param {string} id ID of child to be replaced.
* @param {string} markup Dangerous markup to inject in place of child.
* @internal
* @see {Danger.dangerouslyReplaceNodeWithMarkup}
*/
dangerouslyReplaceNodeWithMarkupByID: function (id, markup) {
var node = ReactMount.getNode(id);
DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup(node, markup);
},
/**
* Updates a component's children by processing a series of updates.
*
* @param {array<object>} updates List of update configurations.
* @param {array<string>} markup List of markup strings.
* @internal
*/
dangerouslyProcessChildrenUpdates: function (updates, markup) {
for (var i = 0; i < updates.length; i++) {
updates[i].parentNode = ReactMount.getNode(updates[i].parentID);
}
DOMChildrenOperations.processUpdates(updates, markup);
}
};
ReactPerf.measureMethods(ReactDOMIDOperations, 'ReactDOMIDOperations', {
dangerouslyReplaceNodeWithMarkupByID: 'dangerouslyReplaceNodeWithMarkupByID',
dangerouslyProcessChildrenUpdates: 'dangerouslyProcessChildrenUpdates'
});
module.exports = ReactDOMIDOperations;
}).call(this,require('_process'))
},{"./DOMChildrenOperations":15,"./DOMPropertyOperations":17,"./ReactMount":72,"./ReactPerf":78,"_process":164,"fbjs/lib/invariant":151}],48:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOMInput
*/
'use strict';
var ReactDOMIDOperations = require('./ReactDOMIDOperations');
var LinkedValueUtils = require('./LinkedValueUtils');
var ReactMount = require('./ReactMount');
var ReactUpdates = require('./ReactUpdates');
var assign = require('./Object.assign');
var invariant = require('fbjs/lib/invariant');
var instancesByReactID = {};
function forceUpdateIfMounted() {
if (this._rootNodeID) {
// DOM component is still mounted; update
ReactDOMInput.updateWrapper(this);
}
}
/**
* Implements an <input> native component that allows setting these optional
* props: `checked`, `value`, `defaultChecked`, and `defaultValue`.
*
* If `checked` or `value` are not supplied (or null/undefined), user actions
* that affect the checked state or value will trigger updates to the element.
*
* If they are supplied (and not null/undefined), the rendered element will not
* trigger updates to the element. Instead, the props must change in order for
* the rendered element to be updated.
*
* The rendered element will be initialized as unchecked (or `defaultChecked`)
* with an empty value (or `defaultValue`).
*
* @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
*/
var ReactDOMInput = {
getNativeProps: function (inst, props, context) {
var value = LinkedValueUtils.getValue(props);
var checked = LinkedValueUtils.getChecked(props);
var nativeProps = assign({}, props, {
defaultChecked: undefined,
defaultValue: undefined,
value: value != null ? value : inst._wrapperState.initialValue,
checked: checked != null ? checked : inst._wrapperState.initialChecked,
onChange: inst._wrapperState.onChange
});
return nativeProps;
},
mountWrapper: function (inst, props) {
if (process.env.NODE_ENV !== 'production') {
LinkedValueUtils.checkPropTypes('input', props, inst._currentElement._owner);
}
var defaultValue = props.defaultValue;
inst._wrapperState = {
initialChecked: props.defaultChecked || false,
initialValue: defaultValue != null ? defaultValue : null,
onChange: _handleChange.bind(inst)
};
},
mountReadyWrapper: function (inst) {
// Can't be in mountWrapper or else server rendering leaks.
instancesByReactID[inst._rootNodeID] = inst;
},
unmountWrapper: function (inst) {
delete instancesByReactID[inst._rootNodeID];
},
updateWrapper: function (inst) {
var props = inst._currentElement.props;
// TODO: Shouldn't this be getChecked(props)?
var checked = props.checked;
if (checked != null) {
ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'checked', checked || false);
}
var value = LinkedValueUtils.getValue(props);
if (value != null) {
// Cast `value` to a string to ensure the value is set correctly. While
// browsers typically do this as necessary, jsdom doesn't.
ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'value', '' + value);
}
}
};
function _handleChange(event) {
var props = this._currentElement.props;
var returnValue = LinkedValueUtils.executeOnChange(props, event);
// Here we use asap to wait until all updates have propagated, which
// is important when using controlled components within layers:
// https://github.com/facebook/react/issues/1698
ReactUpdates.asap(forceUpdateIfMounted, this);
var name = props.name;
if (props.type === 'radio' && name != null) {
var rootNode = ReactMount.getNode(this._rootNodeID);
var queryRoot = rootNode;
while (queryRoot.parentNode) {
queryRoot = queryRoot.parentNode;
}
// If `rootNode.form` was non-null, then we could try `form.elements`,
// but that sometimes behaves strangely in IE8. We could also try using
// `form.getElementsByName`, but that will only return direct children
// and won't include inputs that use the HTML5 `form=` attribute. Since
// the input might not even be in a form, let's just use the global
// `querySelectorAll` to ensure we don't miss anything.
var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]');
for (var i = 0; i < group.length; i++) {
var otherNode = group[i];
if (otherNode === rootNode || otherNode.form !== rootNode.form) {
continue;
}
// This will throw if radio buttons rendered by different copies of React
// and the same name are rendered into the same form (same as #1939).
// That's probably okay; we don't support it just as we don't support
// mixing React with non-React.
var otherID = ReactMount.getID(otherNode);
!otherID ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the ' + 'same `name` is not supported.') : invariant(false) : undefined;
var otherInstance = instancesByReactID[otherID];
!otherInstance ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOMInput: Unknown radio button ID %s.', otherID) : invariant(false) : undefined;
// If this is a controlled radio button group, forcing the input that
// was previously checked to update will cause it to be come re-checked
// as appropriate.
ReactUpdates.asap(forceUpdateIfMounted, otherInstance);
}
}
return returnValue;
}
module.exports = ReactDOMInput;
}).call(this,require('_process'))
},{"./LinkedValueUtils":28,"./Object.assign":29,"./ReactDOMIDOperations":47,"./ReactMount":72,"./ReactUpdates":90,"_process":164,"fbjs/lib/invariant":151}],49:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOMOption
*/
'use strict';
var ReactChildren = require('./ReactChildren');
var ReactDOMSelect = require('./ReactDOMSelect');
var assign = require('./Object.assign');
var warning = require('fbjs/lib/warning');
var valueContextKey = ReactDOMSelect.valueContextKey;
/**
* Implements an <option> native component that warns when `selected` is set.
*/
var ReactDOMOption = {
mountWrapper: function (inst, props, context) {
// TODO (yungsters): Remove support for `selected` in <option>.
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(props.selected == null, 'Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.') : undefined;
}
// Look up whether this option is 'selected' via context
var selectValue = context[valueContextKey];
// If context key is null (e.g., no specified value or after initial mount)
// or missing (e.g., for <datalist>), we don't change props.selected
var selected = null;
if (selectValue != null) {
selected = false;
if (Array.isArray(selectValue)) {
// multiple
for (var i = 0; i < selectValue.length; i++) {
if ('' + selectValue[i] === '' + props.value) {
selected = true;
break;
}
}
} else {
selected = '' + selectValue === '' + props.value;
}
}
inst._wrapperState = { selected: selected };
},
getNativeProps: function (inst, props, context) {
var nativeProps = assign({ selected: undefined, children: undefined }, props);
// Read state only from initial mount because <select> updates value
// manually; we need the initial state only for server rendering
if (inst._wrapperState.selected != null) {
nativeProps.selected = inst._wrapperState.selected;
}
var content = '';
// Flatten children and warn if they aren't strings or numbers;
// invalid types are ignored.
ReactChildren.forEach(props.children, function (child) {
if (child == null) {
return;
}
if (typeof child === 'string' || typeof child === 'number') {
content += child;
} else {
process.env.NODE_ENV !== 'production' ? warning(false, 'Only strings and numbers are supported as <option> children.') : undefined;
}
});
nativeProps.children = content;
return nativeProps;
}
};
module.exports = ReactDOMOption;
}).call(this,require('_process'))
},{"./Object.assign":29,"./ReactChildren":35,"./ReactDOMSelect":50,"_process":164,"fbjs/lib/warning":162}],50:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOMSelect
*/
'use strict';
var LinkedValueUtils = require('./LinkedValueUtils');
var ReactMount = require('./ReactMount');
var ReactUpdates = require('./ReactUpdates');
var assign = require('./Object.assign');
var warning = require('fbjs/lib/warning');
var valueContextKey = '__ReactDOMSelect_value$' + Math.random().toString(36).slice(2);
function updateOptionsIfPendingUpdateAndMounted() {
if (this._rootNodeID && this._wrapperState.pendingUpdate) {
this._wrapperState.pendingUpdate = false;
var props = this._currentElement.props;
var value = LinkedValueUtils.getValue(props);
if (value != null) {
updateOptions(this, Boolean(props.multiple), value);
}
}
}
function getDeclarationErrorAddendum(owner) {
if (owner) {
var name = owner.getName();
if (name) {
return ' Check the render method of `' + name + '`.';
}
}
return '';
}
var valuePropNames = ['value', 'defaultValue'];
/**
* Validation function for `value` and `defaultValue`.
* @private
*/
function checkSelectPropTypes(inst, props) {
var owner = inst._currentElement._owner;
LinkedValueUtils.checkPropTypes('select', props, owner);
for (var i = 0; i < valuePropNames.length; i++) {
var propName = valuePropNames[i];
if (props[propName] == null) {
continue;
}
if (props.multiple) {
process.env.NODE_ENV !== 'production' ? warning(Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum(owner)) : undefined;
} else {
process.env.NODE_ENV !== 'production' ? warning(!Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum(owner)) : undefined;
}
}
}
/**
* @param {ReactDOMComponent} inst
* @param {boolean} multiple
* @param {*} propValue A stringable (with `multiple`, a list of stringables).
* @private
*/
function updateOptions(inst, multiple, propValue) {
var selectedValue, i;
var options = ReactMount.getNode(inst._rootNodeID).options;
if (multiple) {
selectedValue = {};
for (i = 0; i < propValue.length; i++) {
selectedValue['' + propValue[i]] = true;
}
for (i = 0; i < options.length; i++) {
var selected = selectedValue.hasOwnProperty(options[i].value);
if (options[i].selected !== selected) {
options[i].selected = selected;
}
}
} else {
// Do not set `select.value` as exact behavior isn't consistent across all
// browsers for all cases.
selectedValue = '' + propValue;
for (i = 0; i < options.length; i++) {
if (options[i].value === selectedValue) {
options[i].selected = true;
return;
}
}
if (options.length) {
options[0].selected = true;
}
}
}
/**
* Implements a <select> native component that allows optionally setting the
* props `value` and `defaultValue`. If `multiple` is false, the prop must be a
* stringable. If `multiple` is true, the prop must be an array of stringables.
*
* If `value` is not supplied (or null/undefined), user actions that change the
* selected option will trigger updates to the rendered options.
*
* If it is supplied (and not null/undefined), the rendered options will not
* update in response to user actions. Instead, the `value` prop must change in
* order for the rendered options to update.
*
* If `defaultValue` is provided, any options with the supplied values will be
* selected.
*/
var ReactDOMSelect = {
valueContextKey: valueContextKey,
getNativeProps: function (inst, props, context) {
return assign({}, props, {
onChange: inst._wrapperState.onChange,
value: undefined
});
},
mountWrapper: function (inst, props) {
if (process.env.NODE_ENV !== 'production') {
checkSelectPropTypes(inst, props);
}
var value = LinkedValueUtils.getValue(props);
inst._wrapperState = {
pendingUpdate: false,
initialValue: value != null ? value : props.defaultValue,
onChange: _handleChange.bind(inst),
wasMultiple: Boolean(props.multiple)
};
},
processChildContext: function (inst, props, context) {
// Pass down initial value so initial generated markup has correct
// `selected` attributes
var childContext = assign({}, context);
childContext[valueContextKey] = inst._wrapperState.initialValue;
return childContext;
},
postUpdateWrapper: function (inst) {
var props = inst._currentElement.props;
// After the initial mount, we control selected-ness manually so don't pass
// the context value down
inst._wrapperState.initialValue = undefined;
var wasMultiple = inst._wrapperState.wasMultiple;
inst._wrapperState.wasMultiple = Boolean(props.multiple);
var value = LinkedValueUtils.getValue(props);
if (value != null) {
inst._wrapperState.pendingUpdate = false;
updateOptions(inst, Boolean(props.multiple), value);
} else if (wasMultiple !== Boolean(props.multiple)) {
// For simplicity, reapply `defaultValue` if `multiple` is toggled.
if (props.defaultValue != null) {
updateOptions(inst, Boolean(props.multiple), props.defaultValue);
} else {
// Revert the select back to its default unselected state.
updateOptions(inst, Boolean(props.multiple), props.multiple ? [] : '');
}
}
}
};
function _handleChange(event) {
var props = this._currentElement.props;
var returnValue = LinkedValueUtils.executeOnChange(props, event);
this._wrapperState.pendingUpdate = true;
ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this);
return returnValue;
}
module.exports = ReactDOMSelect;
}).call(this,require('_process'))
},{"./LinkedValueUtils":28,"./Object.assign":29,"./ReactMount":72,"./ReactUpdates":90,"_process":164,"fbjs/lib/warning":162}],51:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOMSelection
*/
'use strict';
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
var getNodeForCharacterOffset = require('./getNodeForCharacterOffset');
var getTextContentAccessor = require('./getTextContentAccessor');
/**
* While `isCollapsed` is available on the Selection object and `collapsed`
* is available on the Range object, IE11 sometimes gets them wrong.
* If the anchor/focus nodes and offsets are the same, the range is collapsed.
*/
function isCollapsed(anchorNode, anchorOffset, focusNode, focusOffset) {
return anchorNode === focusNode && anchorOffset === focusOffset;
}
/**
* Get the appropriate anchor and focus node/offset pairs for IE.
*
* The catch here is that IE's selection API doesn't provide information
* about whether the selection is forward or backward, so we have to
* behave as though it's always forward.
*
* IE text differs from modern selection in that it behaves as though
* block elements end with a new line. This means character offsets will
* differ between the two APIs.
*
* @param {DOMElement} node
* @return {object}
*/
function getIEOffsets(node) {
var selection = document.selection;
var selectedRange = selection.createRange();
var selectedLength = selectedRange.text.length;
// Duplicate selection so we can move range without breaking user selection.
var fromStart = selectedRange.duplicate();
fromStart.moveToElementText(node);
fromStart.setEndPoint('EndToStart', selectedRange);
var startOffset = fromStart.text.length;
var endOffset = startOffset + selectedLength;
return {
start: startOffset,
end: endOffset
};
}
/**
* @param {DOMElement} node
* @return {?object}
*/
function getModernOffsets(node) {
var selection = window.getSelection && window.getSelection();
if (!selection || selection.rangeCount === 0) {
return null;
}
var anchorNode = selection.anchorNode;
var anchorOffset = selection.anchorOffset;
var focusNode = selection.focusNode;
var focusOffset = selection.focusOffset;
var currentRange = selection.getRangeAt(0);
// In Firefox, range.startContainer and range.endContainer can be "anonymous
// divs", e.g. the up/down buttons on an <input type="number">. Anonymous
// divs do not seem to expose properties, triggering a "Permission denied
// error" if any of its properties are accessed. The only seemingly possible
// way to avoid erroring is to access a property that typically works for
// non-anonymous divs and catch any error that may otherwise arise. See
// https://bugzilla.mozilla.org/show_bug.cgi?id=208427
try {
/* eslint-disable no-unused-expressions */
currentRange.startContainer.nodeType;
currentRange.endContainer.nodeType;
/* eslint-enable no-unused-expressions */
} catch (e) {
return null;
}
// If the node and offset values are the same, the selection is collapsed.
// `Selection.isCollapsed` is available natively, but IE sometimes gets
// this value wrong.
var isSelectionCollapsed = isCollapsed(selection.anchorNode, selection.anchorOffset, selection.focusNode, selection.focusOffset);
var rangeLength = isSelectionCollapsed ? 0 : currentRange.toString().length;
var tempRange = currentRange.cloneRange();
tempRange.selectNodeContents(node);
tempRange.setEnd(currentRange.startContainer, currentRange.startOffset);
var isTempRangeCollapsed = isCollapsed(tempRange.startContainer, tempRange.startOffset, tempRange.endContainer, tempRange.endOffset);
var start = isTempRangeCollapsed ? 0 : tempRange.toString().length;
var end = start + rangeLength;
// Detect whether the selection is backward.
var detectionRange = document.createRange();
detectionRange.setStart(anchorNode, anchorOffset);
detectionRange.setEnd(focusNode, focusOffset);
var isBackward = detectionRange.collapsed;
return {
start: isBackward ? end : start,
end: isBackward ? start : end
};
}
/**
* @param {DOMElement|DOMTextNode} node
* @param {object} offsets
*/
function setIEOffsets(node, offsets) {
var range = document.selection.createRange().duplicate();
var start, end;
if (typeof offsets.end === 'undefined') {
start = offsets.start;
end = start;
} else if (offsets.start > offsets.end) {
start = offsets.end;
end = offsets.start;
} else {
start = offsets.start;
end = offsets.end;
}
range.moveToElementText(node);
range.moveStart('character', start);
range.setEndPoint('EndToStart', range);
range.moveEnd('character', end - start);
range.select();
}
/**
* In modern non-IE browsers, we can support both forward and backward
* selections.
*
* Note: IE10+ supports the Selection object, but it does not support
* the `extend` method, which means that even in modern IE, it's not possible
* to programatically create a backward selection. Thus, for all IE
* versions, we use the old IE API to create our selections.
*
* @param {DOMElement|DOMTextNode} node
* @param {object} offsets
*/
function setModernOffsets(node, offsets) {
if (!window.getSelection) {
return;
}
var selection = window.getSelection();
var length = node[getTextContentAccessor()].length;
var start = Math.min(offsets.start, length);
var end = typeof offsets.end === 'undefined' ? start : Math.min(offsets.end, length);
// IE 11 uses modern selection, but doesn't support the extend method.
// Flip backward selections, so we can set with a single range.
if (!selection.extend && start > end) {
var temp = end;
end = start;
start = temp;
}
var startMarker = getNodeForCharacterOffset(node, start);
var endMarker = getNodeForCharacterOffset(node, end);
if (startMarker && endMarker) {
var range = document.createRange();
range.setStart(startMarker.node, startMarker.offset);
selection.removeAllRanges();
if (start > end) {
selection.addRange(range);
selection.extend(endMarker.node, endMarker.offset);
} else {
range.setEnd(endMarker.node, endMarker.offset);
selection.addRange(range);
}
}
}
var useIEOffsets = ExecutionEnvironment.canUseDOM && 'selection' in document && !('getSelection' in window);
var ReactDOMSelection = {
/**
* @param {DOMElement} node
*/
getOffsets: useIEOffsets ? getIEOffsets : getModernOffsets,
/**
* @param {DOMElement|DOMTextNode} node
* @param {object} offsets
*/
setOffsets: useIEOffsets ? setIEOffsets : setModernOffsets
};
module.exports = ReactDOMSelection;
},{"./getNodeForCharacterOffset":123,"./getTextContentAccessor":124,"fbjs/lib/ExecutionEnvironment":137}],52:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOMServer
*/
'use strict';
var ReactDefaultInjection = require('./ReactDefaultInjection');
var ReactServerRendering = require('./ReactServerRendering');
var ReactVersion = require('./ReactVersion');
ReactDefaultInjection.inject();
var ReactDOMServer = {
renderToString: ReactServerRendering.renderToString,
renderToStaticMarkup: ReactServerRendering.renderToStaticMarkup,
version: ReactVersion
};
module.exports = ReactDOMServer;
},{"./ReactDefaultInjection":56,"./ReactServerRendering":87,"./ReactVersion":91}],53:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOMTextComponent
* @typechecks static-only
*/
'use strict';
var DOMChildrenOperations = require('./DOMChildrenOperations');
var DOMPropertyOperations = require('./DOMPropertyOperations');
var ReactComponentBrowserEnvironment = require('./ReactComponentBrowserEnvironment');
var ReactMount = require('./ReactMount');
var assign = require('./Object.assign');
var escapeTextContentForBrowser = require('./escapeTextContentForBrowser');
var setTextContent = require('./setTextContent');
var validateDOMNesting = require('./validateDOMNesting');
/**
* Text nodes violate a couple assumptions that React makes about components:
*
* - When mounting text into the DOM, adjacent text nodes are merged.
* - Text nodes cannot be assigned a React root ID.
*
* This component is used to wrap strings in elements so that they can undergo
* the same reconciliation that is applied to elements.
*
* TODO: Investigate representing React components in the DOM with text nodes.
*
* @class ReactDOMTextComponent
* @extends ReactComponent
* @internal
*/
var ReactDOMTextComponent = function (props) {
// This constructor and its argument is currently used by mocks.
};
assign(ReactDOMTextComponent.prototype, {
/**
* @param {ReactText} text
* @internal
*/
construct: function (text) {
// TODO: This is really a ReactText (ReactNode), not a ReactElement
this._currentElement = text;
this._stringText = '' + text;
// Properties
this._rootNodeID = null;
this._mountIndex = 0;
},
/**
* Creates the markup for this text node. This node is not intended to have
* any features besides containing text content.
*
* @param {string} rootID DOM ID of the root node.
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @return {string} Markup for this text node.
* @internal
*/
mountComponent: function (rootID, transaction, context) {
if (process.env.NODE_ENV !== 'production') {
if (context[validateDOMNesting.ancestorInfoContextKey]) {
validateDOMNesting('span', null, context[validateDOMNesting.ancestorInfoContextKey]);
}
}
this._rootNodeID = rootID;
if (transaction.useCreateElement) {
var ownerDocument = context[ReactMount.ownerDocumentContextKey];
var el = ownerDocument.createElement('span');
DOMPropertyOperations.setAttributeForID(el, rootID);
// Populate node cache
ReactMount.getID(el);
setTextContent(el, this._stringText);
return el;
} else {
var escapedText = escapeTextContentForBrowser(this._stringText);
if (transaction.renderToStaticMarkup) {
// Normally we'd wrap this in a `span` for the reasons stated above, but
// since this is a situation where React won't take over (static pages),
// we can simply return the text as it is.
return escapedText;
}
return '<span ' + DOMPropertyOperations.createMarkupForID(rootID) + '>' + escapedText + '</span>';
}
},
/**
* Updates this component by updating the text content.
*
* @param {ReactText} nextText The next text content
* @param {ReactReconcileTransaction} transaction
* @internal
*/
receiveComponent: function (nextText, transaction) {
if (nextText !== this._currentElement) {
this._currentElement = nextText;
var nextStringText = '' + nextText;
if (nextStringText !== this._stringText) {
// TODO: Save this as pending props and use performUpdateIfNecessary
// and/or updateComponent to do the actual update for consistency with
// other component types?
this._stringText = nextStringText;
var node = ReactMount.getNode(this._rootNodeID);
DOMChildrenOperations.updateTextContent(node, nextStringText);
}
}
},
unmountComponent: function () {
ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
}
});
module.exports = ReactDOMTextComponent;
}).call(this,require('_process'))
},{"./DOMChildrenOperations":15,"./DOMPropertyOperations":17,"./Object.assign":29,"./ReactComponentBrowserEnvironment":38,"./ReactMount":72,"./escapeTextContentForBrowser":114,"./setTextContent":132,"./validateDOMNesting":135,"_process":164}],54:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOMTextarea
*/
'use strict';
var LinkedValueUtils = require('./LinkedValueUtils');
var ReactDOMIDOperations = require('./ReactDOMIDOperations');
var ReactUpdates = require('./ReactUpdates');
var assign = require('./Object.assign');
var invariant = require('fbjs/lib/invariant');
var warning = require('fbjs/lib/warning');
function forceUpdateIfMounted() {
if (this._rootNodeID) {
// DOM component is still mounted; update
ReactDOMTextarea.updateWrapper(this);
}
}
/**
* Implements a <textarea> native component that allows setting `value`, and
* `defaultValue`. This differs from the traditional DOM API because value is
* usually set as PCDATA children.
*
* If `value` is not supplied (or null/undefined), user actions that affect the
* value will trigger updates to the element.
*
* If `value` is supplied (and not null/undefined), the rendered element will
* not trigger updates to the element. Instead, the `value` prop must change in
* order for the rendered element to be updated.
*
* The rendered element will be initialized with an empty value, the prop
* `defaultValue` if specified, or the children content (deprecated).
*/
var ReactDOMTextarea = {
getNativeProps: function (inst, props, context) {
!(props.dangerouslySetInnerHTML == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : invariant(false) : undefined;
// Always set children to the same thing. In IE9, the selection range will
// get reset if `textContent` is mutated.
var nativeProps = assign({}, props, {
defaultValue: undefined,
value: undefined,
children: inst._wrapperState.initialValue,
onChange: inst._wrapperState.onChange
});
return nativeProps;
},
mountWrapper: function (inst, props) {
if (process.env.NODE_ENV !== 'production') {
LinkedValueUtils.checkPropTypes('textarea', props, inst._currentElement._owner);
}
var defaultValue = props.defaultValue;
// TODO (yungsters): Remove support for children content in <textarea>.
var children = props.children;
if (children != null) {
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.') : undefined;
}
!(defaultValue == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : invariant(false) : undefined;
if (Array.isArray(children)) {
!(children.length <= 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, '<textarea> can only have at most one child.') : invariant(false) : undefined;
children = children[0];
}
defaultValue = '' + children;
}
if (defaultValue == null) {
defaultValue = '';
}
var value = LinkedValueUtils.getValue(props);
inst._wrapperState = {
// We save the initial value so that `ReactDOMComponent` doesn't update
// `textContent` (unnecessary since we update value).
// The initial value can be a boolean or object so that's why it's
// forced to be a string.
initialValue: '' + (value != null ? value : defaultValue),
onChange: _handleChange.bind(inst)
};
},
updateWrapper: function (inst) {
var props = inst._currentElement.props;
var value = LinkedValueUtils.getValue(props);
if (value != null) {
// Cast `value` to a string to ensure the value is set correctly. While
// browsers typically do this as necessary, jsdom doesn't.
ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'value', '' + value);
}
}
};
function _handleChange(event) {
var props = this._currentElement.props;
var returnValue = LinkedValueUtils.executeOnChange(props, event);
ReactUpdates.asap(forceUpdateIfMounted, this);
return returnValue;
}
module.exports = ReactDOMTextarea;
}).call(this,require('_process'))
},{"./LinkedValueUtils":28,"./Object.assign":29,"./ReactDOMIDOperations":47,"./ReactUpdates":90,"_process":164,"fbjs/lib/invariant":151,"fbjs/lib/warning":162}],55:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDefaultBatchingStrategy
*/
'use strict';
var ReactUpdates = require('./ReactUpdates');
var Transaction = require('./Transaction');
var assign = require('./Object.assign');
var emptyFunction = require('fbjs/lib/emptyFunction');
var RESET_BATCHED_UPDATES = {
initialize: emptyFunction,
close: function () {
ReactDefaultBatchingStrategy.isBatchingUpdates = false;
}
};
var FLUSH_BATCHED_UPDATES = {
initialize: emptyFunction,
close: ReactUpdates.flushBatchedUpdates.bind(ReactUpdates)
};
var TRANSACTION_WRAPPERS = [FLUSH_BATCHED_UPDATES, RESET_BATCHED_UPDATES];
function ReactDefaultBatchingStrategyTransaction() {
this.reinitializeTransaction();
}
assign(ReactDefaultBatchingStrategyTransaction.prototype, Transaction.Mixin, {
getTransactionWrappers: function () {
return TRANSACTION_WRAPPERS;
}
});
var transaction = new ReactDefaultBatchingStrategyTransaction();
var ReactDefaultBatchingStrategy = {
isBatchingUpdates: false,
/**
* Call the provided function in a context within which calls to `setState`
* and friends are batched such that components aren't updated unnecessarily.
*/
batchedUpdates: function (callback, a, b, c, d, e) {
var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates;
ReactDefaultBatchingStrategy.isBatchingUpdates = true;
// The code is written this way to avoid extra allocations
if (alreadyBatchingUpdates) {
callback(a, b, c, d, e);
} else {
transaction.perform(callback, null, a, b, c, d, e);
}
}
};
module.exports = ReactDefaultBatchingStrategy;
},{"./Object.assign":29,"./ReactUpdates":90,"./Transaction":107,"fbjs/lib/emptyFunction":143}],56:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDefaultInjection
*/
'use strict';
var BeforeInputEventPlugin = require('./BeforeInputEventPlugin');
var ChangeEventPlugin = require('./ChangeEventPlugin');
var ClientReactRootIndex = require('./ClientReactRootIndex');
var DefaultEventPluginOrder = require('./DefaultEventPluginOrder');
var EnterLeaveEventPlugin = require('./EnterLeaveEventPlugin');
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
var HTMLDOMPropertyConfig = require('./HTMLDOMPropertyConfig');
var ReactBrowserComponentMixin = require('./ReactBrowserComponentMixin');
var ReactComponentBrowserEnvironment = require('./ReactComponentBrowserEnvironment');
var ReactDefaultBatchingStrategy = require('./ReactDefaultBatchingStrategy');
var ReactDOMComponent = require('./ReactDOMComponent');
var ReactDOMTextComponent = require('./ReactDOMTextComponent');
var ReactEventListener = require('./ReactEventListener');
var ReactInjection = require('./ReactInjection');
var ReactInstanceHandles = require('./ReactInstanceHandles');
var ReactMount = require('./ReactMount');
var ReactReconcileTransaction = require('./ReactReconcileTransaction');
var SelectEventPlugin = require('./SelectEventPlugin');
var ServerReactRootIndex = require('./ServerReactRootIndex');
var SimpleEventPlugin = require('./SimpleEventPlugin');
var SVGDOMPropertyConfig = require('./SVGDOMPropertyConfig');
var alreadyInjected = false;
function inject() {
if (alreadyInjected) {
// TODO: This is currently true because these injections are shared between
// the client and the server package. They should be built independently
// and not share any injection state. Then this problem will be solved.
return;
}
alreadyInjected = true;
ReactInjection.EventEmitter.injectReactEventListener(ReactEventListener);
/**
* Inject modules for resolving DOM hierarchy and plugin ordering.
*/
ReactInjection.EventPluginHub.injectEventPluginOrder(DefaultEventPluginOrder);
ReactInjection.EventPluginHub.injectInstanceHandle(ReactInstanceHandles);
ReactInjection.EventPluginHub.injectMount(ReactMount);
/**
* Some important event plugins included by default (without having to require
* them).
*/
ReactInjection.EventPluginHub.injectEventPluginsByName({
SimpleEventPlugin: SimpleEventPlugin,
EnterLeaveEventPlugin: EnterLeaveEventPlugin,
ChangeEventPlugin: ChangeEventPlugin,
SelectEventPlugin: SelectEventPlugin,
BeforeInputEventPlugin: BeforeInputEventPlugin
});
ReactInjection.NativeComponent.injectGenericComponentClass(ReactDOMComponent);
ReactInjection.NativeComponent.injectTextComponentClass(ReactDOMTextComponent);
ReactInjection.Class.injectMixin(ReactBrowserComponentMixin);
ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig);
ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig);
ReactInjection.EmptyComponent.injectEmptyComponent('noscript');
ReactInjection.Updates.injectReconcileTransaction(ReactReconcileTransaction);
ReactInjection.Updates.injectBatchingStrategy(ReactDefaultBatchingStrategy);
ReactInjection.RootIndex.injectCreateReactRootIndex(ExecutionEnvironment.canUseDOM ? ClientReactRootIndex.createReactRootIndex : ServerReactRootIndex.createReactRootIndex);
ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment);
if (process.env.NODE_ENV !== 'production') {
var url = ExecutionEnvironment.canUseDOM && window.location.href || '';
if (/[?&]react_perf\b/.test(url)) {
var ReactDefaultPerf = require('./ReactDefaultPerf');
ReactDefaultPerf.start();
}
}
}
module.exports = {
inject: inject
};
}).call(this,require('_process'))
},{"./BeforeInputEventPlugin":9,"./ChangeEventPlugin":13,"./ClientReactRootIndex":14,"./DefaultEventPluginOrder":19,"./EnterLeaveEventPlugin":20,"./HTMLDOMPropertyConfig":27,"./ReactBrowserComponentMixin":32,"./ReactComponentBrowserEnvironment":38,"./ReactDOMComponent":44,"./ReactDOMTextComponent":53,"./ReactDefaultBatchingStrategy":55,"./ReactDefaultPerf":57,"./ReactEventListener":65,"./ReactInjection":66,"./ReactInstanceHandles":68,"./ReactMount":72,"./ReactReconcileTransaction":82,"./SVGDOMPropertyConfig":92,"./SelectEventPlugin":93,"./ServerReactRootIndex":94,"./SimpleEventPlugin":95,"_process":164,"fbjs/lib/ExecutionEnvironment":137}],57:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDefaultPerf
* @typechecks static-only
*/
'use strict';
var DOMProperty = require('./DOMProperty');
var ReactDefaultPerfAnalysis = require('./ReactDefaultPerfAnalysis');
var ReactMount = require('./ReactMount');
var ReactPerf = require('./ReactPerf');
var performanceNow = require('fbjs/lib/performanceNow');
function roundFloat(val) {
return Math.floor(val * 100) / 100;
}
function addValue(obj, key, val) {
obj[key] = (obj[key] || 0) + val;
}
var ReactDefaultPerf = {
_allMeasurements: [], // last item in the list is the current one
_mountStack: [0],
_injected: false,
start: function () {
if (!ReactDefaultPerf._injected) {
ReactPerf.injection.injectMeasure(ReactDefaultPerf.measure);
}
ReactDefaultPerf._allMeasurements.length = 0;
ReactPerf.enableMeasure = true;
},
stop: function () {
ReactPerf.enableMeasure = false;
},
getLastMeasurements: function () {
return ReactDefaultPerf._allMeasurements;
},
printExclusive: function (measurements) {
measurements = measurements || ReactDefaultPerf._allMeasurements;
var summary = ReactDefaultPerfAnalysis.getExclusiveSummary(measurements);
console.table(summary.map(function (item) {
return {
'Component class name': item.componentName,
'Total inclusive time (ms)': roundFloat(item.inclusive),
'Exclusive mount time (ms)': roundFloat(item.exclusive),
'Exclusive render time (ms)': roundFloat(item.render),
'Mount time per instance (ms)': roundFloat(item.exclusive / item.count),
'Render time per instance (ms)': roundFloat(item.render / item.count),
'Instances': item.count
};
}));
// TODO: ReactDefaultPerfAnalysis.getTotalTime() does not return the correct
// number.
},
printInclusive: function (measurements) {
measurements = measurements || ReactDefaultPerf._allMeasurements;
var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements);
console.table(summary.map(function (item) {
return {
'Owner > component': item.componentName,
'Inclusive time (ms)': roundFloat(item.time),
'Instances': item.count
};
}));
console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms');
},
getMeasurementsSummaryMap: function (measurements) {
var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements, true);
return summary.map(function (item) {
return {
'Owner > component': item.componentName,
'Wasted time (ms)': item.time,
'Instances': item.count
};
});
},
printWasted: function (measurements) {
measurements = measurements || ReactDefaultPerf._allMeasurements;
console.table(ReactDefaultPerf.getMeasurementsSummaryMap(measurements));
console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms');
},
printDOM: function (measurements) {
measurements = measurements || ReactDefaultPerf._allMeasurements;
var summary = ReactDefaultPerfAnalysis.getDOMSummary(measurements);
console.table(summary.map(function (item) {
var result = {};
result[DOMProperty.ID_ATTRIBUTE_NAME] = item.id;
result.type = item.type;
result.args = JSON.stringify(item.args);
return result;
}));
console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms');
},
_recordWrite: function (id, fnName, totalTime, args) {
// TODO: totalTime isn't that useful since it doesn't count paints/reflows
var writes = ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1].writes;
writes[id] = writes[id] || [];
writes[id].push({
type: fnName,
time: totalTime,
args: args
});
},
measure: function (moduleName, fnName, func) {
return function () {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var totalTime;
var rv;
var start;
if (fnName === '_renderNewRootComponent' || fnName === 'flushBatchedUpdates') {
// A "measurement" is a set of metrics recorded for each flush. We want
// to group the metrics for a given flush together so we can look at the
// components that rendered and the DOM operations that actually
// happened to determine the amount of "wasted work" performed.
ReactDefaultPerf._allMeasurements.push({
exclusive: {},
inclusive: {},
render: {},
counts: {},
writes: {},
displayNames: {},
totalTime: 0,
created: {}
});
start = performanceNow();
rv = func.apply(this, args);
ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1].totalTime = performanceNow() - start;
return rv;
} else if (fnName === '_mountImageIntoNode' || moduleName === 'ReactBrowserEventEmitter' || moduleName === 'ReactDOMIDOperations' || moduleName === 'CSSPropertyOperations' || moduleName === 'DOMChildrenOperations' || moduleName === 'DOMPropertyOperations') {
start = performanceNow();
rv = func.apply(this, args);
totalTime = performanceNow() - start;
if (fnName === '_mountImageIntoNode') {
var mountID = ReactMount.getID(args[1]);
ReactDefaultPerf._recordWrite(mountID, fnName, totalTime, args[0]);
} else if (fnName === 'dangerouslyProcessChildrenUpdates') {
// special format
args[0].forEach(function (update) {
var writeArgs = {};
if (update.fromIndex !== null) {
writeArgs.fromIndex = update.fromIndex;
}
if (update.toIndex !== null) {
writeArgs.toIndex = update.toIndex;
}
if (update.textContent !== null) {
writeArgs.textContent = update.textContent;
}
if (update.markupIndex !== null) {
writeArgs.markup = args[1][update.markupIndex];
}
ReactDefaultPerf._recordWrite(update.parentID, update.type, totalTime, writeArgs);
});
} else {
// basic format
var id = args[0];
if (typeof id === 'object') {
id = ReactMount.getID(args[0]);
}
ReactDefaultPerf._recordWrite(id, fnName, totalTime, Array.prototype.slice.call(args, 1));
}
return rv;
} else if (moduleName === 'ReactCompositeComponent' && (fnName === 'mountComponent' || fnName === 'updateComponent' || // TODO: receiveComponent()?
fnName === '_renderValidatedComponent')) {
if (this._currentElement.type === ReactMount.TopLevelWrapper) {
return func.apply(this, args);
}
var rootNodeID = fnName === 'mountComponent' ? args[0] : this._rootNodeID;
var isRender = fnName === '_renderValidatedComponent';
var isMount = fnName === 'mountComponent';
var mountStack = ReactDefaultPerf._mountStack;
var entry = ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1];
if (isRender) {
addValue(entry.counts, rootNodeID, 1);
} else if (isMount) {
entry.created[rootNodeID] = true;
mountStack.push(0);
}
start = performanceNow();
rv = func.apply(this, args);
totalTime = performanceNow() - start;
if (isRender) {
addValue(entry.render, rootNodeID, totalTime);
} else if (isMount) {
var subMountTime = mountStack.pop();
mountStack[mountStack.length - 1] += totalTime;
addValue(entry.exclusive, rootNodeID, totalTime - subMountTime);
addValue(entry.inclusive, rootNodeID, totalTime);
} else {
addValue(entry.inclusive, rootNodeID, totalTime);
}
entry.displayNames[rootNodeID] = {
current: this.getName(),
owner: this._currentElement._owner ? this._currentElement._owner.getName() : '<root>'
};
return rv;
} else {
return func.apply(this, args);
}
};
}
};
module.exports = ReactDefaultPerf;
},{"./DOMProperty":16,"./ReactDefaultPerfAnalysis":58,"./ReactMount":72,"./ReactPerf":78,"fbjs/lib/performanceNow":159}],58:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDefaultPerfAnalysis
*/
'use strict';
var assign = require('./Object.assign');
// Don't try to save users less than 1.2ms (a number I made up)
var DONT_CARE_THRESHOLD = 1.2;
var DOM_OPERATION_TYPES = {
'_mountImageIntoNode': 'set innerHTML',
INSERT_MARKUP: 'set innerHTML',
MOVE_EXISTING: 'move',
REMOVE_NODE: 'remove',
SET_MARKUP: 'set innerHTML',
TEXT_CONTENT: 'set textContent',
'setValueForProperty': 'update attribute',
'setValueForAttribute': 'update attribute',
'deleteValueForProperty': 'remove attribute',
'setValueForStyles': 'update styles',
'replaceNodeWithMarkup': 'replace',
'updateTextContent': 'set textContent'
};
function getTotalTime(measurements) {
// TODO: return number of DOM ops? could be misleading.
// TODO: measure dropped frames after reconcile?
// TODO: log total time of each reconcile and the top-level component
// class that triggered it.
var totalTime = 0;
for (var i = 0; i < measurements.length; i++) {
var measurement = measurements[i];
totalTime += measurement.totalTime;
}
return totalTime;
}
function getDOMSummary(measurements) {
var items = [];
measurements.forEach(function (measurement) {
Object.keys(measurement.writes).forEach(function (id) {
measurement.writes[id].forEach(function (write) {
items.push({
id: id,
type: DOM_OPERATION_TYPES[write.type] || write.type,
args: write.args
});
});
});
});
return items;
}
function getExclusiveSummary(measurements) {
var candidates = {};
var displayName;
for (var i = 0; i < measurements.length; i++) {
var measurement = measurements[i];
var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
for (var id in allIDs) {
displayName = measurement.displayNames[id].current;
candidates[displayName] = candidates[displayName] || {
componentName: displayName,
inclusive: 0,
exclusive: 0,
render: 0,
count: 0
};
if (measurement.render[id]) {
candidates[displayName].render += measurement.render[id];
}
if (measurement.exclusive[id]) {
candidates[displayName].exclusive += measurement.exclusive[id];
}
if (measurement.inclusive[id]) {
candidates[displayName].inclusive += measurement.inclusive[id];
}
if (measurement.counts[id]) {
candidates[displayName].count += measurement.counts[id];
}
}
}
// Now make a sorted array with the results.
var arr = [];
for (displayName in candidates) {
if (candidates[displayName].exclusive >= DONT_CARE_THRESHOLD) {
arr.push(candidates[displayName]);
}
}
arr.sort(function (a, b) {
return b.exclusive - a.exclusive;
});
return arr;
}
function getInclusiveSummary(measurements, onlyClean) {
var candidates = {};
var inclusiveKey;
for (var i = 0; i < measurements.length; i++) {
var measurement = measurements[i];
var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
var cleanComponents;
if (onlyClean) {
cleanComponents = getUnchangedComponents(measurement);
}
for (var id in allIDs) {
if (onlyClean && !cleanComponents[id]) {
continue;
}
var displayName = measurement.displayNames[id];
// Inclusive time is not useful for many components without knowing where
// they are instantiated. So we aggregate inclusive time with both the
// owner and current displayName as the key.
inclusiveKey = displayName.owner + ' > ' + displayName.current;
candidates[inclusiveKey] = candidates[inclusiveKey] || {
componentName: inclusiveKey,
time: 0,
count: 0
};
if (measurement.inclusive[id]) {
candidates[inclusiveKey].time += measurement.inclusive[id];
}
if (measurement.counts[id]) {
candidates[inclusiveKey].count += measurement.counts[id];
}
}
}
// Now make a sorted array with the results.
var arr = [];
for (inclusiveKey in candidates) {
if (candidates[inclusiveKey].time >= DONT_CARE_THRESHOLD) {
arr.push(candidates[inclusiveKey]);
}
}
arr.sort(function (a, b) {
return b.time - a.time;
});
return arr;
}
function getUnchangedComponents(measurement) {
// For a given reconcile, look at which components did not actually
// render anything to the DOM and return a mapping of their ID to
// the amount of time it took to render the entire subtree.
var cleanComponents = {};
var dirtyLeafIDs = Object.keys(measurement.writes);
var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
for (var id in allIDs) {
var isDirty = false;
// For each component that rendered, see if a component that triggered
// a DOM op is in its subtree.
for (var i = 0; i < dirtyLeafIDs.length; i++) {
if (dirtyLeafIDs[i].indexOf(id) === 0) {
isDirty = true;
break;
}
}
// check if component newly created
if (measurement.created[id]) {
isDirty = true;
}
if (!isDirty && measurement.counts[id] > 0) {
cleanComponents[id] = true;
}
}
return cleanComponents;
}
var ReactDefaultPerfAnalysis = {
getExclusiveSummary: getExclusiveSummary,
getInclusiveSummary: getInclusiveSummary,
getDOMSummary: getDOMSummary,
getTotalTime: getTotalTime
};
module.exports = ReactDefaultPerfAnalysis;
},{"./Object.assign":29}],59:[function(require,module,exports){
(function (process){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactElement
*/
'use strict';
var ReactCurrentOwner = require('./ReactCurrentOwner');
var assign = require('./Object.assign');
var canDefineProperty = require('./canDefineProperty');
// The Symbol used to tag the ReactElement type. If there is no native Symbol
// nor polyfill, then a plain number is used for performance.
var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
var RESERVED_PROPS = {
key: true,
ref: true,
__self: true,
__source: true
};
/**
* Base constructor for all React elements. This is only used to make this
* work with a dynamic instanceof check. Nothing should live on this prototype.
*
* @param {*} type
* @param {*} key
* @param {string|object} ref
* @param {*} self A *temporary* helper to detect places where `this` is
* different from the `owner` when React.createElement is called, so that we
* can warn. We want to get rid of owner and replace string `ref`s with arrow
* functions, and as long as `this` and owner are the same, there will be no
* change in behavior.
* @param {*} source An annotation object (added by a transpiler or otherwise)
* indicating filename, line number, and/or other information.
* @param {*} owner
* @param {*} props
* @internal
*/
var ReactElement = function (type, key, ref, self, source, owner, props) {
var element = {
// This tag allow us to uniquely identify this as a React Element
$$typeof: REACT_ELEMENT_TYPE,
// Built-in properties that belong on the element
type: type,
key: key,
ref: ref,
props: props,
// Record the component responsible for creating this element.
_owner: owner
};
if (process.env.NODE_ENV !== 'production') {
// The validation flag is currently mutative. We put it on
// an external backing store so that we can freeze the whole object.
// This can be replaced with a WeakMap once they are implemented in
// commonly used development environments.
element._store = {};
// To make comparing ReactElements easier for testing purposes, we make
// the validation flag non-enumerable (where possible, which should
// include every environment we run tests in), so the test framework
// ignores it.
if (canDefineProperty) {
Object.defineProperty(element._store, 'validated', {
configurable: false,
enumerable: false,
writable: true,
value: false
});
// self and source are DEV only properties.
Object.defineProperty(element, '_self', {
configurable: false,
enumerable: false,
writable: false,
value: self
});
// Two elements created in two different places should be considered
// equal for testing purposes and therefore we hide it from enumeration.
Object.defineProperty(element, '_source', {
configurable: false,
enumerable: false,
writable: false,
value: source
});
} else {
element._store.validated = false;
element._self = self;
element._source = source;
}
Object.freeze(element.props);
Object.freeze(element);
}
return element;
};
ReactElement.createElement = function (type, config, children) {
var propName;
// Reserved names are extracted
var props = {};
var key = null;
var ref = null;
var self = null;
var source = null;
if (config != null) {
ref = config.ref === undefined ? null : config.ref;
key = config.key === undefined ? null : '' + config.key;
self = config.__self === undefined ? null : config.__self;
source = config.__source === undefined ? null : config.__source;
// Remaining properties are added to a new props object
for (propName in config) {
if (config.hasOwnProperty(propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
props[propName] = config[propName];
}
}
}
// Children can be more than one argument, and those are transferred onto
// the newly allocated props object.
var childrenLength = arguments.length - 2;
if (childrenLength === 1) {
props.children = children;
} else if (childrenLength > 1) {
var childArray = Array(childrenLength);
for (var i = 0; i < childrenLength; i++) {
childArray[i] = arguments[i + 2];
}
props.children = childArray;
}
// Resolve default props
if (type && type.defaultProps) {
var defaultProps = type.defaultProps;
for (propName in defaultProps) {
if (typeof props[propName] === 'undefined') {
props[propName] = defaultProps[propName];
}
}
}
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
};
ReactElement.createFactory = function (type) {
var factory = ReactElement.createElement.bind(null, type);
// Expose the type on the factory and the prototype so that it can be
// easily accessed on elements. E.g. `<Foo />.type === Foo`.
// This should not be named `constructor` since this may not be the function
// that created the element, and it may not even be a constructor.
// Legacy hook TODO: Warn if this is accessed
factory.type = type;
return factory;
};
ReactElement.cloneAndReplaceKey = function (oldElement, newKey) {
var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
return newElement;
};
ReactElement.cloneAndReplaceProps = function (oldElement, newProps) {
var newElement = ReactElement(oldElement.type, oldElement.key, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, newProps);
if (process.env.NODE_ENV !== 'production') {
// If the key on the original is valid, then the clone is valid
newElement._store.validated = oldElement._store.validated;
}
return newElement;
};
ReactElement.cloneElement = function (element, config, children) {
var propName;
// Original props are copied
var props = assign({}, element.props);
// Reserved names are extracted
var key = element.key;
var ref = element.ref;
// Self is preserved since the owner is preserved.
var self = element._self;
// Source is preserved since cloneElement is unlikely to be targeted by a
// transpiler, and the original source is probably a better indicator of the
// true owner.
var source = element._source;
// Owner will be preserved, unless ref is overridden
var owner = element._owner;
if (config != null) {
if (config.ref !== undefined) {
// Silently steal the ref from the parent.
ref = config.ref;
owner = ReactCurrentOwner.current;
}
if (config.key !== undefined) {
key = '' + config.key;
}
// Remaining properties override existing props
for (propName in config) {
if (config.hasOwnProperty(propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
props[propName] = config[propName];
}
}
}
// Children can be more than one argument, and those are transferred onto
// the newly allocated props object.
var childrenLength = arguments.length - 2;
if (childrenLength === 1) {
props.children = children;
} else if (childrenLength > 1) {
var childArray = Array(childrenLength);
for (var i = 0; i < childrenLength; i++) {
childArray[i] = arguments[i + 2];
}
props.children = childArray;
}
return ReactElement(element.type, key, ref, self, source, owner, props);
};
/**
* @param {?object} object
* @return {boolean} True if `object` is a valid component.
* @final
*/
ReactElement.isValidElement = function (object) {
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
};
module.exports = ReactElement;
}).call(this,require('_process'))
},{"./Object.assign":29,"./ReactCurrentOwner":41,"./canDefineProperty":111,"_process":164}],60:[function(require,module,exports){
(function (process){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactElementValidator
*/
/**
* ReactElementValidator provides a wrapper around a element factory
* which validates the props passed to the element. This is intended to be
* used only in DEV and could be replaced by a static type checker for languages
* that support it.
*/
'use strict';
var ReactElement = require('./ReactElement');
var ReactPropTypeLocations = require('./ReactPropTypeLocations');
var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames');
var ReactCurrentOwner = require('./ReactCurrentOwner');
var canDefineProperty = require('./canDefineProperty');
var getIteratorFn = require('./getIteratorFn');
var invariant = require('fbjs/lib/invariant');
var warning = require('fbjs/lib/warning');
function getDeclarationErrorAddendum() {
if (ReactCurrentOwner.current) {
var name = ReactCurrentOwner.current.getName();
if (name) {
return ' Check the render method of `' + name + '`.';
}
}
return '';
}
/**
* Warn if there's no key explicitly set on dynamic arrays of children or
* object keys are not valid. This allows us to keep track of children between
* updates.
*/
var ownerHasKeyUseWarning = {};
var loggedTypeFailures = {};
/**
* Warn if the element doesn't have an explicit key assigned to it.
* This element is in an array. The array could grow and shrink or be
* reordered. All children that haven't already been validated are required to
* have a "key" property assigned to it.
*
* @internal
* @param {ReactElement} element Element that requires a key.
* @param {*} parentType element's parent's type.
*/
function validateExplicitKey(element, parentType) {
if (!element._store || element._store.validated || element.key != null) {
return;
}
element._store.validated = true;
var addenda = getAddendaForKeyUse('uniqueKey', element, parentType);
if (addenda === null) {
// we already showed the warning
return;
}
process.env.NODE_ENV !== 'production' ? warning(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s%s', addenda.parentOrOwner || '', addenda.childOwner || '', addenda.url || '') : undefined;
}
/**
* Shared warning and monitoring code for the key warnings.
*
* @internal
* @param {string} messageType A key used for de-duping warnings.
* @param {ReactElement} element Component that requires a key.
* @param {*} parentType element's parent's type.
* @returns {?object} A set of addenda to use in the warning message, or null
* if the warning has already been shown before (and shouldn't be shown again).
*/
function getAddendaForKeyUse(messageType, element, parentType) {
var addendum = getDeclarationErrorAddendum();
if (!addendum) {
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
if (parentName) {
addendum = ' Check the top-level render call using <' + parentName + '>.';
}
}
var memoizer = ownerHasKeyUseWarning[messageType] || (ownerHasKeyUseWarning[messageType] = {});
if (memoizer[addendum]) {
return null;
}
memoizer[addendum] = true;
var addenda = {
parentOrOwner: addendum,
url: ' See https://fb.me/react-warning-keys for more information.',
childOwner: null
};
// Usually the current owner is the offender, but if it accepts children as a
// property, it may be the creator of the child that's responsible for
// assigning it a key.
if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
// Give the component that originally created this child.
addenda.childOwner = ' It was passed a child from ' + element._owner.getName() + '.';
}
return addenda;
}
/**
* Ensure that every element either is passed in a static location, in an
* array with an explicit keys property defined, or in an object literal
* with valid key property.
*
* @internal
* @param {ReactNode} node Statically passed child of any type.
* @param {*} parentType node's parent's type.
*/
function validateChildKeys(node, parentType) {
if (typeof node !== 'object') {
return;
}
if (Array.isArray(node)) {
for (var i = 0; i < node.length; i++) {
var child = node[i];
if (ReactElement.isValidElement(child)) {
validateExplicitKey(child, parentType);
}
}
} else if (ReactElement.isValidElement(node)) {
// This element was passed in a valid location.
if (node._store) {
node._store.validated = true;
}
} else if (node) {
var iteratorFn = getIteratorFn(node);
// Entry iterators provide implicit keys.
if (iteratorFn) {
if (iteratorFn !== node.entries) {
var iterator = iteratorFn.call(node);
var step;
while (!(step = iterator.next()).done) {
if (ReactElement.isValidElement(step.value)) {
validateExplicitKey(step.value, parentType);
}
}
}
}
}
}
/**
* Assert that the props are valid
*
* @param {string} componentName Name of the component for error messages.
* @param {object} propTypes Map of prop name to a ReactPropType
* @param {object} props
* @param {string} location e.g. "prop", "context", "child context"
* @private
*/
function checkPropTypes(componentName, propTypes, props, location) {
for (var propName in propTypes) {
if (propTypes.hasOwnProperty(propName)) {
var error;
// Prop type validation may throw. In case they do, we don't want to
// fail the render phase where it didn't fail before. So we log it.
// After these have been cleaned up, we'll let them throw.
try {
// This is intentionally an invariant that gets caught. It's the same
// behavior as without this statement except with a better message.
!(typeof propTypes[propName] === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], propName) : invariant(false) : undefined;
error = propTypes[propName](props, propName, componentName, location);
} catch (ex) {
error = ex;
}
process.env.NODE_ENV !== 'production' ? warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', ReactPropTypeLocationNames[location], propName, typeof error) : undefined;
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
// Only monitor this failure once because there tends to be a lot of the
// same error.
loggedTypeFailures[error.message] = true;
var addendum = getDeclarationErrorAddendum();
process.env.NODE_ENV !== 'production' ? warning(false, 'Failed propType: %s%s', error.message, addendum) : undefined;
}
}
}
}
/**
* Given an element, validate that its props follow the propTypes definition,
* provided by the type.
*
* @param {ReactElement} element
*/
function validatePropTypes(element) {
var componentClass = element.type;
if (typeof componentClass !== 'function') {
return;
}
var name = componentClass.displayName || componentClass.name;
if (componentClass.propTypes) {
checkPropTypes(name, componentClass.propTypes, element.props, ReactPropTypeLocations.prop);
}
if (typeof componentClass.getDefaultProps === 'function') {
process.env.NODE_ENV !== 'production' ? warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : undefined;
}
}
var ReactElementValidator = {
createElement: function (type, props, children) {
var validType = typeof type === 'string' || typeof type === 'function';
// We warn in this case but don't throw. We expect the element creation to
// succeed and there will likely be errors in render.
process.env.NODE_ENV !== 'production' ? warning(validType, 'React.createElement: type should not be null, undefined, boolean, or ' + 'number. It should be a string (for DOM elements) or a ReactClass ' + '(for composite components).%s', getDeclarationErrorAddendum()) : undefined;
var element = ReactElement.createElement.apply(this, arguments);
// The result can be nullish if a mock or a custom function is used.
// TODO: Drop this when these are no longer allowed as the type argument.
if (element == null) {
return element;
}
// Skip key warning if the type isn't valid since our key validation logic
// doesn't expect a non-string/function type and can throw confusing errors.
// We don't want exception behavior to differ between dev and prod.
// (Rendering will throw with a helpful message and as soon as the type is
// fixed, the key warnings will appear.)
if (validType) {
for (var i = 2; i < arguments.length; i++) {
validateChildKeys(arguments[i], type);
}
}
validatePropTypes(element);
return element;
},
createFactory: function (type) {
var validatedFactory = ReactElementValidator.createElement.bind(null, type);
// Legacy hook TODO: Warn if this is accessed
validatedFactory.type = type;
if (process.env.NODE_ENV !== 'production') {
if (canDefineProperty) {
Object.defineProperty(validatedFactory, 'type', {
enumerable: false,
get: function () {
process.env.NODE_ENV !== 'production' ? warning(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.') : undefined;
Object.defineProperty(this, 'type', {
value: type
});
return type;
}
});
}
}
return validatedFactory;
},
cloneElement: function (element, props, children) {
var newElement = ReactElement.cloneElement.apply(this, arguments);
for (var i = 2; i < arguments.length; i++) {
validateChildKeys(arguments[i], newElement.type);
}
validatePropTypes(newElement);
return newElement;
}
};
module.exports = ReactElementValidator;
}).call(this,require('_process'))
},{"./ReactCurrentOwner":41,"./ReactElement":59,"./ReactPropTypeLocationNames":79,"./ReactPropTypeLocations":80,"./canDefineProperty":111,"./getIteratorFn":122,"_process":164,"fbjs/lib/invariant":151,"fbjs/lib/warning":162}],61:[function(require,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactEmptyComponent
*/
'use strict';
var ReactElement = require('./ReactElement');
var ReactEmptyComponentRegistry = require('./ReactEmptyComponentRegistry');
var ReactReconciler = require('./ReactReconciler');
var assign = require('./Object.assign');
var placeholderElement;
var ReactEmptyComponentInjection = {
injectEmptyComponent: function (component) {
placeholderElement = ReactElement.createElement(component);
}
};
var ReactEmptyComponent = function (instantiate) {
this._currentElement = null;
this._rootNodeID = null;
this._renderedComponent = instantiate(placeholderElement);
};
assign(ReactEmptyComponent.prototype, {
construct: function (element) {},
mountComponent: function (rootID, transaction, context) {
ReactEmptyComponentRegistry.registerNullComponentID(rootID);
this._rootNodeID = rootID;
return ReactReconciler.mountComponent(this._renderedComponent, rootID, transaction, context);
},
receiveComponent: function () {},
unmountComponent: function (rootID, transaction, context) {
ReactReconciler.unmountComponent(this._renderedComponent);
ReactEmptyComponentRegistry.deregisterNullComponentID(this._rootNodeID);
this._rootNodeID = null;
this._renderedComponent = null;
}
});
ReactEmptyComponent.injection = ReactEmptyComponentInjection;
module.exports = ReactEmptyComponent;
},{"./Object.assign":29,"./ReactElement":59,"./ReactEmptyComponentRegistry":62,"./ReactReconciler":83}],62:[function(require,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactEmptyComponentRegistry
*/
'use strict';
// This registry keeps track of the React IDs of the components that rendered to
// `null` (in reality a placeholder such as `noscript`)
var nullComponentIDsRegistry = {};
/**
* @param {string} id Component's `_rootNodeID`.
* @return {boolean} True if the component is rendered to null.
*/
function isNullComponentID(id) {
return !!nullComponentIDsRegistry[id];
}
/**
* Mark the component as having rendered to null.
* @param {string} id Component's `_rootNodeID`.
*/
function registerNullComponentID(id) {
nullComponentIDsRegistry[id] = true;
}
/**
* Unmark the component as having rendered to null: it renders to something now.
* @param {string} id Component's `_rootNodeID`.
*/
function deregisterNullComponentID(id) {
delete nullComponentIDsRegistry[id];
}
var ReactEmptyComponentRegistry = {
isNullComponentID: isNullComponentID,
registerNullComponentID: registerNullComponentID,
deregisterNullComponentID: deregisterNullComponentID
};
module.exports = ReactEmptyComponentRegistry;
},{}],63:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactErrorUtils
* @typechecks
*/
'use strict';
var caughtError = null;
/**
* Call a function while guarding against errors that happens within it.
*
* @param {?String} name of the guard to use for logging or debugging
* @param {Function} func The function to invoke
* @param {*} a First argument
* @param {*} b Second argument
*/
function invokeGuardedCallback(name, func, a, b) {
try {
return func(a, b);
} catch (x) {
if (caughtError === null) {
caughtError = x;
}
return undefined;
}
}
var ReactErrorUtils = {
invokeGuardedCallback: invokeGuardedCallback,
/**
* Invoked by ReactTestUtils.Simulate so that any errors thrown by the event
* handler are sure to be rethrown by rethrowCaughtError.
*/
invokeGuardedCallbackWithCatch: invokeGuardedCallback,
/**
* During execution of guarded functions we will capture the first error which
* we will rethrow to be handled by the top level error handler.
*/
rethrowCaughtError: function () {
if (caughtError) {
var error = caughtError;
caughtError = null;
throw error;
}
}
};
if (process.env.NODE_ENV !== 'production') {
/**
* To help development we can get better devtools integration by simulating a
* real browser event.
*/
if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') {
var fakeNode = document.createElement('react');
ReactErrorUtils.invokeGuardedCallback = function (name, func, a, b) {
var boundFunc = func.bind(null, a, b);
var evtType = 'react-' + name;
fakeNode.addEventListener(evtType, boundFunc, false);
var evt = document.createEvent('Event');
evt.initEvent(evtType, false, false);
fakeNode.dispatchEvent(evt);
fakeNode.removeEventListener(evtType, boundFunc, false);
};
}
}
module.exports = ReactErrorUtils;
}).call(this,require('_process'))
},{"_process":164}],64:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactEventEmitterMixin
*/
'use strict';
var EventPluginHub = require('./EventPluginHub');
function runEventQueueInBatch(events) {
EventPluginHub.enqueueEvents(events);
EventPluginHub.processEventQueue(false);
}
var ReactEventEmitterMixin = {
/**
* Streams a fired top-level event to `EventPluginHub` where plugins have the
* opportunity to create `ReactEvent`s to be dispatched.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {object} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native environment event.
*/
handleTopLevel: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
var events = EventPluginHub.extractEvents(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget);
runEventQueueInBatch(events);
}
};
module.exports = ReactEventEmitterMixin;
},{"./EventPluginHub":22}],65:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactEventListener
* @typechecks static-only
*/
'use strict';
var EventListener = require('fbjs/lib/EventListener');
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
var PooledClass = require('./PooledClass');
var ReactInstanceHandles = require('./ReactInstanceHandles');
var ReactMount = require('./ReactMount');
var ReactUpdates = require('./ReactUpdates');
var assign = require('./Object.assign');
var getEventTarget = require('./getEventTarget');
var getUnboundedScrollPosition = require('fbjs/lib/getUnboundedScrollPosition');
var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
/**
* Finds the parent React component of `node`.
*
* @param {*} node
* @return {?DOMEventTarget} Parent container, or `null` if the specified node
* is not nested.
*/
function findParent(node) {
// TODO: It may be a good idea to cache this to prevent unnecessary DOM
// traversal, but caching is difficult to do correctly without using a
// mutation observer to listen for all DOM changes.
var nodeID = ReactMount.getID(node);
var rootID = ReactInstanceHandles.getReactRootIDFromNodeID(nodeID);
var container = ReactMount.findReactContainerForID(rootID);
var parent = ReactMount.getFirstReactDOM(container);
return parent;
}
// Used to store ancestor hierarchy in top level callback
function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) {
this.topLevelType = topLevelType;
this.nativeEvent = nativeEvent;
this.ancestors = [];
}
assign(TopLevelCallbackBookKeeping.prototype, {
destructor: function () {
this.topLevelType = null;
this.nativeEvent = null;
this.ancestors.length = 0;
}
});
PooledClass.addPoolingTo(TopLevelCallbackBookKeeping, PooledClass.twoArgumentPooler);
function handleTopLevelImpl(bookKeeping) {
// TODO: Re-enable event.path handling
//
// if (bookKeeping.nativeEvent.path && bookKeeping.nativeEvent.path.length > 1) {
// // New browsers have a path attribute on native events
// handleTopLevelWithPath(bookKeeping);
// } else {
// // Legacy browsers don't have a path attribute on native events
// handleTopLevelWithoutPath(bookKeeping);
// }
void handleTopLevelWithPath; // temporarily unused
handleTopLevelWithoutPath(bookKeeping);
}
// Legacy browsers don't have a path attribute on native events
function handleTopLevelWithoutPath(bookKeeping) {
var topLevelTarget = ReactMount.getFirstReactDOM(getEventTarget(bookKeeping.nativeEvent)) || window;
// Loop through the hierarchy, in case there's any nested components.
// It's important that we build the array of ancestors before calling any
// event handlers, because event handlers can modify the DOM, leading to
// inconsistencies with ReactMount's node cache. See #1105.
var ancestor = topLevelTarget;
while (ancestor) {
bookKeeping.ancestors.push(ancestor);
ancestor = findParent(ancestor);
}
for (var i = 0; i < bookKeeping.ancestors.length; i++) {
topLevelTarget = bookKeeping.ancestors[i];
var topLevelTargetID = ReactMount.getID(topLevelTarget) || '';
ReactEventListener._handleTopLevel(bookKeeping.topLevelType, topLevelTarget, topLevelTargetID, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
}
}
// New browsers have a path attribute on native events
function handleTopLevelWithPath(bookKeeping) {
var path = bookKeeping.nativeEvent.path;
var currentNativeTarget = path[0];
var eventsFired = 0;
for (var i = 0; i < path.length; i++) {
var currentPathElement = path[i];
if (currentPathElement.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE) {
currentNativeTarget = path[i + 1];
}
// TODO: slow
var reactParent = ReactMount.getFirstReactDOM(currentPathElement);
if (reactParent === currentPathElement) {
var currentPathElementID = ReactMount.getID(currentPathElement);
var newRootID = ReactInstanceHandles.getReactRootIDFromNodeID(currentPathElementID);
bookKeeping.ancestors.push(currentPathElement);
var topLevelTargetID = ReactMount.getID(currentPathElement) || '';
eventsFired++;
ReactEventListener._handleTopLevel(bookKeeping.topLevelType, currentPathElement, topLevelTargetID, bookKeeping.nativeEvent, currentNativeTarget);
// Jump to the root of this React render tree
while (currentPathElementID !== newRootID) {
i++;
currentPathElement = path[i];
currentPathElementID = ReactMount.getID(currentPathElement);
}
}
}
if (eventsFired === 0) {
ReactEventListener._handleTopLevel(bookKeeping.topLevelType, window, '', bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
}
}
function scrollValueMonitor(cb) {
var scrollPosition = getUnboundedScrollPosition(window);
cb(scrollPosition);
}
var ReactEventListener = {
_enabled: true,
_handleTopLevel: null,
WINDOW_HANDLE: ExecutionEnvironment.canUseDOM ? window : null,
setHandleTopLevel: function (handleTopLevel) {
ReactEventListener._handleTopLevel = handleTopLevel;
},
setEnabled: function (enabled) {
ReactEventListener._enabled = !!enabled;
},
isEnabled: function () {
return ReactEventListener._enabled;
},
/**
* Traps top-level events by using event bubbling.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {string} handlerBaseName Event name (e.g. "click").
* @param {object} handle Element on which to attach listener.
* @return {?object} An object with a remove function which will forcefully
* remove the listener.
* @internal
*/
trapBubbledEvent: function (topLevelType, handlerBaseName, handle) {
var element = handle;
if (!element) {
return null;
}
return EventListener.listen(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
},
/**
* Traps a top-level event by using event capturing.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {string} handlerBaseName Event name (e.g. "click").
* @param {object} handle Element on which to attach listener.
* @return {?object} An object with a remove function which will forcefully
* remove the listener.
* @internal
*/
trapCapturedEvent: function (topLevelType, handlerBaseName, handle) {
var element = handle;
if (!element) {
return null;
}
return EventListener.capture(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
},
monitorScrollValue: function (refresh) {
var callback = scrollValueMonitor.bind(null, refresh);
EventListener.listen(window, 'scroll', callback);
},
dispatchEvent: function (topLevelType, nativeEvent) {
if (!ReactEventListener._enabled) {
return;
}
var bookKeeping = TopLevelCallbackBookKeeping.getPooled(topLevelType, nativeEvent);
try {
// Event queue being processed in the same cycle allows
// `preventDefault`.
ReactUpdates.batchedUpdates(handleTopLevelImpl, bookKeeping);
} finally {
TopLevelCallbackBookKeeping.release(bookKeeping);
}
}
};
module.exports = ReactEventListener;
},{"./Object.assign":29,"./PooledClass":30,"./ReactInstanceHandles":68,"./ReactMount":72,"./ReactUpdates":90,"./getEventTarget":121,"fbjs/lib/EventListener":136,"fbjs/lib/ExecutionEnvironment":137,"fbjs/lib/getUnboundedScrollPosition":148}],66:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactInjection
*/
'use strict';
var DOMProperty = require('./DOMProperty');
var EventPluginHub = require('./EventPluginHub');
var ReactComponentEnvironment = require('./ReactComponentEnvironment');
var ReactClass = require('./ReactClass');
var ReactEmptyComponent = require('./ReactEmptyComponent');
var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
var ReactNativeComponent = require('./ReactNativeComponent');
var ReactPerf = require('./ReactPerf');
var ReactRootIndex = require('./ReactRootIndex');
var ReactUpdates = require('./ReactUpdates');
var ReactInjection = {
Component: ReactComponentEnvironment.injection,
Class: ReactClass.injection,
DOMProperty: DOMProperty.injection,
EmptyComponent: ReactEmptyComponent.injection,
EventPluginHub: EventPluginHub.injection,
EventEmitter: ReactBrowserEventEmitter.injection,
NativeComponent: ReactNativeComponent.injection,
Perf: ReactPerf.injection,
RootIndex: ReactRootIndex.injection,
Updates: ReactUpdates.injection
};
module.exports = ReactInjection;
},{"./DOMProperty":16,"./EventPluginHub":22,"./ReactBrowserEventEmitter":33,"./ReactClass":36,"./ReactComponentEnvironment":39,"./ReactEmptyComponent":61,"./ReactNativeComponent":75,"./ReactPerf":78,"./ReactRootIndex":85,"./ReactUpdates":90}],67:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactInputSelection
*/
'use strict';
var ReactDOMSelection = require('./ReactDOMSelection');
var containsNode = require('fbjs/lib/containsNode');
var focusNode = require('fbjs/lib/focusNode');
var getActiveElement = require('fbjs/lib/getActiveElement');
function isInDocument(node) {
return containsNode(document.documentElement, node);
}
/**
* @ReactInputSelection: React input selection module. Based on Selection.js,
* but modified to be suitable for react and has a couple of bug fixes (doesn't
* assume buttons have range selections allowed).
* Input selection module for React.
*/
var ReactInputSelection = {
hasSelectionCapabilities: function (elem) {
var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
return nodeName && (nodeName === 'input' && elem.type === 'text' || nodeName === 'textarea' || elem.contentEditable === 'true');
},
getSelectionInformation: function () {
var focusedElem = getActiveElement();
return {
focusedElem: focusedElem,
selectionRange: ReactInputSelection.hasSelectionCapabilities(focusedElem) ? ReactInputSelection.getSelection(focusedElem) : null
};
},
/**
* @restoreSelection: If any selection information was potentially lost,
* restore it. This is useful when performing operations that could remove dom
* nodes and place them back in, resulting in focus being lost.
*/
restoreSelection: function (priorSelectionInformation) {
var curFocusedElem = getActiveElement();
var priorFocusedElem = priorSelectionInformation.focusedElem;
var priorSelectionRange = priorSelectionInformation.selectionRange;
if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) {
if (ReactInputSelection.hasSelectionCapabilities(priorFocusedElem)) {
ReactInputSelection.setSelection(priorFocusedElem, priorSelectionRange);
}
focusNode(priorFocusedElem);
}
},
/**
* @getSelection: Gets the selection bounds of a focused textarea, input or
* contentEditable node.
* -@input: Look up selection bounds of this input
* -@return {start: selectionStart, end: selectionEnd}
*/
getSelection: function (input) {
var selection;
if ('selectionStart' in input) {
// Modern browser with input or textarea.
selection = {
start: input.selectionStart,
end: input.selectionEnd
};
} else if (document.selection && (input.nodeName && input.nodeName.toLowerCase() === 'input')) {
// IE8 input.
var range = document.selection.createRange();
// There can only be one selection per document in IE, so it must
// be in our element.
if (range.parentElement() === input) {
selection = {
start: -range.moveStart('character', -input.value.length),
end: -range.moveEnd('character', -input.value.length)
};
}
} else {
// Content editable or old IE textarea.
selection = ReactDOMSelection.getOffsets(input);
}
return selection || { start: 0, end: 0 };
},
/**
* @setSelection: Sets the selection bounds of a textarea or input and focuses
* the input.
* -@input Set selection bounds of this input or textarea
* -@offsets Object of same form that is returned from get*
*/
setSelection: function (input, offsets) {
var start = offsets.start;
var end = offsets.end;
if (typeof end === 'undefined') {
end = start;
}
if ('selectionStart' in input) {
input.selectionStart = start;
input.selectionEnd = Math.min(end, input.value.length);
} else if (document.selection && (input.nodeName && input.nodeName.toLowerCase() === 'input')) {
var range = input.createTextRange();
range.collapse(true);
range.moveStart('character', start);
range.moveEnd('character', end - start);
range.select();
} else {
ReactDOMSelection.setOffsets(input, offsets);
}
}
};
module.exports = ReactInputSelection;
},{"./ReactDOMSelection":51,"fbjs/lib/containsNode":140,"fbjs/lib/focusNode":145,"fbjs/lib/getActiveElement":146}],68:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactInstanceHandles
* @typechecks static-only
*/
'use strict';
var ReactRootIndex = require('./ReactRootIndex');
var invariant = require('fbjs/lib/invariant');
var SEPARATOR = '.';
var SEPARATOR_LENGTH = SEPARATOR.length;
/**
* Maximum depth of traversals before we consider the possibility of a bad ID.
*/
var MAX_TREE_DEPTH = 10000;
/**
* Creates a DOM ID prefix to use when mounting React components.
*
* @param {number} index A unique integer
* @return {string} React root ID.
* @internal
*/
function getReactRootIDString(index) {
return SEPARATOR + index.toString(36);
}
/**
* Checks if a character in the supplied ID is a separator or the end.
*
* @param {string} id A React DOM ID.
* @param {number} index Index of the character to check.
* @return {boolean} True if the character is a separator or end of the ID.
* @private
*/
function isBoundary(id, index) {
return id.charAt(index) === SEPARATOR || index === id.length;
}
/**
* Checks if the supplied string is a valid React DOM ID.
*
* @param {string} id A React DOM ID, maybe.
* @return {boolean} True if the string is a valid React DOM ID.
* @private
*/
function isValidID(id) {
return id === '' || id.charAt(0) === SEPARATOR && id.charAt(id.length - 1) !== SEPARATOR;
}
/**
* Checks if the first ID is an ancestor of or equal to the second ID.
*
* @param {string} ancestorID
* @param {string} descendantID
* @return {boolean} True if `ancestorID` is an ancestor of `descendantID`.
* @internal
*/
function isAncestorIDOf(ancestorID, descendantID) {
return descendantID.indexOf(ancestorID) === 0 && isBoundary(descendantID, ancestorID.length);
}
/**
* Gets the parent ID of the supplied React DOM ID, `id`.
*
* @param {string} id ID of a component.
* @return {string} ID of the parent, or an empty string.
* @private
*/
function getParentID(id) {
return id ? id.substr(0, id.lastIndexOf(SEPARATOR)) : '';
}
/**
* Gets the next DOM ID on the tree path from the supplied `ancestorID` to the
* supplied `destinationID`. If they are equal, the ID is returned.
*
* @param {string} ancestorID ID of an ancestor node of `destinationID`.
* @param {string} destinationID ID of the destination node.
* @return {string} Next ID on the path from `ancestorID` to `destinationID`.
* @private
*/
function getNextDescendantID(ancestorID, destinationID) {
!(isValidID(ancestorID) && isValidID(destinationID)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNextDescendantID(%s, %s): Received an invalid React DOM ID.', ancestorID, destinationID) : invariant(false) : undefined;
!isAncestorIDOf(ancestorID, destinationID) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNextDescendantID(...): React has made an invalid assumption about ' + 'the DOM hierarchy. Expected `%s` to be an ancestor of `%s`.', ancestorID, destinationID) : invariant(false) : undefined;
if (ancestorID === destinationID) {
return ancestorID;
}
// Skip over the ancestor and the immediate separator. Traverse until we hit
// another separator or we reach the end of `destinationID`.
var start = ancestorID.length + SEPARATOR_LENGTH;
var i;
for (i = start; i < destinationID.length; i++) {
if (isBoundary(destinationID, i)) {
break;
}
}
return destinationID.substr(0, i);
}
/**
* Gets the nearest common ancestor ID of two IDs.
*
* Using this ID scheme, the nearest common ancestor ID is the longest common
* prefix of the two IDs that immediately preceded a "marker" in both strings.
*
* @param {string} oneID
* @param {string} twoID
* @return {string} Nearest common ancestor ID, or the empty string if none.
* @private
*/
function getFirstCommonAncestorID(oneID, twoID) {
var minLength = Math.min(oneID.length, twoID.length);
if (minLength === 0) {
return '';
}
var lastCommonMarkerIndex = 0;
// Use `<=` to traverse until the "EOL" of the shorter string.
for (var i = 0; i <= minLength; i++) {
if (isBoundary(oneID, i) && isBoundary(twoID, i)) {
lastCommonMarkerIndex = i;
} else if (oneID.charAt(i) !== twoID.charAt(i)) {
break;
}
}
var longestCommonID = oneID.substr(0, lastCommonMarkerIndex);
!isValidID(longestCommonID) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getFirstCommonAncestorID(%s, %s): Expected a valid React DOM ID: %s', oneID, twoID, longestCommonID) : invariant(false) : undefined;
return longestCommonID;
}
/**
* Traverses the parent path between two IDs (either up or down). The IDs must
* not be the same, and there must exist a parent path between them. If the
* callback returns `false`, traversal is stopped.
*
* @param {?string} start ID at which to start traversal.
* @param {?string} stop ID at which to end traversal.
* @param {function} cb Callback to invoke each ID with.
* @param {*} arg Argument to invoke the callback with.
* @param {?boolean} skipFirst Whether or not to skip the first node.
* @param {?boolean} skipLast Whether or not to skip the last node.
* @private
*/
function traverseParentPath(start, stop, cb, arg, skipFirst, skipLast) {
start = start || '';
stop = stop || '';
!(start !== stop) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'traverseParentPath(...): Cannot traverse from and to the same ID, `%s`.', start) : invariant(false) : undefined;
var traverseUp = isAncestorIDOf(stop, start);
!(traverseUp || isAncestorIDOf(start, stop)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'traverseParentPath(%s, %s, ...): Cannot traverse from two IDs that do ' + 'not have a parent path.', start, stop) : invariant(false) : undefined;
// Traverse from `start` to `stop` one depth at a time.
var depth = 0;
var traverse = traverseUp ? getParentID : getNextDescendantID;
for (var id = start;; /* until break */id = traverse(id, stop)) {
var ret;
if ((!skipFirst || id !== start) && (!skipLast || id !== stop)) {
ret = cb(id, traverseUp, arg);
}
if (ret === false || id === stop) {
// Only break //after// visiting `stop`.
break;
}
!(depth++ < MAX_TREE_DEPTH) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'traverseParentPath(%s, %s, ...): Detected an infinite loop while ' + 'traversing the React DOM ID tree. This may be due to malformed IDs: %s', start, stop, id) : invariant(false) : undefined;
}
}
/**
* Manages the IDs assigned to DOM representations of React components. This
* uses a specific scheme in order to traverse the DOM efficiently (e.g. in
* order to simulate events).
*
* @internal
*/
var ReactInstanceHandles = {
/**
* Constructs a React root ID
* @return {string} A React root ID.
*/
createReactRootID: function () {
return getReactRootIDString(ReactRootIndex.createReactRootIndex());
},
/**
* Constructs a React ID by joining a root ID with a name.
*
* @param {string} rootID Root ID of a parent component.
* @param {string} name A component's name (as flattened children).
* @return {string} A React ID.
* @internal
*/
createReactID: function (rootID, name) {
return rootID + name;
},
/**
* Gets the DOM ID of the React component that is the root of the tree that
* contains the React component with the supplied DOM ID.
*
* @param {string} id DOM ID of a React component.
* @return {?string} DOM ID of the React component that is the root.
* @internal
*/
getReactRootIDFromNodeID: function (id) {
if (id && id.charAt(0) === SEPARATOR && id.length > 1) {
var index = id.indexOf(SEPARATOR, 1);
return index > -1 ? id.substr(0, index) : id;
}
return null;
},
/**
* Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
* should would receive a `mouseEnter` or `mouseLeave` event.
*
* NOTE: Does not invoke the callback on the nearest common ancestor because
* nothing "entered" or "left" that element.
*
* @param {string} leaveID ID being left.
* @param {string} enterID ID being entered.
* @param {function} cb Callback to invoke on each entered/left ID.
* @param {*} upArg Argument to invoke the callback with on left IDs.
* @param {*} downArg Argument to invoke the callback with on entered IDs.
* @internal
*/
traverseEnterLeave: function (leaveID, enterID, cb, upArg, downArg) {
var ancestorID = getFirstCommonAncestorID(leaveID, enterID);
if (ancestorID !== leaveID) {
traverseParentPath(leaveID, ancestorID, cb, upArg, false, true);
}
if (ancestorID !== enterID) {
traverseParentPath(ancestorID, enterID, cb, downArg, true, false);
}
},
/**
* Simulates the traversal of a two-phase, capture/bubble event dispatch.
*
* NOTE: This traversal happens on IDs without touching the DOM.
*
* @param {string} targetID ID of the target node.
* @param {function} cb Callback to invoke.
* @param {*} arg Argument to invoke the callback with.
* @internal
*/
traverseTwoPhase: function (targetID, cb, arg) {
if (targetID) {
traverseParentPath('', targetID, cb, arg, true, false);
traverseParentPath(targetID, '', cb, arg, false, true);
}
},
/**
* Same as `traverseTwoPhase` but skips the `targetID`.
*/
traverseTwoPhaseSkipTarget: function (targetID, cb, arg) {
if (targetID) {
traverseParentPath('', targetID, cb, arg, true, true);
traverseParentPath(targetID, '', cb, arg, true, true);
}
},
/**
* Traverse a node ID, calling the supplied `cb` for each ancestor ID. For
* example, passing `.0.$row-0.1` would result in `cb` getting called
* with `.0`, `.0.$row-0`, and `.0.$row-0.1`.
*
* NOTE: This traversal happens on IDs without touching the DOM.
*
* @param {string} targetID ID of the target node.
* @param {function} cb Callback to invoke.
* @param {*} arg Argument to invoke the callback with.
* @internal
*/
traverseAncestors: function (targetID, cb, arg) {
traverseParentPath('', targetID, cb, arg, true, false);
},
getFirstCommonAncestorID: getFirstCommonAncestorID,
/**
* Exposed for unit testing.
* @private
*/
_getNextDescendantID: getNextDescendantID,
isAncestorIDOf: isAncestorIDOf,
SEPARATOR: SEPARATOR
};
module.exports = ReactInstanceHandles;
}).call(this,require('_process'))
},{"./ReactRootIndex":85,"_process":164,"fbjs/lib/invariant":151}],69:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactInstanceMap
*/
'use strict';
/**
* `ReactInstanceMap` maintains a mapping from a public facing stateful
* instance (key) and the internal representation (value). This allows public
* methods to accept the user facing instance as an argument and map them back
* to internal methods.
*/
// TODO: Replace this with ES6: var ReactInstanceMap = new Map();
var ReactInstanceMap = {
/**
* This API should be called `delete` but we'd have to make sure to always
* transform these to strings for IE support. When this transform is fully
* supported we can rename it.
*/
remove: function (key) {
key._reactInternalInstance = undefined;
},
get: function (key) {
return key._reactInternalInstance;
},
has: function (key) {
return key._reactInternalInstance !== undefined;
},
set: function (key, value) {
key._reactInternalInstance = value;
}
};
module.exports = ReactInstanceMap;
},{}],70:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactIsomorphic
*/
'use strict';
var ReactChildren = require('./ReactChildren');
var ReactComponent = require('./ReactComponent');
var ReactClass = require('./ReactClass');
var ReactDOMFactories = require('./ReactDOMFactories');
var ReactElement = require('./ReactElement');
var ReactElementValidator = require('./ReactElementValidator');
var ReactPropTypes = require('./ReactPropTypes');
var ReactVersion = require('./ReactVersion');
var assign = require('./Object.assign');
var onlyChild = require('./onlyChild');
var createElement = ReactElement.createElement;
var createFactory = ReactElement.createFactory;
var cloneElement = ReactElement.cloneElement;
if (process.env.NODE_ENV !== 'production') {
createElement = ReactElementValidator.createElement;
createFactory = ReactElementValidator.createFactory;
cloneElement = ReactElementValidator.cloneElement;
}
var React = {
// Modern
Children: {
map: ReactChildren.map,
forEach: ReactChildren.forEach,
count: ReactChildren.count,
toArray: ReactChildren.toArray,
only: onlyChild
},
Component: ReactComponent,
createElement: createElement,
cloneElement: cloneElement,
isValidElement: ReactElement.isValidElement,
// Classic
PropTypes: ReactPropTypes,
createClass: ReactClass.createClass,
createFactory: createFactory,
createMixin: function (mixin) {
// Currently a noop. Will be used to validate and trace mixins.
return mixin;
},
// This looks DOM specific but these are actually isomorphic helpers
// since they are just generating DOM strings.
DOM: ReactDOMFactories,
version: ReactVersion,
// Hook for JSX spread, don't use this for anything else.
__spread: assign
};
module.exports = React;
}).call(this,require('_process'))
},{"./Object.assign":29,"./ReactChildren":35,"./ReactClass":36,"./ReactComponent":37,"./ReactDOMFactories":45,"./ReactElement":59,"./ReactElementValidator":60,"./ReactPropTypes":81,"./ReactVersion":91,"./onlyChild":128,"_process":164}],71:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactMarkupChecksum
*/
'use strict';
var adler32 = require('./adler32');
var TAG_END = /\/?>/;
var ReactMarkupChecksum = {
CHECKSUM_ATTR_NAME: 'data-react-checksum',
/**
* @param {string} markup Markup string
* @return {string} Markup string with checksum attribute attached
*/
addChecksumToMarkup: function (markup) {
var checksum = adler32(markup);
// Add checksum (handle both parent tags and self-closing tags)
return markup.replace(TAG_END, ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '"$&');
},
/**
* @param {string} markup to use
* @param {DOMElement} element root React element
* @returns {boolean} whether or not the markup is the same
*/
canReuseMarkup: function (markup, element) {
var existingChecksum = element.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
existingChecksum = existingChecksum && parseInt(existingChecksum, 10);
var markupChecksum = adler32(markup);
return markupChecksum === existingChecksum;
}
};
module.exports = ReactMarkupChecksum;
},{"./adler32":110}],72:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactMount
*/
'use strict';
var DOMProperty = require('./DOMProperty');
var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
var ReactCurrentOwner = require('./ReactCurrentOwner');
var ReactDOMFeatureFlags = require('./ReactDOMFeatureFlags');
var ReactElement = require('./ReactElement');
var ReactEmptyComponentRegistry = require('./ReactEmptyComponentRegistry');
var ReactInstanceHandles = require('./ReactInstanceHandles');
var ReactInstanceMap = require('./ReactInstanceMap');
var ReactMarkupChecksum = require('./ReactMarkupChecksum');
var ReactPerf = require('./ReactPerf');
var ReactReconciler = require('./ReactReconciler');
var ReactUpdateQueue = require('./ReactUpdateQueue');
var ReactUpdates = require('./ReactUpdates');
var assign = require('./Object.assign');
var emptyObject = require('fbjs/lib/emptyObject');
var containsNode = require('fbjs/lib/containsNode');
var instantiateReactComponent = require('./instantiateReactComponent');
var invariant = require('fbjs/lib/invariant');
var setInnerHTML = require('./setInnerHTML');
var shouldUpdateReactComponent = require('./shouldUpdateReactComponent');
var validateDOMNesting = require('./validateDOMNesting');
var warning = require('fbjs/lib/warning');
var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME;
var nodeCache = {};
var ELEMENT_NODE_TYPE = 1;
var DOC_NODE_TYPE = 9;
var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
var ownerDocumentContextKey = '__ReactMount_ownerDocument$' + Math.random().toString(36).slice(2);
/** Mapping from reactRootID to React component instance. */
var instancesByReactRootID = {};
/** Mapping from reactRootID to `container` nodes. */
var containersByReactRootID = {};
if (process.env.NODE_ENV !== 'production') {
/** __DEV__-only mapping from reactRootID to root elements. */
var rootElementsByReactRootID = {};
}
// Used to store breadth-first search state in findComponentRoot.
var findComponentRootReusableArray = [];
/**
* Finds the index of the first character
* that's not common between the two given strings.
*
* @return {number} the index of the character where the strings diverge
*/
function firstDifferenceIndex(string1, string2) {
var minLen = Math.min(string1.length, string2.length);
for (var i = 0; i < minLen; i++) {
if (string1.charAt(i) !== string2.charAt(i)) {
return i;
}
}
return string1.length === string2.length ? -1 : minLen;
}
/**
* @param {DOMElement|DOMDocument} container DOM element that may contain
* a React component
* @return {?*} DOM element that may have the reactRoot ID, or null.
*/
function getReactRootElementInContainer(container) {
if (!container) {
return null;
}
if (container.nodeType === DOC_NODE_TYPE) {
return container.documentElement;
} else {
return container.firstChild;
}
}
/**
* @param {DOMElement} container DOM element that may contain a React component.
* @return {?string} A "reactRoot" ID, if a React component is rendered.
*/
function getReactRootID(container) {
var rootElement = getReactRootElementInContainer(container);
return rootElement && ReactMount.getID(rootElement);
}
/**
* Accessing node[ATTR_NAME] or calling getAttribute(ATTR_NAME) on a form
* element can return its control whose name or ID equals ATTR_NAME. All
* DOM nodes support `getAttributeNode` but this can also get called on
* other objects so just return '' if we're given something other than a
* DOM node (such as window).
*
* @param {?DOMElement|DOMWindow|DOMDocument|DOMTextNode} node DOM node.
* @return {string} ID of the supplied `domNode`.
*/
function getID(node) {
var id = internalGetID(node);
if (id) {
if (nodeCache.hasOwnProperty(id)) {
var cached = nodeCache[id];
if (cached !== node) {
!!isValid(cached, id) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactMount: Two valid but unequal nodes with the same `%s`: %s', ATTR_NAME, id) : invariant(false) : undefined;
nodeCache[id] = node;
}
} else {
nodeCache[id] = node;
}
}
return id;
}
function internalGetID(node) {
// If node is something like a window, document, or text node, none of
// which support attributes or a .getAttribute method, gracefully return
// the empty string, as if the attribute were missing.
return node && node.getAttribute && node.getAttribute(ATTR_NAME) || '';
}
/**
* Sets the React-specific ID of the given node.
*
* @param {DOMElement} node The DOM node whose ID will be set.
* @param {string} id The value of the ID attribute.
*/
function setID(node, id) {
var oldID = internalGetID(node);
if (oldID !== id) {
delete nodeCache[oldID];
}
node.setAttribute(ATTR_NAME, id);
nodeCache[id] = node;
}
/**
* Finds the node with the supplied React-generated DOM ID.
*
* @param {string} id A React-generated DOM ID.
* @return {DOMElement} DOM node with the suppled `id`.
* @internal
*/
function getNode(id) {
if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {
nodeCache[id] = ReactMount.findReactNodeByID(id);
}
return nodeCache[id];
}
/**
* Finds the node with the supplied public React instance.
*
* @param {*} instance A public React instance.
* @return {?DOMElement} DOM node with the suppled `id`.
* @internal
*/
function getNodeFromInstance(instance) {
var id = ReactInstanceMap.get(instance)._rootNodeID;
if (ReactEmptyComponentRegistry.isNullComponentID(id)) {
return null;
}
if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {
nodeCache[id] = ReactMount.findReactNodeByID(id);
}
return nodeCache[id];
}
/**
* A node is "valid" if it is contained by a currently mounted container.
*
* This means that the node does not have to be contained by a document in
* order to be considered valid.
*
* @param {?DOMElement} node The candidate DOM node.
* @param {string} id The expected ID of the node.
* @return {boolean} Whether the node is contained by a mounted container.
*/
function isValid(node, id) {
if (node) {
!(internalGetID(node) === id) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactMount: Unexpected modification of `%s`', ATTR_NAME) : invariant(false) : undefined;
var container = ReactMount.findReactContainerForID(id);
if (container && containsNode(container, node)) {
return true;
}
}
return false;
}
/**
* Causes the cache to forget about one React-specific ID.
*
* @param {string} id The ID to forget.
*/
function purgeID(id) {
delete nodeCache[id];
}
var deepestNodeSoFar = null;
function findDeepestCachedAncestorImpl(ancestorID) {
var ancestor = nodeCache[ancestorID];
if (ancestor && isValid(ancestor, ancestorID)) {
deepestNodeSoFar = ancestor;
} else {
// This node isn't populated in the cache, so presumably none of its
// descendants are. Break out of the loop.
return false;
}
}
/**
* Return the deepest cached node whose ID is a prefix of `targetID`.
*/
function findDeepestCachedAncestor(targetID) {
deepestNodeSoFar = null;
ReactInstanceHandles.traverseAncestors(targetID, findDeepestCachedAncestorImpl);
var foundNode = deepestNodeSoFar;
deepestNodeSoFar = null;
return foundNode;
}
/**
* Mounts this component and inserts it into the DOM.
*
* @param {ReactComponent} componentInstance The instance to mount.
* @param {string} rootID DOM ID of the root node.
* @param {DOMElement} container DOM element to mount into.
* @param {ReactReconcileTransaction} transaction
* @param {boolean} shouldReuseMarkup If true, do not insert markup
*/
function mountComponentIntoNode(componentInstance, rootID, container, transaction, shouldReuseMarkup, context) {
if (ReactDOMFeatureFlags.useCreateElement) {
context = assign({}, context);
if (container.nodeType === DOC_NODE_TYPE) {
context[ownerDocumentContextKey] = container;
} else {
context[ownerDocumentContextKey] = container.ownerDocument;
}
}
if (process.env.NODE_ENV !== 'production') {
if (context === emptyObject) {
context = {};
}
var tag = container.nodeName.toLowerCase();
context[validateDOMNesting.ancestorInfoContextKey] = validateDOMNesting.updatedAncestorInfo(null, tag, null);
}
var markup = ReactReconciler.mountComponent(componentInstance, rootID, transaction, context);
componentInstance._renderedComponent._topLevelWrapper = componentInstance;
ReactMount._mountImageIntoNode(markup, container, shouldReuseMarkup, transaction);
}
/**
* Batched mount.
*
* @param {ReactComponent} componentInstance The instance to mount.
* @param {string} rootID DOM ID of the root node.
* @param {DOMElement} container DOM element to mount into.
* @param {boolean} shouldReuseMarkup If true, do not insert markup
*/
function batchedMountComponentIntoNode(componentInstance, rootID, container, shouldReuseMarkup, context) {
var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(
/* forceHTML */shouldReuseMarkup);
transaction.perform(mountComponentIntoNode, null, componentInstance, rootID, container, transaction, shouldReuseMarkup, context);
ReactUpdates.ReactReconcileTransaction.release(transaction);
}
/**
* Unmounts a component and removes it from the DOM.
*
* @param {ReactComponent} instance React component instance.
* @param {DOMElement} container DOM element to unmount from.
* @final
* @internal
* @see {ReactMount.unmountComponentAtNode}
*/
function unmountComponentFromNode(instance, container) {
ReactReconciler.unmountComponent(instance);
if (container.nodeType === DOC_NODE_TYPE) {
container = container.documentElement;
}
// http://jsperf.com/emptying-a-node
while (container.lastChild) {
container.removeChild(container.lastChild);
}
}
/**
* True if the supplied DOM node has a direct React-rendered child that is
* not a React root element. Useful for warning in `render`,
* `unmountComponentAtNode`, etc.
*
* @param {?DOMElement} node The candidate DOM node.
* @return {boolean} True if the DOM element contains a direct child that was
* rendered by React but is not a root element.
* @internal
*/
function hasNonRootReactChild(node) {
var reactRootID = getReactRootID(node);
return reactRootID ? reactRootID !== ReactInstanceHandles.getReactRootIDFromNodeID(reactRootID) : false;
}
/**
* Returns the first (deepest) ancestor of a node which is rendered by this copy
* of React.
*/
function findFirstReactDOMImpl(node) {
// This node might be from another React instance, so we make sure not to
// examine the node cache here
for (; node && node.parentNode !== node; node = node.parentNode) {
if (node.nodeType !== 1) {
// Not a DOMElement, therefore not a React component
continue;
}
var nodeID = internalGetID(node);
if (!nodeID) {
continue;
}
var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(nodeID);
// If containersByReactRootID contains the container we find by crawling up
// the tree, we know that this instance of React rendered the node.
// nb. isValid's strategy (with containsNode) does not work because render
// trees may be nested and we don't want a false positive in that case.
var current = node;
var lastID;
do {
lastID = internalGetID(current);
current = current.parentNode;
if (current == null) {
// The passed-in node has been detached from the container it was
// originally rendered into.
return null;
}
} while (lastID !== reactRootID);
if (current === containersByReactRootID[reactRootID]) {
return node;
}
}
return null;
}
/**
* Temporary (?) hack so that we can store all top-level pending updates on
* composites instead of having to worry about different types of components
* here.
*/
var TopLevelWrapper = function () {};
TopLevelWrapper.prototype.isReactComponent = {};
if (process.env.NODE_ENV !== 'production') {
TopLevelWrapper.displayName = 'TopLevelWrapper';
}
TopLevelWrapper.prototype.render = function () {
// this.props is actually a ReactElement
return this.props;
};
/**
* Mounting is the process of initializing a React component by creating its
* representative DOM elements and inserting them into a supplied `container`.
* Any prior content inside `container` is destroyed in the process.
*
* ReactMount.render(
* component,
* document.getElementById('container')
* );
*
* <div id="container"> <-- Supplied `container`.
* <div data-reactid=".3"> <-- Rendered reactRoot of React
* // ... component.
* </div>
* </div>
*
* Inside of `container`, the first element rendered is the "reactRoot".
*/
var ReactMount = {
TopLevelWrapper: TopLevelWrapper,
/** Exposed for debugging purposes **/
_instancesByReactRootID: instancesByReactRootID,
/**
* This is a hook provided to support rendering React components while
* ensuring that the apparent scroll position of its `container` does not
* change.
*
* @param {DOMElement} container The `container` being rendered into.
* @param {function} renderCallback This must be called once to do the render.
*/
scrollMonitor: function (container, renderCallback) {
renderCallback();
},
/**
* Take a component that's already mounted into the DOM and replace its props
* @param {ReactComponent} prevComponent component instance already in the DOM
* @param {ReactElement} nextElement component instance to render
* @param {DOMElement} container container to render into
* @param {?function} callback function triggered on completion
*/
_updateRootComponent: function (prevComponent, nextElement, container, callback) {
ReactMount.scrollMonitor(container, function () {
ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement);
if (callback) {
ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback);
}
});
if (process.env.NODE_ENV !== 'production') {
// Record the root element in case it later gets transplanted.
rootElementsByReactRootID[getReactRootID(container)] = getReactRootElementInContainer(container);
}
return prevComponent;
},
/**
* Register a component into the instance map and starts scroll value
* monitoring
* @param {ReactComponent} nextComponent component instance to render
* @param {DOMElement} container container to render into
* @return {string} reactRoot ID prefix
*/
_registerComponent: function (nextComponent, container) {
!(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '_registerComponent(...): Target container is not a DOM element.') : invariant(false) : undefined;
ReactBrowserEventEmitter.ensureScrollValueMonitoring();
var reactRootID = ReactMount.registerContainer(container);
instancesByReactRootID[reactRootID] = nextComponent;
return reactRootID;
},
/**
* Render a new component into the DOM.
* @param {ReactElement} nextElement element to render
* @param {DOMElement} container container to render into
* @param {boolean} shouldReuseMarkup if we should skip the markup insertion
* @return {ReactComponent} nextComponent
*/
_renderNewRootComponent: function (nextElement, container, shouldReuseMarkup, context) {
// Various parts of our code (such as ReactCompositeComponent's
// _renderValidatedComponent) assume that calls to render aren't nested;
// verify that that's the case.
process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, '_renderNewRootComponent(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from ' + 'render is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : undefined;
var componentInstance = instantiateReactComponent(nextElement, null);
var reactRootID = ReactMount._registerComponent(componentInstance, container);
// The initial render is synchronous but any updates that happen during
// rendering, in componentWillMount or componentDidMount, will be batched
// according to the current batching strategy.
ReactUpdates.batchedUpdates(batchedMountComponentIntoNode, componentInstance, reactRootID, container, shouldReuseMarkup, context);
if (process.env.NODE_ENV !== 'production') {
// Record the root element in case it later gets transplanted.
rootElementsByReactRootID[reactRootID] = getReactRootElementInContainer(container);
}
return componentInstance;
},
/**
* Renders a React component into the DOM in the supplied `container`.
*
* If the React component was previously rendered into `container`, this will
* perform an update on it and only mutate the DOM as necessary to reflect the
* latest React component.
*
* @param {ReactComponent} parentComponent The conceptual parent of this render tree.
* @param {ReactElement} nextElement Component element to render.
* @param {DOMElement} container DOM element to render into.
* @param {?function} callback function triggered on completion
* @return {ReactComponent} Component instance rendered in `container`.
*/
renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
!(parentComponent != null && parentComponent._reactInternalInstance != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'parentComponent must be a valid React Component') : invariant(false) : undefined;
return ReactMount._renderSubtreeIntoContainer(parentComponent, nextElement, container, callback);
},
_renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
!ReactElement.isValidElement(nextElement) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOM.render(): Invalid component element.%s', typeof nextElement === 'string' ? ' Instead of passing an element string, make sure to instantiate ' + 'it by passing it to React.createElement.' : typeof nextElement === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' :
// Check if it quacks like an element
nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : invariant(false) : undefined;
process.env.NODE_ENV !== 'production' ? warning(!container || !container.tagName || container.tagName.toUpperCase() !== 'BODY', 'render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.') : undefined;
var nextWrappedElement = new ReactElement(TopLevelWrapper, null, null, null, null, null, nextElement);
var prevComponent = instancesByReactRootID[getReactRootID(container)];
if (prevComponent) {
var prevWrappedElement = prevComponent._currentElement;
var prevElement = prevWrappedElement.props;
if (shouldUpdateReactComponent(prevElement, nextElement)) {
var publicInst = prevComponent._renderedComponent.getPublicInstance();
var updatedCallback = callback && function () {
callback.call(publicInst);
};
ReactMount._updateRootComponent(prevComponent, nextWrappedElement, container, updatedCallback);
return publicInst;
} else {
ReactMount.unmountComponentAtNode(container);
}
}
var reactRootElement = getReactRootElementInContainer(container);
var containerHasReactMarkup = reactRootElement && !!internalGetID(reactRootElement);
var containerHasNonRootReactChild = hasNonRootReactChild(container);
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(!containerHasNonRootReactChild, 'render(...): Replacing React-rendered children with a new root ' + 'component. If you intended to update the children of this node, ' + 'you should instead have the existing children update their state ' + 'and render the new components instead of calling ReactDOM.render.') : undefined;
if (!containerHasReactMarkup || reactRootElement.nextSibling) {
var rootElementSibling = reactRootElement;
while (rootElementSibling) {
if (internalGetID(rootElementSibling)) {
process.env.NODE_ENV !== 'production' ? warning(false, 'render(): Target node has markup rendered by React, but there ' + 'are unrelated nodes as well. This is most commonly caused by ' + 'white-space inserted around server-rendered markup.') : undefined;
break;
}
rootElementSibling = rootElementSibling.nextSibling;
}
}
}
var shouldReuseMarkup = containerHasReactMarkup && !prevComponent && !containerHasNonRootReactChild;
var component = ReactMount._renderNewRootComponent(nextWrappedElement, container, shouldReuseMarkup, parentComponent != null ? parentComponent._reactInternalInstance._processChildContext(parentComponent._reactInternalInstance._context) : emptyObject)._renderedComponent.getPublicInstance();
if (callback) {
callback.call(component);
}
return component;
},
/**
* Renders a React component into the DOM in the supplied `container`.
*
* If the React component was previously rendered into `container`, this will
* perform an update on it and only mutate the DOM as necessary to reflect the
* latest React component.
*
* @param {ReactElement} nextElement Component element to render.
* @param {DOMElement} container DOM element to render into.
* @param {?function} callback function triggered on completion
* @return {ReactComponent} Component instance rendered in `container`.
*/
render: function (nextElement, container, callback) {
return ReactMount._renderSubtreeIntoContainer(null, nextElement, container, callback);
},
/**
* Registers a container node into which React components will be rendered.
* This also creates the "reactRoot" ID that will be assigned to the element
* rendered within.
*
* @param {DOMElement} container DOM element to register as a container.
* @return {string} The "reactRoot" ID of elements rendered within.
*/
registerContainer: function (container) {
var reactRootID = getReactRootID(container);
if (reactRootID) {
// If one exists, make sure it is a valid "reactRoot" ID.
reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(reactRootID);
}
if (!reactRootID) {
// No valid "reactRoot" ID found, create one.
reactRootID = ReactInstanceHandles.createReactRootID();
}
containersByReactRootID[reactRootID] = container;
return reactRootID;
},
/**
* Unmounts and destroys the React component rendered in the `container`.
*
* @param {DOMElement} container DOM element containing a React component.
* @return {boolean} True if a component was found in and unmounted from
* `container`
*/
unmountComponentAtNode: function (container) {
// Various parts of our code (such as ReactCompositeComponent's
// _renderValidatedComponent) assume that calls to render aren't nested;
// verify that that's the case. (Strictly speaking, unmounting won't cause a
// render but we still don't expect to be in a render call here.)
process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, 'unmountComponentAtNode(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from render ' + 'is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : undefined;
!(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : invariant(false) : undefined;
var reactRootID = getReactRootID(container);
var component = instancesByReactRootID[reactRootID];
if (!component) {
// Check if the node being unmounted was rendered by React, but isn't a
// root node.
var containerHasNonRootReactChild = hasNonRootReactChild(container);
// Check if the container itself is a React root node.
var containerID = internalGetID(container);
var isContainerReactRoot = containerID && containerID === ReactInstanceHandles.getReactRootIDFromNodeID(containerID);
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(!containerHasNonRootReactChild, 'unmountComponentAtNode(): The node you\'re attempting to unmount ' + 'was rendered by React and is not a top-level container. %s', isContainerReactRoot ? 'You may have accidentally passed in a React root node instead ' + 'of its container.' : 'Instead, have the parent component update its state and ' + 'rerender in order to remove this component.') : undefined;
}
return false;
}
ReactUpdates.batchedUpdates(unmountComponentFromNode, component, container);
delete instancesByReactRootID[reactRootID];
delete containersByReactRootID[reactRootID];
if (process.env.NODE_ENV !== 'production') {
delete rootElementsByReactRootID[reactRootID];
}
return true;
},
/**
* Finds the container DOM element that contains React component to which the
* supplied DOM `id` belongs.
*
* @param {string} id The ID of an element rendered by a React component.
* @return {?DOMElement} DOM element that contains the `id`.
*/
findReactContainerForID: function (id) {
var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(id);
var container = containersByReactRootID[reactRootID];
if (process.env.NODE_ENV !== 'production') {
var rootElement = rootElementsByReactRootID[reactRootID];
if (rootElement && rootElement.parentNode !== container) {
process.env.NODE_ENV !== 'production' ? warning(
// Call internalGetID here because getID calls isValid which calls
// findReactContainerForID (this function).
internalGetID(rootElement) === reactRootID, 'ReactMount: Root element ID differed from reactRootID.') : undefined;
var containerChild = container.firstChild;
if (containerChild && reactRootID === internalGetID(containerChild)) {
// If the container has a new child with the same ID as the old
// root element, then rootElementsByReactRootID[reactRootID] is
// just stale and needs to be updated. The case that deserves a
// warning is when the container is empty.
rootElementsByReactRootID[reactRootID] = containerChild;
} else {
process.env.NODE_ENV !== 'production' ? warning(false, 'ReactMount: Root element has been removed from its original ' + 'container. New container: %s', rootElement.parentNode) : undefined;
}
}
}
return container;
},
/**
* Finds an element rendered by React with the supplied ID.
*
* @param {string} id ID of a DOM node in the React component.
* @return {DOMElement} Root DOM node of the React component.
*/
findReactNodeByID: function (id) {
var reactRoot = ReactMount.findReactContainerForID(id);
return ReactMount.findComponentRoot(reactRoot, id);
},
/**
* Traverses up the ancestors of the supplied node to find a node that is a
* DOM representation of a React component rendered by this copy of React.
*
* @param {*} node
* @return {?DOMEventTarget}
* @internal
*/
getFirstReactDOM: function (node) {
return findFirstReactDOMImpl(node);
},
/**
* Finds a node with the supplied `targetID` inside of the supplied
* `ancestorNode`. Exploits the ID naming scheme to perform the search
* quickly.
*
* @param {DOMEventTarget} ancestorNode Search from this root.
* @pararm {string} targetID ID of the DOM representation of the component.
* @return {DOMEventTarget} DOM node with the supplied `targetID`.
* @internal
*/
findComponentRoot: function (ancestorNode, targetID) {
var firstChildren = findComponentRootReusableArray;
var childIndex = 0;
var deepestAncestor = findDeepestCachedAncestor(targetID) || ancestorNode;
if (process.env.NODE_ENV !== 'production') {
// This will throw on the next line; give an early warning
process.env.NODE_ENV !== 'production' ? warning(deepestAncestor != null, 'React can\'t find the root component node for data-reactid value ' + '`%s`. If you\'re seeing this message, it probably means that ' + 'you\'ve loaded two copies of React on the page. At this time, only ' + 'a single copy of React can be loaded at a time.', targetID) : undefined;
}
firstChildren[0] = deepestAncestor.firstChild;
firstChildren.length = 1;
while (childIndex < firstChildren.length) {
var child = firstChildren[childIndex++];
var targetChild;
while (child) {
var childID = ReactMount.getID(child);
if (childID) {
// Even if we find the node we're looking for, we finish looping
// through its siblings to ensure they're cached so that we don't have
// to revisit this node again. Otherwise, we make n^2 calls to getID
// when visiting the many children of a single node in order.
if (targetID === childID) {
targetChild = child;
} else if (ReactInstanceHandles.isAncestorIDOf(childID, targetID)) {
// If we find a child whose ID is an ancestor of the given ID,
// then we can be sure that we only want to search the subtree
// rooted at this child, so we can throw out the rest of the
// search state.
firstChildren.length = childIndex = 0;
firstChildren.push(child.firstChild);
}
} else {
// If this child had no ID, then there's a chance that it was
// injected automatically by the browser, as when a `<table>`
// element sprouts an extra `<tbody>` child as a side effect of
// `.innerHTML` parsing. Optimistically continue down this
// branch, but not before examining the other siblings.
firstChildren.push(child.firstChild);
}
child = child.nextSibling;
}
if (targetChild) {
// Emptying firstChildren/findComponentRootReusableArray is
// not necessary for correctness, but it helps the GC reclaim
// any nodes that were left at the end of the search.
firstChildren.length = 0;
return targetChild;
}
}
firstChildren.length = 0;
!false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findComponentRoot(..., %s): Unable to find element. This probably ' + 'means the DOM was unexpectedly mutated (e.g., by the browser), ' + 'usually due to forgetting a <tbody> when using tables, nesting tags ' + 'like <form>, <p>, or <a>, or using non-SVG elements in an <svg> ' + 'parent. ' + 'Try inspecting the child nodes of the element with React ID `%s`.', targetID, ReactMount.getID(ancestorNode)) : invariant(false) : undefined;
},
_mountImageIntoNode: function (markup, container, shouldReuseMarkup, transaction) {
!(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mountComponentIntoNode(...): Target container is not valid.') : invariant(false) : undefined;
if (shouldReuseMarkup) {
var rootElement = getReactRootElementInContainer(container);
if (ReactMarkupChecksum.canReuseMarkup(markup, rootElement)) {
return;
} else {
var checksum = rootElement.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
rootElement.removeAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
var rootMarkup = rootElement.outerHTML;
rootElement.setAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME, checksum);
var normalizedMarkup = markup;
if (process.env.NODE_ENV !== 'production') {
// because rootMarkup is retrieved from the DOM, various normalizations
// will have occurred which will not be present in `markup`. Here,
// insert markup into a <div> or <iframe> depending on the container
// type to perform the same normalizations before comparing.
var normalizer;
if (container.nodeType === ELEMENT_NODE_TYPE) {
normalizer = document.createElement('div');
normalizer.innerHTML = markup;
normalizedMarkup = normalizer.innerHTML;
} else {
normalizer = document.createElement('iframe');
document.body.appendChild(normalizer);
normalizer.contentDocument.write(markup);
normalizedMarkup = normalizer.contentDocument.documentElement.outerHTML;
document.body.removeChild(normalizer);
}
}
var diffIndex = firstDifferenceIndex(normalizedMarkup, rootMarkup);
var difference = ' (client) ' + normalizedMarkup.substring(diffIndex - 20, diffIndex + 20) + '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20);
!(container.nodeType !== DOC_NODE_TYPE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'You\'re trying to render a component to the document using ' + 'server rendering but the checksum was invalid. This usually ' + 'means you rendered a different component type or props on ' + 'the client from the one on the server, or your render() ' + 'methods are impure. React cannot handle this case due to ' + 'cross-browser quirks by rendering at the document root. You ' + 'should look for environment dependent code in your components ' + 'and ensure the props are the same client and server side:\n%s', difference) : invariant(false) : undefined;
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(false, 'React attempted to reuse markup in a container but the ' + 'checksum was invalid. This generally means that you are ' + 'using server rendering and the markup generated on the ' + 'server was not what the client was expecting. React injected ' + 'new markup to compensate which works but you have lost many ' + 'of the benefits of server rendering. Instead, figure out ' + 'why the markup being generated is different on the client ' + 'or server:\n%s', difference) : undefined;
}
}
}
!(container.nodeType !== DOC_NODE_TYPE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'You\'re trying to render a component to the document but ' + 'you didn\'t use server rendering. We can\'t do this ' + 'without using server rendering due to cross-browser quirks. ' + 'See ReactDOMServer.renderToString() for server rendering.') : invariant(false) : undefined;
if (transaction.useCreateElement) {
while (container.lastChild) {
container.removeChild(container.lastChild);
}
container.appendChild(markup);
} else {
setInnerHTML(container, markup);
}
},
ownerDocumentContextKey: ownerDocumentContextKey,
/**
* React ID utilities.
*/
getReactRootID: getReactRootID,
getID: getID,
setID: setID,
getNode: getNode,
getNodeFromInstance: getNodeFromInstance,
isValid: isValid,
purgeID: purgeID
};
ReactPerf.measureMethods(ReactMount, 'ReactMount', {
_renderNewRootComponent: '_renderNewRootComponent',
_mountImageIntoNode: '_mountImageIntoNode'
});
module.exports = ReactMount;
}).call(this,require('_process'))
},{"./DOMProperty":16,"./Object.assign":29,"./ReactBrowserEventEmitter":33,"./ReactCurrentOwner":41,"./ReactDOMFeatureFlags":46,"./ReactElement":59,"./ReactEmptyComponentRegistry":62,"./ReactInstanceHandles":68,"./ReactInstanceMap":69,"./ReactMarkupChecksum":71,"./ReactPerf":78,"./ReactReconciler":83,"./ReactUpdateQueue":89,"./ReactUpdates":90,"./instantiateReactComponent":125,"./setInnerHTML":131,"./shouldUpdateReactComponent":133,"./validateDOMNesting":135,"_process":164,"fbjs/lib/containsNode":140,"fbjs/lib/emptyObject":144,"fbjs/lib/invariant":151,"fbjs/lib/warning":162}],73:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactMultiChild
* @typechecks static-only
*/
'use strict';
var ReactComponentEnvironment = require('./ReactComponentEnvironment');
var ReactMultiChildUpdateTypes = require('./ReactMultiChildUpdateTypes');
var ReactCurrentOwner = require('./ReactCurrentOwner');
var ReactReconciler = require('./ReactReconciler');
var ReactChildReconciler = require('./ReactChildReconciler');
var flattenChildren = require('./flattenChildren');
/**
* Updating children of a component may trigger recursive updates. The depth is
* used to batch recursive updates to render markup more efficiently.
*
* @type {number}
* @private
*/
var updateDepth = 0;
/**
* Queue of update configuration objects.
*
* Each object has a `type` property that is in `ReactMultiChildUpdateTypes`.
*
* @type {array<object>}
* @private
*/
var updateQueue = [];
/**
* Queue of markup to be rendered.
*
* @type {array<string>}
* @private
*/
var markupQueue = [];
/**
* Enqueues markup to be rendered and inserted at a supplied index.
*
* @param {string} parentID ID of the parent component.
* @param {string} markup Markup that renders into an element.
* @param {number} toIndex Destination index.
* @private
*/
function enqueueInsertMarkup(parentID, markup, toIndex) {
// NOTE: Null values reduce hidden classes.
updateQueue.push({
parentID: parentID,
parentNode: null,
type: ReactMultiChildUpdateTypes.INSERT_MARKUP,
markupIndex: markupQueue.push(markup) - 1,
content: null,
fromIndex: null,
toIndex: toIndex
});
}
/**
* Enqueues moving an existing element to another index.
*
* @param {string} parentID ID of the parent component.
* @param {number} fromIndex Source index of the existing element.
* @param {number} toIndex Destination index of the element.
* @private
*/
function enqueueMove(parentID, fromIndex, toIndex) {
// NOTE: Null values reduce hidden classes.
updateQueue.push({
parentID: parentID,
parentNode: null,
type: ReactMultiChildUpdateTypes.MOVE_EXISTING,
markupIndex: null,
content: null,
fromIndex: fromIndex,
toIndex: toIndex
});
}
/**
* Enqueues removing an element at an index.
*
* @param {string} parentID ID of the parent component.
* @param {number} fromIndex Index of the element to remove.
* @private
*/
function enqueueRemove(parentID, fromIndex) {
// NOTE: Null values reduce hidden classes.
updateQueue.push({
parentID: parentID,
parentNode: null,
type: ReactMultiChildUpdateTypes.REMOVE_NODE,
markupIndex: null,
content: null,
fromIndex: fromIndex,
toIndex: null
});
}
/**
* Enqueues setting the markup of a node.
*
* @param {string} parentID ID of the parent component.
* @param {string} markup Markup that renders into an element.
* @private
*/
function enqueueSetMarkup(parentID, markup) {
// NOTE: Null values reduce hidden classes.
updateQueue.push({
parentID: parentID,
parentNode: null,
type: ReactMultiChildUpdateTypes.SET_MARKUP,
markupIndex: null,
content: markup,
fromIndex: null,
toIndex: null
});
}
/**
* Enqueues setting the text content.
*
* @param {string} parentID ID of the parent component.
* @param {string} textContent Text content to set.
* @private
*/
function enqueueTextContent(parentID, textContent) {
// NOTE: Null values reduce hidden classes.
updateQueue.push({
parentID: parentID,
parentNode: null,
type: ReactMultiChildUpdateTypes.TEXT_CONTENT,
markupIndex: null,
content: textContent,
fromIndex: null,
toIndex: null
});
}
/**
* Processes any enqueued updates.
*
* @private
*/
function processQueue() {
if (updateQueue.length) {
ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);
clearQueue();
}
}
/**
* Clears any enqueued updates.
*
* @private
*/
function clearQueue() {
updateQueue.length = 0;
markupQueue.length = 0;
}
/**
* ReactMultiChild are capable of reconciling multiple children.
*
* @class ReactMultiChild
* @internal
*/
var ReactMultiChild = {
/**
* Provides common functionality for components that must reconcile multiple
* children. This is used by `ReactDOMComponent` to mount, update, and
* unmount child components.
*
* @lends {ReactMultiChild.prototype}
*/
Mixin: {
_reconcilerInstantiateChildren: function (nestedChildren, transaction, context) {
if (process.env.NODE_ENV !== 'production') {
if (this._currentElement) {
try {
ReactCurrentOwner.current = this._currentElement._owner;
return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
} finally {
ReactCurrentOwner.current = null;
}
}
}
return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
},
_reconcilerUpdateChildren: function (prevChildren, nextNestedChildrenElements, transaction, context) {
var nextChildren;
if (process.env.NODE_ENV !== 'production') {
if (this._currentElement) {
try {
ReactCurrentOwner.current = this._currentElement._owner;
nextChildren = flattenChildren(nextNestedChildrenElements);
} finally {
ReactCurrentOwner.current = null;
}
return ReactChildReconciler.updateChildren(prevChildren, nextChildren, transaction, context);
}
}
nextChildren = flattenChildren(nextNestedChildrenElements);
return ReactChildReconciler.updateChildren(prevChildren, nextChildren, transaction, context);
},
/**
* Generates a "mount image" for each of the supplied children. In the case
* of `ReactDOMComponent`, a mount image is a string of markup.
*
* @param {?object} nestedChildren Nested child maps.
* @return {array} An array of mounted representations.
* @internal
*/
mountChildren: function (nestedChildren, transaction, context) {
var children = this._reconcilerInstantiateChildren(nestedChildren, transaction, context);
this._renderedChildren = children;
var mountImages = [];
var index = 0;
for (var name in children) {
if (children.hasOwnProperty(name)) {
var child = children[name];
// Inlined for performance, see `ReactInstanceHandles.createReactID`.
var rootID = this._rootNodeID + name;
var mountImage = ReactReconciler.mountComponent(child, rootID, transaction, context);
child._mountIndex = index++;
mountImages.push(mountImage);
}
}
return mountImages;
},
/**
* Replaces any rendered children with a text content string.
*
* @param {string} nextContent String of content.
* @internal
*/
updateTextContent: function (nextContent) {
updateDepth++;
var errorThrown = true;
try {
var prevChildren = this._renderedChildren;
// Remove any rendered children.
ReactChildReconciler.unmountChildren(prevChildren);
// TODO: The setTextContent operation should be enough
for (var name in prevChildren) {
if (prevChildren.hasOwnProperty(name)) {
this._unmountChild(prevChildren[name]);
}
}
// Set new text content.
this.setTextContent(nextContent);
errorThrown = false;
} finally {
updateDepth--;
if (!updateDepth) {
if (errorThrown) {
clearQueue();
} else {
processQueue();
}
}
}
},
/**
* Replaces any rendered children with a markup string.
*
* @param {string} nextMarkup String of markup.
* @internal
*/
updateMarkup: function (nextMarkup) {
updateDepth++;
var errorThrown = true;
try {
var prevChildren = this._renderedChildren;
// Remove any rendered children.
ReactChildReconciler.unmountChildren(prevChildren);
for (var name in prevChildren) {
if (prevChildren.hasOwnProperty(name)) {
this._unmountChildByName(prevChildren[name], name);
}
}
this.setMarkup(nextMarkup);
errorThrown = false;
} finally {
updateDepth--;
if (!updateDepth) {
if (errorThrown) {
clearQueue();
} else {
processQueue();
}
}
}
},
/**
* Updates the rendered children with new children.
*
* @param {?object} nextNestedChildrenElements Nested child element maps.
* @param {ReactReconcileTransaction} transaction
* @internal
*/
updateChildren: function (nextNestedChildrenElements, transaction, context) {
updateDepth++;
var errorThrown = true;
try {
this._updateChildren(nextNestedChildrenElements, transaction, context);
errorThrown = false;
} finally {
updateDepth--;
if (!updateDepth) {
if (errorThrown) {
clearQueue();
} else {
processQueue();
}
}
}
},
/**
* Improve performance by isolating this hot code path from the try/catch
* block in `updateChildren`.
*
* @param {?object} nextNestedChildrenElements Nested child element maps.
* @param {ReactReconcileTransaction} transaction
* @final
* @protected
*/
_updateChildren: function (nextNestedChildrenElements, transaction, context) {
var prevChildren = this._renderedChildren;
var nextChildren = this._reconcilerUpdateChildren(prevChildren, nextNestedChildrenElements, transaction, context);
this._renderedChildren = nextChildren;
if (!nextChildren && !prevChildren) {
return;
}
var name;
// `nextIndex` will increment for each child in `nextChildren`, but
// `lastIndex` will be the last index visited in `prevChildren`.
var lastIndex = 0;
var nextIndex = 0;
for (name in nextChildren) {
if (!nextChildren.hasOwnProperty(name)) {
continue;
}
var prevChild = prevChildren && prevChildren[name];
var nextChild = nextChildren[name];
if (prevChild === nextChild) {
this.moveChild(prevChild, nextIndex, lastIndex);
lastIndex = Math.max(prevChild._mountIndex, lastIndex);
prevChild._mountIndex = nextIndex;
} else {
if (prevChild) {
// Update `lastIndex` before `_mountIndex` gets unset by unmounting.
lastIndex = Math.max(prevChild._mountIndex, lastIndex);
this._unmountChild(prevChild);
}
// The child must be instantiated before it's mounted.
this._mountChildByNameAtIndex(nextChild, name, nextIndex, transaction, context);
}
nextIndex++;
}
// Remove children that are no longer present.
for (name in prevChildren) {
if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) {
this._unmountChild(prevChildren[name]);
}
}
},
/**
* Unmounts all rendered children. This should be used to clean up children
* when this component is unmounted.
*
* @internal
*/
unmountChildren: function () {
var renderedChildren = this._renderedChildren;
ReactChildReconciler.unmountChildren(renderedChildren);
this._renderedChildren = null;
},
/**
* Moves a child component to the supplied index.
*
* @param {ReactComponent} child Component to move.
* @param {number} toIndex Destination index of the element.
* @param {number} lastIndex Last index visited of the siblings of `child`.
* @protected
*/
moveChild: function (child, toIndex, lastIndex) {
// If the index of `child` is less than `lastIndex`, then it needs to
// be moved. Otherwise, we do not need to move it because a child will be
// inserted or moved before `child`.
if (child._mountIndex < lastIndex) {
enqueueMove(this._rootNodeID, child._mountIndex, toIndex);
}
},
/**
* Creates a child component.
*
* @param {ReactComponent} child Component to create.
* @param {string} mountImage Markup to insert.
* @protected
*/
createChild: function (child, mountImage) {
enqueueInsertMarkup(this._rootNodeID, mountImage, child._mountIndex);
},
/**
* Removes a child component.
*
* @param {ReactComponent} child Child to remove.
* @protected
*/
removeChild: function (child) {
enqueueRemove(this._rootNodeID, child._mountIndex);
},
/**
* Sets this text content string.
*
* @param {string} textContent Text content to set.
* @protected
*/
setTextContent: function (textContent) {
enqueueTextContent(this._rootNodeID, textContent);
},
/**
* Sets this markup string.
*
* @param {string} markup Markup to set.
* @protected
*/
setMarkup: function (markup) {
enqueueSetMarkup(this._rootNodeID, markup);
},
/**
* Mounts a child with the supplied name.
*
* NOTE: This is part of `updateChildren` and is here for readability.
*
* @param {ReactComponent} child Component to mount.
* @param {string} name Name of the child.
* @param {number} index Index at which to insert the child.
* @param {ReactReconcileTransaction} transaction
* @private
*/
_mountChildByNameAtIndex: function (child, name, index, transaction, context) {
// Inlined for performance, see `ReactInstanceHandles.createReactID`.
var rootID = this._rootNodeID + name;
var mountImage = ReactReconciler.mountComponent(child, rootID, transaction, context);
child._mountIndex = index;
this.createChild(child, mountImage);
},
/**
* Unmounts a rendered child.
*
* NOTE: This is part of `updateChildren` and is here for readability.
*
* @param {ReactComponent} child Component to unmount.
* @private
*/
_unmountChild: function (child) {
this.removeChild(child);
child._mountIndex = null;
}
}
};
module.exports = ReactMultiChild;
}).call(this,require('_process'))
},{"./ReactChildReconciler":34,"./ReactComponentEnvironment":39,"./ReactCurrentOwner":41,"./ReactMultiChildUpdateTypes":74,"./ReactReconciler":83,"./flattenChildren":116,"_process":164}],74:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactMultiChildUpdateTypes
*/
'use strict';
var keyMirror = require('fbjs/lib/keyMirror');
/**
* When a component's children are updated, a series of update configuration
* objects are created in order to batch and serialize the required changes.
*
* Enumerates all the possible types of update configurations.
*
* @internal
*/
var ReactMultiChildUpdateTypes = keyMirror({
INSERT_MARKUP: null,
MOVE_EXISTING: null,
REMOVE_NODE: null,
SET_MARKUP: null,
TEXT_CONTENT: null
});
module.exports = ReactMultiChildUpdateTypes;
},{"fbjs/lib/keyMirror":154}],75:[function(require,module,exports){
(function (process){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactNativeComponent
*/
'use strict';
var assign = require('./Object.assign');
var invariant = require('fbjs/lib/invariant');
var autoGenerateWrapperClass = null;
var genericComponentClass = null;
// This registry keeps track of wrapper classes around native tags.
var tagToComponentClass = {};
var textComponentClass = null;
var ReactNativeComponentInjection = {
// This accepts a class that receives the tag string. This is a catch all
// that can render any kind of tag.
injectGenericComponentClass: function (componentClass) {
genericComponentClass = componentClass;
},
// This accepts a text component class that takes the text string to be
// rendered as props.
injectTextComponentClass: function (componentClass) {
textComponentClass = componentClass;
},
// This accepts a keyed object with classes as values. Each key represents a
// tag. That particular tag will use this class instead of the generic one.
injectComponentClasses: function (componentClasses) {
assign(tagToComponentClass, componentClasses);
}
};
/**
* Get a composite component wrapper class for a specific tag.
*
* @param {ReactElement} element The tag for which to get the class.
* @return {function} The React class constructor function.
*/
function getComponentClassForElement(element) {
if (typeof element.type === 'function') {
return element.type;
}
var tag = element.type;
var componentClass = tagToComponentClass[tag];
if (componentClass == null) {
tagToComponentClass[tag] = componentClass = autoGenerateWrapperClass(tag);
}
return componentClass;
}
/**
* Get a native internal component class for a specific tag.
*
* @param {ReactElement} element The element to create.
* @return {function} The internal class constructor function.
*/
function createInternalComponent(element) {
!genericComponentClass ? process.env.NODE_ENV !== 'production' ? invariant(false, 'There is no registered component for the tag %s', element.type) : invariant(false) : undefined;
return new genericComponentClass(element.type, element.props);
}
/**
* @param {ReactText} text
* @return {ReactComponent}
*/
function createInstanceForText(text) {
return new textComponentClass(text);
}
/**
* @param {ReactComponent} component
* @return {boolean}
*/
function isTextComponent(component) {
return component instanceof textComponentClass;
}
var ReactNativeComponent = {
getComponentClassForElement: getComponentClassForElement,
createInternalComponent: createInternalComponent,
createInstanceForText: createInstanceForText,
isTextComponent: isTextComponent,
injection: ReactNativeComponentInjection
};
module.exports = ReactNativeComponent;
}).call(this,require('_process'))
},{"./Object.assign":29,"_process":164,"fbjs/lib/invariant":151}],76:[function(require,module,exports){
(function (process){
/**
* Copyright 2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactNoopUpdateQueue
*/
'use strict';
var warning = require('fbjs/lib/warning');
function warnTDZ(publicInstance, callerName) {
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, publicInstance.constructor && publicInstance.constructor.displayName || '') : undefined;
}
}
/**
* This is the abstract API for an update queue.
*/
var ReactNoopUpdateQueue = {
/**
* Checks whether or not this composite component is mounted.
* @param {ReactClass} publicInstance The instance we want to test.
* @return {boolean} True if mounted, false otherwise.
* @protected
* @final
*/
isMounted: function (publicInstance) {
return false;
},
/**
* Enqueue a callback that will be executed after all the pending updates
* have processed.
*
* @param {ReactClass} publicInstance The instance to use as `this` context.
* @param {?function} callback Called after state is updated.
* @internal
*/
enqueueCallback: function (publicInstance, callback) {},
/**
* Forces an update. This should only be invoked when it is known with
* certainty that we are **not** in a DOM transaction.
*
* You may want to call this when you know that some deeper aspect of the
* component's state has changed but `setState` was not called.
*
* This will not invoke `shouldComponentUpdate`, but it will invoke
* `componentWillUpdate` and `componentDidUpdate`.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @internal
*/
enqueueForceUpdate: function (publicInstance) {
warnTDZ(publicInstance, 'forceUpdate');
},
/**
* Replaces all of the state. Always use this or `setState` to mutate state.
* You should treat `this.state` as immutable.
*
* There is no guarantee that `this.state` will be immediately updated, so
* accessing `this.state` after calling this method may return the old value.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @param {object} completeState Next state.
* @internal
*/
enqueueReplaceState: function (publicInstance, completeState) {
warnTDZ(publicInstance, 'replaceState');
},
/**
* Sets a subset of the state. This only exists because _pendingState is
* internal. This provides a merging strategy that is not available to deep
* properties which is confusing. TODO: Expose pendingState or don't use it
* during the merge.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @param {object} partialState Next partial state to be merged with state.
* @internal
*/
enqueueSetState: function (publicInstance, partialState) {
warnTDZ(publicInstance, 'setState');
},
/**
* Sets a subset of the props.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @param {object} partialProps Subset of the next props.
* @internal
*/
enqueueSetProps: function (publicInstance, partialProps) {
warnTDZ(publicInstance, 'setProps');
},
/**
* Replaces all of the props.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @param {object} props New props.
* @internal
*/
enqueueReplaceProps: function (publicInstance, props) {
warnTDZ(publicInstance, 'replaceProps');
}
};
module.exports = ReactNoopUpdateQueue;
}).call(this,require('_process'))
},{"_process":164,"fbjs/lib/warning":162}],77:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactOwner
*/
'use strict';
var invariant = require('fbjs/lib/invariant');
/**
* ReactOwners are capable of storing references to owned components.
*
* All components are capable of //being// referenced by owner components, but
* only ReactOwner components are capable of //referencing// owned components.
* The named reference is known as a "ref".
*
* Refs are available when mounted and updated during reconciliation.
*
* var MyComponent = React.createClass({
* render: function() {
* return (
* <div onClick={this.handleClick}>
* <CustomComponent ref="custom" />
* </div>
* );
* },
* handleClick: function() {
* this.refs.custom.handleClick();
* },
* componentDidMount: function() {
* this.refs.custom.initialize();
* }
* });
*
* Refs should rarely be used. When refs are used, they should only be done to
* control data that is not handled by React's data flow.
*
* @class ReactOwner
*/
var ReactOwner = {
/**
* @param {?object} object
* @return {boolean} True if `object` is a valid owner.
* @final
*/
isValidOwner: function (object) {
return !!(object && typeof object.attachRef === 'function' && typeof object.detachRef === 'function');
},
/**
* Adds a component by ref to an owner component.
*
* @param {ReactComponent} component Component to reference.
* @param {string} ref Name by which to refer to the component.
* @param {ReactOwner} owner Component on which to record the ref.
* @final
* @internal
*/
addComponentAsRefTo: function (component, ref, owner) {
!ReactOwner.isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'addComponentAsRefTo(...): Only a ReactOwner can have refs. You might ' + 'be adding a ref to a component that was not created inside a component\'s ' + '`render` method, or you have multiple copies of React loaded ' + '(details: https://fb.me/react-refs-must-have-owner).') : invariant(false) : undefined;
owner.attachRef(ref, component);
},
/**
* Removes a component by ref from an owner component.
*
* @param {ReactComponent} component Component to dereference.
* @param {string} ref Name of the ref to remove.
* @param {ReactOwner} owner Component on which the ref is recorded.
* @final
* @internal
*/
removeComponentAsRefFrom: function (component, ref, owner) {
!ReactOwner.isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. You might ' + 'be removing a ref to a component that was not created inside a component\'s ' + '`render` method, or you have multiple copies of React loaded ' + '(details: https://fb.me/react-refs-must-have-owner).') : invariant(false) : undefined;
// Check that `component` is still the current ref because we do not want to
// detach the ref if another component stole it.
if (owner.getPublicInstance().refs[ref] === component.getPublicInstance()) {
owner.detachRef(ref);
}
}
};
module.exports = ReactOwner;
}).call(this,require('_process'))
},{"_process":164,"fbjs/lib/invariant":151}],78:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactPerf
* @typechecks static-only
*/
'use strict';
/**
* ReactPerf is a general AOP system designed to measure performance. This
* module only has the hooks: see ReactDefaultPerf for the analysis tool.
*/
var ReactPerf = {
/**
* Boolean to enable/disable measurement. Set to false by default to prevent
* accidental logging and perf loss.
*/
enableMeasure: false,
/**
* Holds onto the measure function in use. By default, don't measure
* anything, but we'll override this if we inject a measure function.
*/
storedMeasure: _noMeasure,
/**
* @param {object} object
* @param {string} objectName
* @param {object<string>} methodNames
*/
measureMethods: function (object, objectName, methodNames) {
if (process.env.NODE_ENV !== 'production') {
for (var key in methodNames) {
if (!methodNames.hasOwnProperty(key)) {
continue;
}
object[key] = ReactPerf.measure(objectName, methodNames[key], object[key]);
}
}
},
/**
* Use this to wrap methods you want to measure. Zero overhead in production.
*
* @param {string} objName
* @param {string} fnName
* @param {function} func
* @return {function}
*/
measure: function (objName, fnName, func) {
if (process.env.NODE_ENV !== 'production') {
var measuredFunc = null;
var wrapper = function () {
if (ReactPerf.enableMeasure) {
if (!measuredFunc) {
measuredFunc = ReactPerf.storedMeasure(objName, fnName, func);
}
return measuredFunc.apply(this, arguments);
}
return func.apply(this, arguments);
};
wrapper.displayName = objName + '_' + fnName;
return wrapper;
}
return func;
},
injection: {
/**
* @param {function} measure
*/
injectMeasure: function (measure) {
ReactPerf.storedMeasure = measure;
}
}
};
/**
* Simply passes through the measured function, without measuring it.
*
* @param {string} objName
* @param {string} fnName
* @param {function} func
* @return {function}
*/
function _noMeasure(objName, fnName, func) {
return func;
}
module.exports = ReactPerf;
}).call(this,require('_process'))
},{"_process":164}],79:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactPropTypeLocationNames
*/
'use strict';
var ReactPropTypeLocationNames = {};
if (process.env.NODE_ENV !== 'production') {
ReactPropTypeLocationNames = {
prop: 'prop',
context: 'context',
childContext: 'child context'
};
}
module.exports = ReactPropTypeLocationNames;
}).call(this,require('_process'))
},{"_process":164}],80:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactPropTypeLocations
*/
'use strict';
var keyMirror = require('fbjs/lib/keyMirror');
var ReactPropTypeLocations = keyMirror({
prop: null,
context: null,
childContext: null
});
module.exports = ReactPropTypeLocations;
},{"fbjs/lib/keyMirror":154}],81:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactPropTypes
*/
'use strict';
var ReactElement = require('./ReactElement');
var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames');
var emptyFunction = require('fbjs/lib/emptyFunction');
var getIteratorFn = require('./getIteratorFn');
/**
* Collection of methods that allow declaration and validation of props that are
* supplied to React components. Example usage:
*
* var Props = require('ReactPropTypes');
* var MyArticle = React.createClass({
* propTypes: {
* // An optional string prop named "description".
* description: Props.string,
*
* // A required enum prop named "category".
* category: Props.oneOf(['News','Photos']).isRequired,
*
* // A prop named "dialog" that requires an instance of Dialog.
* dialog: Props.instanceOf(Dialog).isRequired
* },
* render: function() { ... }
* });
*
* A more formal specification of how these methods are used:
*
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
* decl := ReactPropTypes.{type}(.isRequired)?
*
* Each and every declaration produces a function with the same signature. This
* allows the creation of custom validation functions. For example:
*
* var MyLink = React.createClass({
* propTypes: {
* // An optional string or URI prop named "href".
* href: function(props, propName, componentName) {
* var propValue = props[propName];
* if (propValue != null && typeof propValue !== 'string' &&
* !(propValue instanceof URI)) {
* return new Error(
* 'Expected a string or an URI for ' + propName + ' in ' +
* componentName
* );
* }
* }
* },
* render: function() {...}
* });
*
* @internal
*/
var ANONYMOUS = '<<anonymous>>';
var ReactPropTypes = {
array: createPrimitiveTypeChecker('array'),
bool: createPrimitiveTypeChecker('boolean'),
func: createPrimitiveTypeChecker('function'),
number: createPrimitiveTypeChecker('number'),
object: createPrimitiveTypeChecker('object'),
string: createPrimitiveTypeChecker('string'),
any: createAnyTypeChecker(),
arrayOf: createArrayOfTypeChecker,
element: createElementTypeChecker(),
instanceOf: createInstanceTypeChecker,
node: createNodeChecker(),
objectOf: createObjectOfTypeChecker,
oneOf: createEnumTypeChecker,
oneOfType: createUnionTypeChecker,
shape: createShapeTypeChecker
};
function createChainableTypeChecker(validate) {
function checkType(isRequired, props, propName, componentName, location, propFullName) {
componentName = componentName || ANONYMOUS;
propFullName = propFullName || propName;
if (props[propName] == null) {
var locationName = ReactPropTypeLocationNames[location];
if (isRequired) {
return new Error('Required ' + locationName + ' `' + propFullName + '` was not specified in ' + ('`' + componentName + '`.'));
}
return null;
} else {
return validate(props, propName, componentName, location, propFullName);
}
}
var chainedCheckType = checkType.bind(null, false);
chainedCheckType.isRequired = checkType.bind(null, true);
return chainedCheckType;
}
function createPrimitiveTypeChecker(expectedType) {
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== expectedType) {
var locationName = ReactPropTypeLocationNames[location];
// `propValue` being instance of, say, date/regexp, pass the 'object'
// check, but we can offer a more precise error message here rather than
// 'of type `object`'.
var preciseType = getPreciseType(propValue);
return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createAnyTypeChecker() {
return createChainableTypeChecker(emptyFunction.thatReturns(null));
}
function createArrayOfTypeChecker(typeChecker) {
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
if (!Array.isArray(propValue)) {
var locationName = ReactPropTypeLocationNames[location];
var propType = getPropType(propValue);
return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
}
for (var i = 0; i < propValue.length; i++) {
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']');
if (error instanceof Error) {
return error;
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function createElementTypeChecker() {
function validate(props, propName, componentName, location, propFullName) {
if (!ReactElement.isValidElement(props[propName])) {
var locationName = ReactPropTypeLocationNames[location];
return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a single ReactElement.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createInstanceTypeChecker(expectedClass) {
function validate(props, propName, componentName, location, propFullName) {
if (!(props[propName] instanceof expectedClass)) {
var locationName = ReactPropTypeLocationNames[location];
var expectedClassName = expectedClass.name || ANONYMOUS;
var actualClassName = getClassName(props[propName]);
return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createEnumTypeChecker(expectedValues) {
if (!Array.isArray(expectedValues)) {
return createChainableTypeChecker(function () {
return new Error('Invalid argument supplied to oneOf, expected an instance of array.');
});
}
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
for (var i = 0; i < expectedValues.length; i++) {
if (propValue === expectedValues[i]) {
return null;
}
}
var locationName = ReactPropTypeLocationNames[location];
var valuesString = JSON.stringify(expectedValues);
return new Error('Invalid ' + locationName + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
}
return createChainableTypeChecker(validate);
}
function createObjectOfTypeChecker(typeChecker) {
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
var locationName = ReactPropTypeLocationNames[location];
return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
}
for (var key in propValue) {
if (propValue.hasOwnProperty(key)) {
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key);
if (error instanceof Error) {
return error;
}
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function createUnionTypeChecker(arrayOfTypeCheckers) {
if (!Array.isArray(arrayOfTypeCheckers)) {
return createChainableTypeChecker(function () {
return new Error('Invalid argument supplied to oneOfType, expected an instance of array.');
});
}
function validate(props, propName, componentName, location, propFullName) {
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
var checker = arrayOfTypeCheckers[i];
if (checker(props, propName, componentName, location, propFullName) == null) {
return null;
}
}
var locationName = ReactPropTypeLocationNames[location];
return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
}
return createChainableTypeChecker(validate);
}
function createNodeChecker() {
function validate(props, propName, componentName, location, propFullName) {
if (!isNode(props[propName])) {
var locationName = ReactPropTypeLocationNames[location];
return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createShapeTypeChecker(shapeTypes) {
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
var locationName = ReactPropTypeLocationNames[location];
return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
}
for (var key in shapeTypes) {
var checker = shapeTypes[key];
if (!checker) {
continue;
}
var error = checker(propValue, key, componentName, location, propFullName + '.' + key);
if (error) {
return error;
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function isNode(propValue) {
switch (typeof propValue) {
case 'number':
case 'string':
case 'undefined':
return true;
case 'boolean':
return !propValue;
case 'object':
if (Array.isArray(propValue)) {
return propValue.every(isNode);
}
if (propValue === null || ReactElement.isValidElement(propValue)) {
return true;
}
var iteratorFn = getIteratorFn(propValue);
if (iteratorFn) {
var iterator = iteratorFn.call(propValue);
var step;
if (iteratorFn !== propValue.entries) {
while (!(step = iterator.next()).done) {
if (!isNode(step.value)) {
return false;
}
}
} else {
// Iterator will provide entry [k,v] tuples rather than values.
while (!(step = iterator.next()).done) {
var entry = step.value;
if (entry) {
if (!isNode(entry[1])) {
return false;
}
}
}
}
} else {
return false;
}
return true;
default:
return false;
}
}
// Equivalent of `typeof` but with special handling for array and regexp.
function getPropType(propValue) {
var propType = typeof propValue;
if (Array.isArray(propValue)) {
return 'array';
}
if (propValue instanceof RegExp) {
// Old webkits (at least until Android 4.0) return 'function' rather than
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
// passes PropTypes.object.
return 'object';
}
return propType;
}
// This handles more types than `getPropType`. Only used for error messages.
// See `createPrimitiveTypeChecker`.
function getPreciseType(propValue) {
var propType = getPropType(propValue);
if (propType === 'object') {
if (propValue instanceof Date) {
return 'date';
} else if (propValue instanceof RegExp) {
return 'regexp';
}
}
return propType;
}
// Returns class name of the object, if any.
function getClassName(propValue) {
if (!propValue.constructor || !propValue.constructor.name) {
return '<<anonymous>>';
}
return propValue.constructor.name;
}
module.exports = ReactPropTypes;
},{"./ReactElement":59,"./ReactPropTypeLocationNames":79,"./getIteratorFn":122,"fbjs/lib/emptyFunction":143}],82:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactReconcileTransaction
* @typechecks static-only
*/
'use strict';
var CallbackQueue = require('./CallbackQueue');
var PooledClass = require('./PooledClass');
var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
var ReactDOMFeatureFlags = require('./ReactDOMFeatureFlags');
var ReactInputSelection = require('./ReactInputSelection');
var Transaction = require('./Transaction');
var assign = require('./Object.assign');
/**
* Ensures that, when possible, the selection range (currently selected text
* input) is not disturbed by performing the transaction.
*/
var SELECTION_RESTORATION = {
/**
* @return {Selection} Selection information.
*/
initialize: ReactInputSelection.getSelectionInformation,
/**
* @param {Selection} sel Selection information returned from `initialize`.
*/
close: ReactInputSelection.restoreSelection
};
/**
* Suppresses events (blur/focus) that could be inadvertently dispatched due to
* high level DOM manipulations (like temporarily removing a text input from the
* DOM).
*/
var EVENT_SUPPRESSION = {
/**
* @return {boolean} The enabled status of `ReactBrowserEventEmitter` before
* the reconciliation.
*/
initialize: function () {
var currentlyEnabled = ReactBrowserEventEmitter.isEnabled();
ReactBrowserEventEmitter.setEnabled(false);
return currentlyEnabled;
},
/**
* @param {boolean} previouslyEnabled Enabled status of
* `ReactBrowserEventEmitter` before the reconciliation occurred. `close`
* restores the previous value.
*/
close: function (previouslyEnabled) {
ReactBrowserEventEmitter.setEnabled(previouslyEnabled);
}
};
/**
* Provides a queue for collecting `componentDidMount` and
* `componentDidUpdate` callbacks during the the transaction.
*/
var ON_DOM_READY_QUEUEING = {
/**
* Initializes the internal `onDOMReady` queue.
*/
initialize: function () {
this.reactMountReady.reset();
},
/**
* After DOM is flushed, invoke all registered `onDOMReady` callbacks.
*/
close: function () {
this.reactMountReady.notifyAll();
}
};
/**
* Executed within the scope of the `Transaction` instance. Consider these as
* being member methods, but with an implied ordering while being isolated from
* each other.
*/
var TRANSACTION_WRAPPERS = [SELECTION_RESTORATION, EVENT_SUPPRESSION, ON_DOM_READY_QUEUEING];
/**
* Currently:
* - The order that these are listed in the transaction is critical:
* - Suppresses events.
* - Restores selection range.
*
* Future:
* - Restore document/overflow scroll positions that were unintentionally
* modified via DOM insertions above the top viewport boundary.
* - Implement/integrate with customized constraint based layout system and keep
* track of which dimensions must be remeasured.
*
* @class ReactReconcileTransaction
*/
function ReactReconcileTransaction(forceHTML) {
this.reinitializeTransaction();
// Only server-side rendering really needs this option (see
// `ReactServerRendering`), but server-side uses
// `ReactServerRenderingTransaction` instead. This option is here so that it's
// accessible and defaults to false when `ReactDOMComponent` and
// `ReactTextComponent` checks it in `mountComponent`.`
this.renderToStaticMarkup = false;
this.reactMountReady = CallbackQueue.getPooled(null);
this.useCreateElement = !forceHTML && ReactDOMFeatureFlags.useCreateElement;
}
var Mixin = {
/**
* @see Transaction
* @abstract
* @final
* @return {array<object>} List of operation wrap procedures.
* TODO: convert to array<TransactionWrapper>
*/
getTransactionWrappers: function () {
return TRANSACTION_WRAPPERS;
},
/**
* @return {object} The queue to collect `onDOMReady` callbacks with.
*/
getReactMountReady: function () {
return this.reactMountReady;
},
/**
* `PooledClass` looks for this, and will invoke this before allowing this
* instance to be reused.
*/
destructor: function () {
CallbackQueue.release(this.reactMountReady);
this.reactMountReady = null;
}
};
assign(ReactReconcileTransaction.prototype, Transaction.Mixin, Mixin);
PooledClass.addPoolingTo(ReactReconcileTransaction);
module.exports = ReactReconcileTransaction;
},{"./CallbackQueue":12,"./Object.assign":29,"./PooledClass":30,"./ReactBrowserEventEmitter":33,"./ReactDOMFeatureFlags":46,"./ReactInputSelection":67,"./Transaction":107}],83:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactReconciler
*/
'use strict';
var ReactRef = require('./ReactRef');
/**
* Helper to call ReactRef.attachRefs with this composite component, split out
* to avoid allocations in the transaction mount-ready queue.
*/
function attachRefs() {
ReactRef.attachRefs(this, this._currentElement);
}
var ReactReconciler = {
/**
* Initializes the component, renders markup, and registers event listeners.
*
* @param {ReactComponent} internalInstance
* @param {string} rootID DOM ID of the root node.
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @return {?string} Rendered markup to be inserted into the DOM.
* @final
* @internal
*/
mountComponent: function (internalInstance, rootID, transaction, context) {
var markup = internalInstance.mountComponent(rootID, transaction, context);
if (internalInstance._currentElement && internalInstance._currentElement.ref != null) {
transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
}
return markup;
},
/**
* Releases any resources allocated by `mountComponent`.
*
* @final
* @internal
*/
unmountComponent: function (internalInstance) {
ReactRef.detachRefs(internalInstance, internalInstance._currentElement);
internalInstance.unmountComponent();
},
/**
* Update a component using a new element.
*
* @param {ReactComponent} internalInstance
* @param {ReactElement} nextElement
* @param {ReactReconcileTransaction} transaction
* @param {object} context
* @internal
*/
receiveComponent: function (internalInstance, nextElement, transaction, context) {
var prevElement = internalInstance._currentElement;
if (nextElement === prevElement && context === internalInstance._context) {
// Since elements are immutable after the owner is rendered,
// we can do a cheap identity compare here to determine if this is a
// superfluous reconcile. It's possible for state to be mutable but such
// change should trigger an update of the owner which would recreate
// the element. We explicitly check for the existence of an owner since
// it's possible for an element created outside a composite to be
// deeply mutated and reused.
// TODO: Bailing out early is just a perf optimization right?
// TODO: Removing the return statement should affect correctness?
return;
}
var refsChanged = ReactRef.shouldUpdateRefs(prevElement, nextElement);
if (refsChanged) {
ReactRef.detachRefs(internalInstance, prevElement);
}
internalInstance.receiveComponent(nextElement, transaction, context);
if (refsChanged && internalInstance._currentElement && internalInstance._currentElement.ref != null) {
transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
}
},
/**
* Flush any dirty changes in a component.
*
* @param {ReactComponent} internalInstance
* @param {ReactReconcileTransaction} transaction
* @internal
*/
performUpdateIfNecessary: function (internalInstance, transaction) {
internalInstance.performUpdateIfNecessary(transaction);
}
};
module.exports = ReactReconciler;
},{"./ReactRef":84}],84:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactRef
*/
'use strict';
var ReactOwner = require('./ReactOwner');
var ReactRef = {};
function attachRef(ref, component, owner) {
if (typeof ref === 'function') {
ref(component.getPublicInstance());
} else {
// Legacy ref
ReactOwner.addComponentAsRefTo(component, ref, owner);
}
}
function detachRef(ref, component, owner) {
if (typeof ref === 'function') {
ref(null);
} else {
// Legacy ref
ReactOwner.removeComponentAsRefFrom(component, ref, owner);
}
}
ReactRef.attachRefs = function (instance, element) {
if (element === null || element === false) {
return;
}
var ref = element.ref;
if (ref != null) {
attachRef(ref, instance, element._owner);
}
};
ReactRef.shouldUpdateRefs = function (prevElement, nextElement) {
// If either the owner or a `ref` has changed, make sure the newest owner
// has stored a reference to `this`, and the previous owner (if different)
// has forgotten the reference to `this`. We use the element instead
// of the public this.props because the post processing cannot determine
// a ref. The ref conceptually lives on the element.
// TODO: Should this even be possible? The owner cannot change because
// it's forbidden by shouldUpdateReactComponent. The ref can change
// if you swap the keys of but not the refs. Reconsider where this check
// is made. It probably belongs where the key checking and
// instantiateReactComponent is done.
var prevEmpty = prevElement === null || prevElement === false;
var nextEmpty = nextElement === null || nextElement === false;
return(
// This has a few false positives w/r/t empty components.
prevEmpty || nextEmpty || nextElement._owner !== prevElement._owner || nextElement.ref !== prevElement.ref
);
};
ReactRef.detachRefs = function (instance, element) {
if (element === null || element === false) {
return;
}
var ref = element.ref;
if (ref != null) {
detachRef(ref, instance, element._owner);
}
};
module.exports = ReactRef;
},{"./ReactOwner":77}],85:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactRootIndex
* @typechecks
*/
'use strict';
var ReactRootIndexInjection = {
/**
* @param {function} _createReactRootIndex
*/
injectCreateReactRootIndex: function (_createReactRootIndex) {
ReactRootIndex.createReactRootIndex = _createReactRootIndex;
}
};
var ReactRootIndex = {
createReactRootIndex: null,
injection: ReactRootIndexInjection
};
module.exports = ReactRootIndex;
},{}],86:[function(require,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactServerBatchingStrategy
* @typechecks
*/
'use strict';
var ReactServerBatchingStrategy = {
isBatchingUpdates: false,
batchedUpdates: function (callback) {
// Don't do anything here. During the server rendering we don't want to
// schedule any updates. We will simply ignore them.
}
};
module.exports = ReactServerBatchingStrategy;
},{}],87:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @typechecks static-only
* @providesModule ReactServerRendering
*/
'use strict';
var ReactDefaultBatchingStrategy = require('./ReactDefaultBatchingStrategy');
var ReactElement = require('./ReactElement');
var ReactInstanceHandles = require('./ReactInstanceHandles');
var ReactMarkupChecksum = require('./ReactMarkupChecksum');
var ReactServerBatchingStrategy = require('./ReactServerBatchingStrategy');
var ReactServerRenderingTransaction = require('./ReactServerRenderingTransaction');
var ReactUpdates = require('./ReactUpdates');
var emptyObject = require('fbjs/lib/emptyObject');
var instantiateReactComponent = require('./instantiateReactComponent');
var invariant = require('fbjs/lib/invariant');
/**
* @param {ReactElement} element
* @return {string} the HTML markup
*/
function renderToString(element) {
!ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'renderToString(): You must pass a valid ReactElement.') : invariant(false) : undefined;
var transaction;
try {
ReactUpdates.injection.injectBatchingStrategy(ReactServerBatchingStrategy);
var id = ReactInstanceHandles.createReactRootID();
transaction = ReactServerRenderingTransaction.getPooled(false);
return transaction.perform(function () {
var componentInstance = instantiateReactComponent(element, null);
var markup = componentInstance.mountComponent(id, transaction, emptyObject);
return ReactMarkupChecksum.addChecksumToMarkup(markup);
}, null);
} finally {
ReactServerRenderingTransaction.release(transaction);
// Revert to the DOM batching strategy since these two renderers
// currently share these stateful modules.
ReactUpdates.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy);
}
}
/**
* @param {ReactElement} element
* @return {string} the HTML markup, without the extra React ID and checksum
* (for generating static pages)
*/
function renderToStaticMarkup(element) {
!ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'renderToStaticMarkup(): You must pass a valid ReactElement.') : invariant(false) : undefined;
var transaction;
try {
ReactUpdates.injection.injectBatchingStrategy(ReactServerBatchingStrategy);
var id = ReactInstanceHandles.createReactRootID();
transaction = ReactServerRenderingTransaction.getPooled(true);
return transaction.perform(function () {
var componentInstance = instantiateReactComponent(element, null);
return componentInstance.mountComponent(id, transaction, emptyObject);
}, null);
} finally {
ReactServerRenderingTransaction.release(transaction);
// Revert to the DOM batching strategy since these two renderers
// currently share these stateful modules.
ReactUpdates.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy);
}
}
module.exports = {
renderToString: renderToString,
renderToStaticMarkup: renderToStaticMarkup
};
}).call(this,require('_process'))
},{"./ReactDefaultBatchingStrategy":55,"./ReactElement":59,"./ReactInstanceHandles":68,"./ReactMarkupChecksum":71,"./ReactServerBatchingStrategy":86,"./ReactServerRenderingTransaction":88,"./ReactUpdates":90,"./instantiateReactComponent":125,"_process":164,"fbjs/lib/emptyObject":144,"fbjs/lib/invariant":151}],88:[function(require,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactServerRenderingTransaction
* @typechecks
*/
'use strict';
var PooledClass = require('./PooledClass');
var CallbackQueue = require('./CallbackQueue');
var Transaction = require('./Transaction');
var assign = require('./Object.assign');
var emptyFunction = require('fbjs/lib/emptyFunction');
/**
* Provides a `CallbackQueue` queue for collecting `onDOMReady` callbacks
* during the performing of the transaction.
*/
var ON_DOM_READY_QUEUEING = {
/**
* Initializes the internal `onDOMReady` queue.
*/
initialize: function () {
this.reactMountReady.reset();
},
close: emptyFunction
};
/**
* Executed within the scope of the `Transaction` instance. Consider these as
* being member methods, but with an implied ordering while being isolated from
* each other.
*/
var TRANSACTION_WRAPPERS = [ON_DOM_READY_QUEUEING];
/**
* @class ReactServerRenderingTransaction
* @param {boolean} renderToStaticMarkup
*/
function ReactServerRenderingTransaction(renderToStaticMarkup) {
this.reinitializeTransaction();
this.renderToStaticMarkup = renderToStaticMarkup;
this.reactMountReady = CallbackQueue.getPooled(null);
this.useCreateElement = false;
}
var Mixin = {
/**
* @see Transaction
* @abstract
* @final
* @return {array} Empty list of operation wrap procedures.
*/
getTransactionWrappers: function () {
return TRANSACTION_WRAPPERS;
},
/**
* @return {object} The queue to collect `onDOMReady` callbacks with.
*/
getReactMountReady: function () {
return this.reactMountReady;
},
/**
* `PooledClass` looks for this, and will invoke this before allowing this
* instance to be reused.
*/
destructor: function () {
CallbackQueue.release(this.reactMountReady);
this.reactMountReady = null;
}
};
assign(ReactServerRenderingTransaction.prototype, Transaction.Mixin, Mixin);
PooledClass.addPoolingTo(ReactServerRenderingTransaction);
module.exports = ReactServerRenderingTransaction;
},{"./CallbackQueue":12,"./Object.assign":29,"./PooledClass":30,"./Transaction":107,"fbjs/lib/emptyFunction":143}],89:[function(require,module,exports){
(function (process){
/**
* Copyright 2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactUpdateQueue
*/
'use strict';
var ReactCurrentOwner = require('./ReactCurrentOwner');
var ReactElement = require('./ReactElement');
var ReactInstanceMap = require('./ReactInstanceMap');
var ReactUpdates = require('./ReactUpdates');
var assign = require('./Object.assign');
var invariant = require('fbjs/lib/invariant');
var warning = require('fbjs/lib/warning');
function enqueueUpdate(internalInstance) {
ReactUpdates.enqueueUpdate(internalInstance);
}
function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
var internalInstance = ReactInstanceMap.get(publicInstance);
if (!internalInstance) {
if (process.env.NODE_ENV !== 'production') {
// Only warn when we have a callerName. Otherwise we should be silent.
// We're probably calling from enqueueCallback. We don't want to warn
// there because we already warned for the corresponding lifecycle method.
process.env.NODE_ENV !== 'production' ? warning(!callerName, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, publicInstance.constructor.displayName) : undefined;
}
return null;
}
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, '%s(...): Cannot update during an existing state transition ' + '(such as within `render`). Render methods should be a pure function ' + 'of props and state.', callerName) : undefined;
}
return internalInstance;
}
/**
* ReactUpdateQueue allows for state updates to be scheduled into a later
* reconciliation step.
*/
var ReactUpdateQueue = {
/**
* Checks whether or not this composite component is mounted.
* @param {ReactClass} publicInstance The instance we want to test.
* @return {boolean} True if mounted, false otherwise.
* @protected
* @final
*/
isMounted: function (publicInstance) {
if (process.env.NODE_ENV !== 'production') {
var owner = ReactCurrentOwner.current;
if (owner !== null) {
process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : undefined;
owner._warnedAboutRefsInRender = true;
}
}
var internalInstance = ReactInstanceMap.get(publicInstance);
if (internalInstance) {
// During componentWillMount and render this will still be null but after
// that will always render to something. At least for now. So we can use
// this hack.
return !!internalInstance._renderedComponent;
} else {
return false;
}
},
/**
* Enqueue a callback that will be executed after all the pending updates
* have processed.
*
* @param {ReactClass} publicInstance The instance to use as `this` context.
* @param {?function} callback Called after state is updated.
* @internal
*/
enqueueCallback: function (publicInstance, callback) {
!(typeof callback === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' + '`setState`, `replaceState`, or `forceUpdate` with a callback that ' + 'isn\'t callable.') : invariant(false) : undefined;
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance);
// Previously we would throw an error if we didn't have an internal
// instance. Since we want to make it a no-op instead, we mirror the same
// behavior we have in other enqueue* methods.
// We also need to ignore callbacks in componentWillMount. See
// enqueueUpdates.
if (!internalInstance) {
return null;
}
if (internalInstance._pendingCallbacks) {
internalInstance._pendingCallbacks.push(callback);
} else {
internalInstance._pendingCallbacks = [callback];
}
// TODO: The callback here is ignored when setState is called from
// componentWillMount. Either fix it or disallow doing so completely in
// favor of getInitialState. Alternatively, we can disallow
// componentWillMount during server-side rendering.
enqueueUpdate(internalInstance);
},
enqueueCallbackInternal: function (internalInstance, callback) {
!(typeof callback === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' + '`setState`, `replaceState`, or `forceUpdate` with a callback that ' + 'isn\'t callable.') : invariant(false) : undefined;
if (internalInstance._pendingCallbacks) {
internalInstance._pendingCallbacks.push(callback);
} else {
internalInstance._pendingCallbacks = [callback];
}
enqueueUpdate(internalInstance);
},
/**
* Forces an update. This should only be invoked when it is known with
* certainty that we are **not** in a DOM transaction.
*
* You may want to call this when you know that some deeper aspect of the
* component's state has changed but `setState` was not called.
*
* This will not invoke `shouldComponentUpdate`, but it will invoke
* `componentWillUpdate` and `componentDidUpdate`.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @internal
*/
enqueueForceUpdate: function (publicInstance) {
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'forceUpdate');
if (!internalInstance) {
return;
}
internalInstance._pendingForceUpdate = true;
enqueueUpdate(internalInstance);
},
/**
* Replaces all of the state. Always use this or `setState` to mutate state.
* You should treat `this.state` as immutable.
*
* There is no guarantee that `this.state` will be immediately updated, so
* accessing `this.state` after calling this method may return the old value.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @param {object} completeState Next state.
* @internal
*/
enqueueReplaceState: function (publicInstance, completeState) {
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceState');
if (!internalInstance) {
return;
}
internalInstance._pendingStateQueue = [completeState];
internalInstance._pendingReplaceState = true;
enqueueUpdate(internalInstance);
},
/**
* Sets a subset of the state. This only exists because _pendingState is
* internal. This provides a merging strategy that is not available to deep
* properties which is confusing. TODO: Expose pendingState or don't use it
* during the merge.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @param {object} partialState Next partial state to be merged with state.
* @internal
*/
enqueueSetState: function (publicInstance, partialState) {
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setState');
if (!internalInstance) {
return;
}
var queue = internalInstance._pendingStateQueue || (internalInstance._pendingStateQueue = []);
queue.push(partialState);
enqueueUpdate(internalInstance);
},
/**
* Sets a subset of the props.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @param {object} partialProps Subset of the next props.
* @internal
*/
enqueueSetProps: function (publicInstance, partialProps) {
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setProps');
if (!internalInstance) {
return;
}
ReactUpdateQueue.enqueueSetPropsInternal(internalInstance, partialProps);
},
enqueueSetPropsInternal: function (internalInstance, partialProps) {
var topLevelWrapper = internalInstance._topLevelWrapper;
!topLevelWrapper ? process.env.NODE_ENV !== 'production' ? invariant(false, 'setProps(...): You called `setProps` on a ' + 'component with a parent. This is an anti-pattern since props will ' + 'get reactively updated when rendered. Instead, change the owner\'s ' + '`render` method to pass the correct value as props to the component ' + 'where it is created.') : invariant(false) : undefined;
// Merge with the pending element if it exists, otherwise with existing
// element props.
var wrapElement = topLevelWrapper._pendingElement || topLevelWrapper._currentElement;
var element = wrapElement.props;
var props = assign({}, element.props, partialProps);
topLevelWrapper._pendingElement = ReactElement.cloneAndReplaceProps(wrapElement, ReactElement.cloneAndReplaceProps(element, props));
enqueueUpdate(topLevelWrapper);
},
/**
* Replaces all of the props.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @param {object} props New props.
* @internal
*/
enqueueReplaceProps: function (publicInstance, props) {
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceProps');
if (!internalInstance) {
return;
}
ReactUpdateQueue.enqueueReplacePropsInternal(internalInstance, props);
},
enqueueReplacePropsInternal: function (internalInstance, props) {
var topLevelWrapper = internalInstance._topLevelWrapper;
!topLevelWrapper ? process.env.NODE_ENV !== 'production' ? invariant(false, 'replaceProps(...): You called `replaceProps` on a ' + 'component with a parent. This is an anti-pattern since props will ' + 'get reactively updated when rendered. Instead, change the owner\'s ' + '`render` method to pass the correct value as props to the component ' + 'where it is created.') : invariant(false) : undefined;
// Merge with the pending element if it exists, otherwise with existing
// element props.
var wrapElement = topLevelWrapper._pendingElement || topLevelWrapper._currentElement;
var element = wrapElement.props;
topLevelWrapper._pendingElement = ReactElement.cloneAndReplaceProps(wrapElement, ReactElement.cloneAndReplaceProps(element, props));
enqueueUpdate(topLevelWrapper);
},
enqueueElementInternal: function (internalInstance, newElement) {
internalInstance._pendingElement = newElement;
enqueueUpdate(internalInstance);
}
};
module.exports = ReactUpdateQueue;
}).call(this,require('_process'))
},{"./Object.assign":29,"./ReactCurrentOwner":41,"./ReactElement":59,"./ReactInstanceMap":69,"./ReactUpdates":90,"_process":164,"fbjs/lib/invariant":151,"fbjs/lib/warning":162}],90:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactUpdates
*/
'use strict';
var CallbackQueue = require('./CallbackQueue');
var PooledClass = require('./PooledClass');
var ReactPerf = require('./ReactPerf');
var ReactReconciler = require('./ReactReconciler');
var Transaction = require('./Transaction');
var assign = require('./Object.assign');
var invariant = require('fbjs/lib/invariant');
var dirtyComponents = [];
var asapCallbackQueue = CallbackQueue.getPooled();
var asapEnqueued = false;
var batchingStrategy = null;
function ensureInjected() {
!(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching ' + 'strategy') : invariant(false) : undefined;
}
var NESTED_UPDATES = {
initialize: function () {
this.dirtyComponentsLength = dirtyComponents.length;
},
close: function () {
if (this.dirtyComponentsLength !== dirtyComponents.length) {
// Additional updates were enqueued by componentDidUpdate handlers or
// similar; before our own UPDATE_QUEUEING wrapper closes, we want to run
// these new updates so that if A's componentDidUpdate calls setState on
// B, B will update before the callback A's updater provided when calling
// setState.
dirtyComponents.splice(0, this.dirtyComponentsLength);
flushBatchedUpdates();
} else {
dirtyComponents.length = 0;
}
}
};
var UPDATE_QUEUEING = {
initialize: function () {
this.callbackQueue.reset();
},
close: function () {
this.callbackQueue.notifyAll();
}
};
var TRANSACTION_WRAPPERS = [NESTED_UPDATES, UPDATE_QUEUEING];
function ReactUpdatesFlushTransaction() {
this.reinitializeTransaction();
this.dirtyComponentsLength = null;
this.callbackQueue = CallbackQueue.getPooled();
this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled( /* forceHTML */false);
}
assign(ReactUpdatesFlushTransaction.prototype, Transaction.Mixin, {
getTransactionWrappers: function () {
return TRANSACTION_WRAPPERS;
},
destructor: function () {
this.dirtyComponentsLength = null;
CallbackQueue.release(this.callbackQueue);
this.callbackQueue = null;
ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction);
this.reconcileTransaction = null;
},
perform: function (method, scope, a) {
// Essentially calls `this.reconcileTransaction.perform(method, scope, a)`
// with this transaction's wrappers around it.
return Transaction.Mixin.perform.call(this, this.reconcileTransaction.perform, this.reconcileTransaction, method, scope, a);
}
});
PooledClass.addPoolingTo(ReactUpdatesFlushTransaction);
function batchedUpdates(callback, a, b, c, d, e) {
ensureInjected();
batchingStrategy.batchedUpdates(callback, a, b, c, d, e);
}
/**
* Array comparator for ReactComponents by mount ordering.
*
* @param {ReactComponent} c1 first component you're comparing
* @param {ReactComponent} c2 second component you're comparing
* @return {number} Return value usable by Array.prototype.sort().
*/
function mountOrderComparator(c1, c2) {
return c1._mountOrder - c2._mountOrder;
}
function runBatchedUpdates(transaction) {
var len = transaction.dirtyComponentsLength;
!(len === dirtyComponents.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected flush transaction\'s stored dirty-components length (%s) to ' + 'match dirty-components array length (%s).', len, dirtyComponents.length) : invariant(false) : undefined;
// Since reconciling a component higher in the owner hierarchy usually (not
// always -- see shouldComponentUpdate()) will reconcile children, reconcile
// them before their children by sorting the array.
dirtyComponents.sort(mountOrderComparator);
for (var i = 0; i < len; i++) {
// If a component is unmounted before pending changes apply, it will still
// be here, but we assume that it has cleared its _pendingCallbacks and
// that performUpdateIfNecessary is a noop.
var component = dirtyComponents[i];
// If performUpdateIfNecessary happens to enqueue any new updates, we
// shouldn't execute the callbacks until the next render happens, so
// stash the callbacks first
var callbacks = component._pendingCallbacks;
component._pendingCallbacks = null;
ReactReconciler.performUpdateIfNecessary(component, transaction.reconcileTransaction);
if (callbacks) {
for (var j = 0; j < callbacks.length; j++) {
transaction.callbackQueue.enqueue(callbacks[j], component.getPublicInstance());
}
}
}
}
var flushBatchedUpdates = function () {
// ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents
// array and perform any updates enqueued by mount-ready handlers (i.e.,
// componentDidUpdate) but we need to check here too in order to catch
// updates enqueued by setState callbacks and asap calls.
while (dirtyComponents.length || asapEnqueued) {
if (dirtyComponents.length) {
var transaction = ReactUpdatesFlushTransaction.getPooled();
transaction.perform(runBatchedUpdates, null, transaction);
ReactUpdatesFlushTransaction.release(transaction);
}
if (asapEnqueued) {
asapEnqueued = false;
var queue = asapCallbackQueue;
asapCallbackQueue = CallbackQueue.getPooled();
queue.notifyAll();
CallbackQueue.release(queue);
}
}
};
flushBatchedUpdates = ReactPerf.measure('ReactUpdates', 'flushBatchedUpdates', flushBatchedUpdates);
/**
* Mark a component as needing a rerender, adding an optional callback to a
* list of functions which will be executed once the rerender occurs.
*/
function enqueueUpdate(component) {
ensureInjected();
// Various parts of our code (such as ReactCompositeComponent's
// _renderValidatedComponent) assume that calls to render aren't nested;
// verify that that's the case. (This is called by each top-level update
// function, like setProps, setState, forceUpdate, etc.; creation and
// destruction of top-level components is guarded in ReactMount.)
if (!batchingStrategy.isBatchingUpdates) {
batchingStrategy.batchedUpdates(enqueueUpdate, component);
return;
}
dirtyComponents.push(component);
}
/**
* Enqueue a callback to be run at the end of the current batching cycle. Throws
* if no updates are currently being performed.
*/
function asap(callback, context) {
!batchingStrategy.isBatchingUpdates ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context where' + 'updates are not being batched.') : invariant(false) : undefined;
asapCallbackQueue.enqueue(callback, context);
asapEnqueued = true;
}
var ReactUpdatesInjection = {
injectReconcileTransaction: function (ReconcileTransaction) {
!ReconcileTransaction ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a reconcile transaction class') : invariant(false) : undefined;
ReactUpdates.ReactReconcileTransaction = ReconcileTransaction;
},
injectBatchingStrategy: function (_batchingStrategy) {
!_batchingStrategy ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batching strategy') : invariant(false) : undefined;
!(typeof _batchingStrategy.batchedUpdates === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batchedUpdates() function') : invariant(false) : undefined;
!(typeof _batchingStrategy.isBatchingUpdates === 'boolean') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide an isBatchingUpdates boolean attribute') : invariant(false) : undefined;
batchingStrategy = _batchingStrategy;
}
};
var ReactUpdates = {
/**
* React references `ReactReconcileTransaction` using this property in order
* to allow dependency injection.
*
* @internal
*/
ReactReconcileTransaction: null,
batchedUpdates: batchedUpdates,
enqueueUpdate: enqueueUpdate,
flushBatchedUpdates: flushBatchedUpdates,
injection: ReactUpdatesInjection,
asap: asap
};
module.exports = ReactUpdates;
}).call(this,require('_process'))
},{"./CallbackQueue":12,"./Object.assign":29,"./PooledClass":30,"./ReactPerf":78,"./ReactReconciler":83,"./Transaction":107,"_process":164,"fbjs/lib/invariant":151}],91:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactVersion
*/
'use strict';
module.exports = '0.14.6';
},{}],92:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SVGDOMPropertyConfig
*/
'use strict';
var DOMProperty = require('./DOMProperty');
var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
var NS = {
xlink: 'http://www.w3.org/1999/xlink',
xml: 'http://www.w3.org/XML/1998/namespace'
};
var SVGDOMPropertyConfig = {
Properties: {
clipPath: MUST_USE_ATTRIBUTE,
cx: MUST_USE_ATTRIBUTE,
cy: MUST_USE_ATTRIBUTE,
d: MUST_USE_ATTRIBUTE,
dx: MUST_USE_ATTRIBUTE,
dy: MUST_USE_ATTRIBUTE,
fill: MUST_USE_ATTRIBUTE,
fillOpacity: MUST_USE_ATTRIBUTE,
fontFamily: MUST_USE_ATTRIBUTE,
fontSize: MUST_USE_ATTRIBUTE,
fx: MUST_USE_ATTRIBUTE,
fy: MUST_USE_ATTRIBUTE,
gradientTransform: MUST_USE_ATTRIBUTE,
gradientUnits: MUST_USE_ATTRIBUTE,
markerEnd: MUST_USE_ATTRIBUTE,
markerMid: MUST_USE_ATTRIBUTE,
markerStart: MUST_USE_ATTRIBUTE,
offset: MUST_USE_ATTRIBUTE,
opacity: MUST_USE_ATTRIBUTE,
patternContentUnits: MUST_USE_ATTRIBUTE,
patternUnits: MUST_USE_ATTRIBUTE,
points: MUST_USE_ATTRIBUTE,
preserveAspectRatio: MUST_USE_ATTRIBUTE,
r: MUST_USE_ATTRIBUTE,
rx: MUST_USE_ATTRIBUTE,
ry: MUST_USE_ATTRIBUTE,
spreadMethod: MUST_USE_ATTRIBUTE,
stopColor: MUST_USE_ATTRIBUTE,
stopOpacity: MUST_USE_ATTRIBUTE,
stroke: MUST_USE_ATTRIBUTE,
strokeDasharray: MUST_USE_ATTRIBUTE,
strokeLinecap: MUST_USE_ATTRIBUTE,
strokeOpacity: MUST_USE_ATTRIBUTE,
strokeWidth: MUST_USE_ATTRIBUTE,
textAnchor: MUST_USE_ATTRIBUTE,
transform: MUST_USE_ATTRIBUTE,
version: MUST_USE_ATTRIBUTE,
viewBox: MUST_USE_ATTRIBUTE,
x1: MUST_USE_ATTRIBUTE,
x2: MUST_USE_ATTRIBUTE,
x: MUST_USE_ATTRIBUTE,
xlinkActuate: MUST_USE_ATTRIBUTE,
xlinkArcrole: MUST_USE_ATTRIBUTE,
xlinkHref: MUST_USE_ATTRIBUTE,
xlinkRole: MUST_USE_ATTRIBUTE,
xlinkShow: MUST_USE_ATTRIBUTE,
xlinkTitle: MUST_USE_ATTRIBUTE,
xlinkType: MUST_USE_ATTRIBUTE,
xmlBase: MUST_USE_ATTRIBUTE,
xmlLang: MUST_USE_ATTRIBUTE,
xmlSpace: MUST_USE_ATTRIBUTE,
y1: MUST_USE_ATTRIBUTE,
y2: MUST_USE_ATTRIBUTE,
y: MUST_USE_ATTRIBUTE
},
DOMAttributeNamespaces: {
xlinkActuate: NS.xlink,
xlinkArcrole: NS.xlink,
xlinkHref: NS.xlink,
xlinkRole: NS.xlink,
xlinkShow: NS.xlink,
xlinkTitle: NS.xlink,
xlinkType: NS.xlink,
xmlBase: NS.xml,
xmlLang: NS.xml,
xmlSpace: NS.xml
},
DOMAttributeNames: {
clipPath: 'clip-path',
fillOpacity: 'fill-opacity',
fontFamily: 'font-family',
fontSize: 'font-size',
gradientTransform: 'gradientTransform',
gradientUnits: 'gradientUnits',
markerEnd: 'marker-end',
markerMid: 'marker-mid',
markerStart: 'marker-start',
patternContentUnits: 'patternContentUnits',
patternUnits: 'patternUnits',
preserveAspectRatio: 'preserveAspectRatio',
spreadMethod: 'spreadMethod',
stopColor: 'stop-color',
stopOpacity: 'stop-opacity',
strokeDasharray: 'stroke-dasharray',
strokeLinecap: 'stroke-linecap',
strokeOpacity: 'stroke-opacity',
strokeWidth: 'stroke-width',
textAnchor: 'text-anchor',
viewBox: 'viewBox',
xlinkActuate: 'xlink:actuate',
xlinkArcrole: 'xlink:arcrole',
xlinkHref: 'xlink:href',
xlinkRole: 'xlink:role',
xlinkShow: 'xlink:show',
xlinkTitle: 'xlink:title',
xlinkType: 'xlink:type',
xmlBase: 'xml:base',
xmlLang: 'xml:lang',
xmlSpace: 'xml:space'
}
};
module.exports = SVGDOMPropertyConfig;
},{"./DOMProperty":16}],93:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SelectEventPlugin
*/
'use strict';
var EventConstants = require('./EventConstants');
var EventPropagators = require('./EventPropagators');
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
var ReactInputSelection = require('./ReactInputSelection');
var SyntheticEvent = require('./SyntheticEvent');
var getActiveElement = require('fbjs/lib/getActiveElement');
var isTextInputElement = require('./isTextInputElement');
var keyOf = require('fbjs/lib/keyOf');
var shallowEqual = require('fbjs/lib/shallowEqual');
var topLevelTypes = EventConstants.topLevelTypes;
var skipSelectionChangeEvent = ExecutionEnvironment.canUseDOM && 'documentMode' in document && document.documentMode <= 11;
var eventTypes = {
select: {
phasedRegistrationNames: {
bubbled: keyOf({ onSelect: null }),
captured: keyOf({ onSelectCapture: null })
},
dependencies: [topLevelTypes.topBlur, topLevelTypes.topContextMenu, topLevelTypes.topFocus, topLevelTypes.topKeyDown, topLevelTypes.topMouseDown, topLevelTypes.topMouseUp, topLevelTypes.topSelectionChange]
}
};
var activeElement = null;
var activeElementID = null;
var lastSelection = null;
var mouseDown = false;
// Track whether a listener exists for this plugin. If none exist, we do
// not extract events.
var hasListener = false;
var ON_SELECT_KEY = keyOf({ onSelect: null });
/**
* Get an object which is a unique representation of the current selection.
*
* The return value will not be consistent across nodes or browsers, but
* two identical selections on the same node will return identical objects.
*
* @param {DOMElement} node
* @return {object}
*/
function getSelection(node) {
if ('selectionStart' in node && ReactInputSelection.hasSelectionCapabilities(node)) {
return {
start: node.selectionStart,
end: node.selectionEnd
};
} else if (window.getSelection) {
var selection = window.getSelection();
return {
anchorNode: selection.anchorNode,
anchorOffset: selection.anchorOffset,
focusNode: selection.focusNode,
focusOffset: selection.focusOffset
};
} else if (document.selection) {
var range = document.selection.createRange();
return {
parentElement: range.parentElement(),
text: range.text,
top: range.boundingTop,
left: range.boundingLeft
};
}
}
/**
* Poll selection to see whether it's changed.
*
* @param {object} nativeEvent
* @return {?SyntheticEvent}
*/
function constructSelectEvent(nativeEvent, nativeEventTarget) {
// Ensure we have the right element, and that the user is not dragging a
// selection (this matches native `select` event behavior). In HTML5, select
// fires only on input and textarea thus if there's no focused element we
// won't dispatch.
if (mouseDown || activeElement == null || activeElement !== getActiveElement()) {
return null;
}
// Only fire when selection has actually changed.
var currentSelection = getSelection(activeElement);
if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
lastSelection = currentSelection;
var syntheticEvent = SyntheticEvent.getPooled(eventTypes.select, activeElementID, nativeEvent, nativeEventTarget);
syntheticEvent.type = 'select';
syntheticEvent.target = activeElement;
EventPropagators.accumulateTwoPhaseDispatches(syntheticEvent);
return syntheticEvent;
}
return null;
}
/**
* This plugin creates an `onSelect` event that normalizes select events
* across form elements.
*
* Supported elements are:
* - input (see `isTextInputElement`)
* - textarea
* - contentEditable
*
* This differs from native browser implementations in the following ways:
* - Fires on contentEditable fields as well as inputs.
* - Fires for collapsed selection.
* - Fires after user input.
*/
var SelectEventPlugin = {
eventTypes: eventTypes,
/**
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
if (!hasListener) {
return null;
}
switch (topLevelType) {
// Track the input node that has focus.
case topLevelTypes.topFocus:
if (isTextInputElement(topLevelTarget) || topLevelTarget.contentEditable === 'true') {
activeElement = topLevelTarget;
activeElementID = topLevelTargetID;
lastSelection = null;
}
break;
case topLevelTypes.topBlur:
activeElement = null;
activeElementID = null;
lastSelection = null;
break;
// Don't fire the event while the user is dragging. This matches the
// semantics of the native select event.
case topLevelTypes.topMouseDown:
mouseDown = true;
break;
case topLevelTypes.topContextMenu:
case topLevelTypes.topMouseUp:
mouseDown = false;
return constructSelectEvent(nativeEvent, nativeEventTarget);
// Chrome and IE fire non-standard event when selection is changed (and
// sometimes when it hasn't). IE's event fires out of order with respect
// to key and input events on deletion, so we discard it.
//
// Firefox doesn't support selectionchange, so check selection status
// after each key entry. The selection changes after keydown and before
// keyup, but we check on keydown as well in the case of holding down a
// key, when multiple keydown events are fired but only one keyup is.
// This is also our approach for IE handling, for the reason above.
case topLevelTypes.topSelectionChange:
if (skipSelectionChangeEvent) {
break;
}
// falls through
case topLevelTypes.topKeyDown:
case topLevelTypes.topKeyUp:
return constructSelectEvent(nativeEvent, nativeEventTarget);
}
return null;
},
didPutListener: function (id, registrationName, listener) {
if (registrationName === ON_SELECT_KEY) {
hasListener = true;
}
}
};
module.exports = SelectEventPlugin;
},{"./EventConstants":21,"./EventPropagators":25,"./ReactInputSelection":67,"./SyntheticEvent":99,"./isTextInputElement":127,"fbjs/lib/ExecutionEnvironment":137,"fbjs/lib/getActiveElement":146,"fbjs/lib/keyOf":155,"fbjs/lib/shallowEqual":160}],94:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ServerReactRootIndex
* @typechecks
*/
'use strict';
/**
* Size of the reactRoot ID space. We generate random numbers for React root
* IDs and if there's a collision the events and DOM update system will
* get confused. In the future we need a way to generate GUIDs but for
* now this will work on a smaller scale.
*/
var GLOBAL_MOUNT_POINT_MAX = Math.pow(2, 53);
var ServerReactRootIndex = {
createReactRootIndex: function () {
return Math.ceil(Math.random() * GLOBAL_MOUNT_POINT_MAX);
}
};
module.exports = ServerReactRootIndex;
},{}],95:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SimpleEventPlugin
*/
'use strict';
var EventConstants = require('./EventConstants');
var EventListener = require('fbjs/lib/EventListener');
var EventPropagators = require('./EventPropagators');
var ReactMount = require('./ReactMount');
var SyntheticClipboardEvent = require('./SyntheticClipboardEvent');
var SyntheticEvent = require('./SyntheticEvent');
var SyntheticFocusEvent = require('./SyntheticFocusEvent');
var SyntheticKeyboardEvent = require('./SyntheticKeyboardEvent');
var SyntheticMouseEvent = require('./SyntheticMouseEvent');
var SyntheticDragEvent = require('./SyntheticDragEvent');
var SyntheticTouchEvent = require('./SyntheticTouchEvent');
var SyntheticUIEvent = require('./SyntheticUIEvent');
var SyntheticWheelEvent = require('./SyntheticWheelEvent');
var emptyFunction = require('fbjs/lib/emptyFunction');
var getEventCharCode = require('./getEventCharCode');
var invariant = require('fbjs/lib/invariant');
var keyOf = require('fbjs/lib/keyOf');
var topLevelTypes = EventConstants.topLevelTypes;
var eventTypes = {
abort: {
phasedRegistrationNames: {
bubbled: keyOf({ onAbort: true }),
captured: keyOf({ onAbortCapture: true })
}
},
blur: {
phasedRegistrationNames: {
bubbled: keyOf({ onBlur: true }),
captured: keyOf({ onBlurCapture: true })
}
},
canPlay: {
phasedRegistrationNames: {
bubbled: keyOf({ onCanPlay: true }),
captured: keyOf({ onCanPlayCapture: true })
}
},
canPlayThrough: {
phasedRegistrationNames: {
bubbled: keyOf({ onCanPlayThrough: true }),
captured: keyOf({ onCanPlayThroughCapture: true })
}
},
click: {
phasedRegistrationNames: {
bubbled: keyOf({ onClick: true }),
captured: keyOf({ onClickCapture: true })
}
},
contextMenu: {
phasedRegistrationNames: {
bubbled: keyOf({ onContextMenu: true }),
captured: keyOf({ onContextMenuCapture: true })
}
},
copy: {
phasedRegistrationNames: {
bubbled: keyOf({ onCopy: true }),
captured: keyOf({ onCopyCapture: true })
}
},
cut: {
phasedRegistrationNames: {
bubbled: keyOf({ onCut: true }),
captured: keyOf({ onCutCapture: true })
}
},
doubleClick: {
phasedRegistrationNames: {
bubbled: keyOf({ onDoubleClick: true }),
captured: keyOf({ onDoubleClickCapture: true })
}
},
drag: {
phasedRegistrationNames: {
bubbled: keyOf({ onDrag: true }),
captured: keyOf({ onDragCapture: true })
}
},
dragEnd: {
phasedRegistrationNames: {
bubbled: keyOf({ onDragEnd: true }),
captured: keyOf({ onDragEndCapture: true })
}
},
dragEnter: {
phasedRegistrationNames: {
bubbled: keyOf({ onDragEnter: true }),
captured: keyOf({ onDragEnterCapture: true })
}
},
dragExit: {
phasedRegistrationNames: {
bubbled: keyOf({ onDragExit: true }),
captured: keyOf({ onDragExitCapture: true })
}
},
dragLeave: {
phasedRegistrationNames: {
bubbled: keyOf({ onDragLeave: true }),
captured: keyOf({ onDragLeaveCapture: true })
}
},
dragOver: {
phasedRegistrationNames: {
bubbled: keyOf({ onDragOver: true }),
captured: keyOf({ onDragOverCapture: true })
}
},
dragStart: {
phasedRegistrationNames: {
bubbled: keyOf({ onDragStart: true }),
captured: keyOf({ onDragStartCapture: true })
}
},
drop: {
phasedRegistrationNames: {
bubbled: keyOf({ onDrop: true }),
captured: keyOf({ onDropCapture: true })
}
},
durationChange: {
phasedRegistrationNames: {
bubbled: keyOf({ onDurationChange: true }),
captured: keyOf({ onDurationChangeCapture: true })
}
},
emptied: {
phasedRegistrationNames: {
bubbled: keyOf({ onEmptied: true }),
captured: keyOf({ onEmptiedCapture: true })
}
},
encrypted: {
phasedRegistrationNames: {
bubbled: keyOf({ onEncrypted: true }),
captured: keyOf({ onEncryptedCapture: true })
}
},
ended: {
phasedRegistrationNames: {
bubbled: keyOf({ onEnded: true }),
captured: keyOf({ onEndedCapture: true })
}
},
error: {
phasedRegistrationNames: {
bubbled: keyOf({ onError: true }),
captured: keyOf({ onErrorCapture: true })
}
},
focus: {
phasedRegistrationNames: {
bubbled: keyOf({ onFocus: true }),
captured: keyOf({ onFocusCapture: true })
}
},
input: {
phasedRegistrationNames: {
bubbled: keyOf({ onInput: true }),
captured: keyOf({ onInputCapture: true })
}
},
keyDown: {
phasedRegistrationNames: {
bubbled: keyOf({ onKeyDown: true }),
captured: keyOf({ onKeyDownCapture: true })
}
},
keyPress: {
phasedRegistrationNames: {
bubbled: keyOf({ onKeyPress: true }),
captured: keyOf({ onKeyPressCapture: true })
}
},
keyUp: {
phasedRegistrationNames: {
bubbled: keyOf({ onKeyUp: true }),
captured: keyOf({ onKeyUpCapture: true })
}
},
load: {
phasedRegistrationNames: {
bubbled: keyOf({ onLoad: true }),
captured: keyOf({ onLoadCapture: true })
}
},
loadedData: {
phasedRegistrationNames: {
bubbled: keyOf({ onLoadedData: true }),
captured: keyOf({ onLoadedDataCapture: true })
}
},
loadedMetadata: {
phasedRegistrationNames: {
bubbled: keyOf({ onLoadedMetadata: true }),
captured: keyOf({ onLoadedMetadataCapture: true })
}
},
loadStart: {
phasedRegistrationNames: {
bubbled: keyOf({ onLoadStart: true }),
captured: keyOf({ onLoadStartCapture: true })
}
},
// Note: We do not allow listening to mouseOver events. Instead, use the
// onMouseEnter/onMouseLeave created by `EnterLeaveEventPlugin`.
mouseDown: {
phasedRegistrationNames: {
bubbled: keyOf({ onMouseDown: true }),
captured: keyOf({ onMouseDownCapture: true })
}
},
mouseMove: {
phasedRegistrationNames: {
bubbled: keyOf({ onMouseMove: true }),
captured: keyOf({ onMouseMoveCapture: true })
}
},
mouseOut: {
phasedRegistrationNames: {
bubbled: keyOf({ onMouseOut: true }),
captured: keyOf({ onMouseOutCapture: true })
}
},
mouseOver: {
phasedRegistrationNames: {
bubbled: keyOf({ onMouseOver: true }),
captured: keyOf({ onMouseOverCapture: true })
}
},
mouseUp: {
phasedRegistrationNames: {
bubbled: keyOf({ onMouseUp: true }),
captured: keyOf({ onMouseUpCapture: true })
}
},
paste: {
phasedRegistrationNames: {
bubbled: keyOf({ onPaste: true }),
captured: keyOf({ onPasteCapture: true })
}
},
pause: {
phasedRegistrationNames: {
bubbled: keyOf({ onPause: true }),
captured: keyOf({ onPauseCapture: true })
}
},
play: {
phasedRegistrationNames: {
bubbled: keyOf({ onPlay: true }),
captured: keyOf({ onPlayCapture: true })
}
},
playing: {
phasedRegistrationNames: {
bubbled: keyOf({ onPlaying: true }),
captured: keyOf({ onPlayingCapture: true })
}
},
progress: {
phasedRegistrationNames: {
bubbled: keyOf({ onProgress: true }),
captured: keyOf({ onProgressCapture: true })
}
},
rateChange: {
phasedRegistrationNames: {
bubbled: keyOf({ onRateChange: true }),
captured: keyOf({ onRateChangeCapture: true })
}
},
reset: {
phasedRegistrationNames: {
bubbled: keyOf({ onReset: true }),
captured: keyOf({ onResetCapture: true })
}
},
scroll: {
phasedRegistrationNames: {
bubbled: keyOf({ onScroll: true }),
captured: keyOf({ onScrollCapture: true })
}
},
seeked: {
phasedRegistrationNames: {
bubbled: keyOf({ onSeeked: true }),
captured: keyOf({ onSeekedCapture: true })
}
},
seeking: {
phasedRegistrationNames: {
bubbled: keyOf({ onSeeking: true }),
captured: keyOf({ onSeekingCapture: true })
}
},
stalled: {
phasedRegistrationNames: {
bubbled: keyOf({ onStalled: true }),
captured: keyOf({ onStalledCapture: true })
}
},
submit: {
phasedRegistrationNames: {
bubbled: keyOf({ onSubmit: true }),
captured: keyOf({ onSubmitCapture: true })
}
},
suspend: {
phasedRegistrationNames: {
bubbled: keyOf({ onSuspend: true }),
captured: keyOf({ onSuspendCapture: true })
}
},
timeUpdate: {
phasedRegistrationNames: {
bubbled: keyOf({ onTimeUpdate: true }),
captured: keyOf({ onTimeUpdateCapture: true })
}
},
touchCancel: {
phasedRegistrationNames: {
bubbled: keyOf({ onTouchCancel: true }),
captured: keyOf({ onTouchCancelCapture: true })
}
},
touchEnd: {
phasedRegistrationNames: {
bubbled: keyOf({ onTouchEnd: true }),
captured: keyOf({ onTouchEndCapture: true })
}
},
touchMove: {
phasedRegistrationNames: {
bubbled: keyOf({ onTouchMove: true }),
captured: keyOf({ onTouchMoveCapture: true })
}
},
touchStart: {
phasedRegistrationNames: {
bubbled: keyOf({ onTouchStart: true }),
captured: keyOf({ onTouchStartCapture: true })
}
},
volumeChange: {
phasedRegistrationNames: {
bubbled: keyOf({ onVolumeChange: true }),
captured: keyOf({ onVolumeChangeCapture: true })
}
},
waiting: {
phasedRegistrationNames: {
bubbled: keyOf({ onWaiting: true }),
captured: keyOf({ onWaitingCapture: true })
}
},
wheel: {
phasedRegistrationNames: {
bubbled: keyOf({ onWheel: true }),
captured: keyOf({ onWheelCapture: true })
}
}
};
var topLevelEventsToDispatchConfig = {
topAbort: eventTypes.abort,
topBlur: eventTypes.blur,
topCanPlay: eventTypes.canPlay,
topCanPlayThrough: eventTypes.canPlayThrough,
topClick: eventTypes.click,
topContextMenu: eventTypes.contextMenu,
topCopy: eventTypes.copy,
topCut: eventTypes.cut,
topDoubleClick: eventTypes.doubleClick,
topDrag: eventTypes.drag,
topDragEnd: eventTypes.dragEnd,
topDragEnter: eventTypes.dragEnter,
topDragExit: eventTypes.dragExit,
topDragLeave: eventTypes.dragLeave,
topDragOver: eventTypes.dragOver,
topDragStart: eventTypes.dragStart,
topDrop: eventTypes.drop,
topDurationChange: eventTypes.durationChange,
topEmptied: eventTypes.emptied,
topEncrypted: eventTypes.encrypted,
topEnded: eventTypes.ended,
topError: eventTypes.error,
topFocus: eventTypes.focus,
topInput: eventTypes.input,
topKeyDown: eventTypes.keyDown,
topKeyPress: eventTypes.keyPress,
topKeyUp: eventTypes.keyUp,
topLoad: eventTypes.load,
topLoadedData: eventTypes.loadedData,
topLoadedMetadata: eventTypes.loadedMetadata,
topLoadStart: eventTypes.loadStart,
topMouseDown: eventTypes.mouseDown,
topMouseMove: eventTypes.mouseMove,
topMouseOut: eventTypes.mouseOut,
topMouseOver: eventTypes.mouseOver,
topMouseUp: eventTypes.mouseUp,
topPaste: eventTypes.paste,
topPause: eventTypes.pause,
topPlay: eventTypes.play,
topPlaying: eventTypes.playing,
topProgress: eventTypes.progress,
topRateChange: eventTypes.rateChange,
topReset: eventTypes.reset,
topScroll: eventTypes.scroll,
topSeeked: eventTypes.seeked,
topSeeking: eventTypes.seeking,
topStalled: eventTypes.stalled,
topSubmit: eventTypes.submit,
topSuspend: eventTypes.suspend,
topTimeUpdate: eventTypes.timeUpdate,
topTouchCancel: eventTypes.touchCancel,
topTouchEnd: eventTypes.touchEnd,
topTouchMove: eventTypes.touchMove,
topTouchStart: eventTypes.touchStart,
topVolumeChange: eventTypes.volumeChange,
topWaiting: eventTypes.waiting,
topWheel: eventTypes.wheel
};
for (var type in topLevelEventsToDispatchConfig) {
topLevelEventsToDispatchConfig[type].dependencies = [type];
}
var ON_CLICK_KEY = keyOf({ onClick: null });
var onClickListeners = {};
var SimpleEventPlugin = {
eventTypes: eventTypes,
/**
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
if (!dispatchConfig) {
return null;
}
var EventConstructor;
switch (topLevelType) {
case topLevelTypes.topAbort:
case topLevelTypes.topCanPlay:
case topLevelTypes.topCanPlayThrough:
case topLevelTypes.topDurationChange:
case topLevelTypes.topEmptied:
case topLevelTypes.topEncrypted:
case topLevelTypes.topEnded:
case topLevelTypes.topError:
case topLevelTypes.topInput:
case topLevelTypes.topLoad:
case topLevelTypes.topLoadedData:
case topLevelTypes.topLoadedMetadata:
case topLevelTypes.topLoadStart:
case topLevelTypes.topPause:
case topLevelTypes.topPlay:
case topLevelTypes.topPlaying:
case topLevelTypes.topProgress:
case topLevelTypes.topRateChange:
case topLevelTypes.topReset:
case topLevelTypes.topSeeked:
case topLevelTypes.topSeeking:
case topLevelTypes.topStalled:
case topLevelTypes.topSubmit:
case topLevelTypes.topSuspend:
case topLevelTypes.topTimeUpdate:
case topLevelTypes.topVolumeChange:
case topLevelTypes.topWaiting:
// HTML Events
// @see http://www.w3.org/TR/html5/index.html#events-0
EventConstructor = SyntheticEvent;
break;
case topLevelTypes.topKeyPress:
// FireFox creates a keypress event for function keys too. This removes
// the unwanted keypress events. Enter is however both printable and
// non-printable. One would expect Tab to be as well (but it isn't).
if (getEventCharCode(nativeEvent) === 0) {
return null;
}
/* falls through */
case topLevelTypes.topKeyDown:
case topLevelTypes.topKeyUp:
EventConstructor = SyntheticKeyboardEvent;
break;
case topLevelTypes.topBlur:
case topLevelTypes.topFocus:
EventConstructor = SyntheticFocusEvent;
break;
case topLevelTypes.topClick:
// Firefox creates a click event on right mouse clicks. This removes the
// unwanted click events.
if (nativeEvent.button === 2) {
return null;
}
/* falls through */
case topLevelTypes.topContextMenu:
case topLevelTypes.topDoubleClick:
case topLevelTypes.topMouseDown:
case topLevelTypes.topMouseMove:
case topLevelTypes.topMouseOut:
case topLevelTypes.topMouseOver:
case topLevelTypes.topMouseUp:
EventConstructor = SyntheticMouseEvent;
break;
case topLevelTypes.topDrag:
case topLevelTypes.topDragEnd:
case topLevelTypes.topDragEnter:
case topLevelTypes.topDragExit:
case topLevelTypes.topDragLeave:
case topLevelTypes.topDragOver:
case topLevelTypes.topDragStart:
case topLevelTypes.topDrop:
EventConstructor = SyntheticDragEvent;
break;
case topLevelTypes.topTouchCancel:
case topLevelTypes.topTouchEnd:
case topLevelTypes.topTouchMove:
case topLevelTypes.topTouchStart:
EventConstructor = SyntheticTouchEvent;
break;
case topLevelTypes.topScroll:
EventConstructor = SyntheticUIEvent;
break;
case topLevelTypes.topWheel:
EventConstructor = SyntheticWheelEvent;
break;
case topLevelTypes.topCopy:
case topLevelTypes.topCut:
case topLevelTypes.topPaste:
EventConstructor = SyntheticClipboardEvent;
break;
}
!EventConstructor ? process.env.NODE_ENV !== 'production' ? invariant(false, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType) : invariant(false) : undefined;
var event = EventConstructor.getPooled(dispatchConfig, topLevelTargetID, nativeEvent, nativeEventTarget);
EventPropagators.accumulateTwoPhaseDispatches(event);
return event;
},
didPutListener: function (id, registrationName, listener) {
// Mobile Safari does not fire properly bubble click events on
// non-interactive elements, which means delegated click listeners do not
// fire. The workaround for this bug involves attaching an empty click
// listener on the target node.
if (registrationName === ON_CLICK_KEY) {
var node = ReactMount.getNode(id);
if (!onClickListeners[id]) {
onClickListeners[id] = EventListener.listen(node, 'click', emptyFunction);
}
}
},
willDeleteListener: function (id, registrationName) {
if (registrationName === ON_CLICK_KEY) {
onClickListeners[id].remove();
delete onClickListeners[id];
}
}
};
module.exports = SimpleEventPlugin;
}).call(this,require('_process'))
},{"./EventConstants":21,"./EventPropagators":25,"./ReactMount":72,"./SyntheticClipboardEvent":96,"./SyntheticDragEvent":98,"./SyntheticEvent":99,"./SyntheticFocusEvent":100,"./SyntheticKeyboardEvent":102,"./SyntheticMouseEvent":103,"./SyntheticTouchEvent":104,"./SyntheticUIEvent":105,"./SyntheticWheelEvent":106,"./getEventCharCode":118,"_process":164,"fbjs/lib/EventListener":136,"fbjs/lib/emptyFunction":143,"fbjs/lib/invariant":151,"fbjs/lib/keyOf":155}],96:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticClipboardEvent
* @typechecks static-only
*/
'use strict';
var SyntheticEvent = require('./SyntheticEvent');
/**
* @interface Event
* @see http://www.w3.org/TR/clipboard-apis/
*/
var ClipboardEventInterface = {
clipboardData: function (event) {
return 'clipboardData' in event ? event.clipboardData : window.clipboardData;
}
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface);
module.exports = SyntheticClipboardEvent;
},{"./SyntheticEvent":99}],97:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticCompositionEvent
* @typechecks static-only
*/
'use strict';
var SyntheticEvent = require('./SyntheticEvent');
/**
* @interface Event
* @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents
*/
var CompositionEventInterface = {
data: null
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
function SyntheticCompositionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticEvent.augmentClass(SyntheticCompositionEvent, CompositionEventInterface);
module.exports = SyntheticCompositionEvent;
},{"./SyntheticEvent":99}],98:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticDragEvent
* @typechecks static-only
*/
'use strict';
var SyntheticMouseEvent = require('./SyntheticMouseEvent');
/**
* @interface DragEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var DragEventInterface = {
dataTransfer: null
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface);
module.exports = SyntheticDragEvent;
},{"./SyntheticMouseEvent":103}],99:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticEvent
* @typechecks static-only
*/
'use strict';
var PooledClass = require('./PooledClass');
var assign = require('./Object.assign');
var emptyFunction = require('fbjs/lib/emptyFunction');
var warning = require('fbjs/lib/warning');
/**
* @interface Event
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var EventInterface = {
type: null,
// currentTarget is set when dispatching; no use in copying it here
currentTarget: emptyFunction.thatReturnsNull,
eventPhase: null,
bubbles: null,
cancelable: null,
timeStamp: function (event) {
return event.timeStamp || Date.now();
},
defaultPrevented: null,
isTrusted: null
};
/**
* Synthetic events are dispatched by event plugins, typically in response to a
* top-level event delegation handler.
*
* These systems should generally use pooling to reduce the frequency of garbage
* collection. The system should check `isPersistent` to determine whether the
* event should be released into the pool after being dispatched. Users that
* need a persisted event should invoke `persist`.
*
* Synthetic events (and subclasses) implement the DOM Level 3 Events API by
* normalizing browser quirks. Subclasses do not necessarily have to implement a
* DOM interface; custom application-specific events can also subclass this.
*
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
*/
function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
this.dispatchConfig = dispatchConfig;
this.dispatchMarker = dispatchMarker;
this.nativeEvent = nativeEvent;
this.target = nativeEventTarget;
this.currentTarget = nativeEventTarget;
var Interface = this.constructor.Interface;
for (var propName in Interface) {
if (!Interface.hasOwnProperty(propName)) {
continue;
}
var normalize = Interface[propName];
if (normalize) {
this[propName] = normalize(nativeEvent);
} else {
this[propName] = nativeEvent[propName];
}
}
var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
if (defaultPrevented) {
this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
} else {
this.isDefaultPrevented = emptyFunction.thatReturnsFalse;
}
this.isPropagationStopped = emptyFunction.thatReturnsFalse;
}
assign(SyntheticEvent.prototype, {
preventDefault: function () {
this.defaultPrevented = true;
var event = this.nativeEvent;
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(event, 'This synthetic event is reused for performance reasons. If you\'re ' + 'seeing this, you\'re calling `preventDefault` on a ' + 'released/nullified synthetic event. This is a no-op. See ' + 'https://fb.me/react-event-pooling for more information.') : undefined;
}
if (!event) {
return;
}
if (event.preventDefault) {
event.preventDefault();
} else {
event.returnValue = false;
}
this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
},
stopPropagation: function () {
var event = this.nativeEvent;
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(event, 'This synthetic event is reused for performance reasons. If you\'re ' + 'seeing this, you\'re calling `stopPropagation` on a ' + 'released/nullified synthetic event. This is a no-op. See ' + 'https://fb.me/react-event-pooling for more information.') : undefined;
}
if (!event) {
return;
}
if (event.stopPropagation) {
event.stopPropagation();
} else {
event.cancelBubble = true;
}
this.isPropagationStopped = emptyFunction.thatReturnsTrue;
},
/**
* We release all dispatched `SyntheticEvent`s after each event loop, adding
* them back into the pool. This allows a way to hold onto a reference that
* won't be added back into the pool.
*/
persist: function () {
this.isPersistent = emptyFunction.thatReturnsTrue;
},
/**
* Checks if this event should be released back into the pool.
*
* @return {boolean} True if this should not be released, false otherwise.
*/
isPersistent: emptyFunction.thatReturnsFalse,
/**
* `PooledClass` looks for `destructor` on each instance it releases.
*/
destructor: function () {
var Interface = this.constructor.Interface;
for (var propName in Interface) {
this[propName] = null;
}
this.dispatchConfig = null;
this.dispatchMarker = null;
this.nativeEvent = null;
}
});
SyntheticEvent.Interface = EventInterface;
/**
* Helper to reduce boilerplate when creating subclasses.
*
* @param {function} Class
* @param {?object} Interface
*/
SyntheticEvent.augmentClass = function (Class, Interface) {
var Super = this;
var prototype = Object.create(Super.prototype);
assign(prototype, Class.prototype);
Class.prototype = prototype;
Class.prototype.constructor = Class;
Class.Interface = assign({}, Super.Interface, Interface);
Class.augmentClass = Super.augmentClass;
PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler);
};
PooledClass.addPoolingTo(SyntheticEvent, PooledClass.fourArgumentPooler);
module.exports = SyntheticEvent;
}).call(this,require('_process'))
},{"./Object.assign":29,"./PooledClass":30,"_process":164,"fbjs/lib/emptyFunction":143,"fbjs/lib/warning":162}],100:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticFocusEvent
* @typechecks static-only
*/
'use strict';
var SyntheticUIEvent = require('./SyntheticUIEvent');
/**
* @interface FocusEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var FocusEventInterface = {
relatedTarget: null
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface);
module.exports = SyntheticFocusEvent;
},{"./SyntheticUIEvent":105}],101:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticInputEvent
* @typechecks static-only
*/
'use strict';
var SyntheticEvent = require('./SyntheticEvent');
/**
* @interface Event
* @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105
* /#events-inputevents
*/
var InputEventInterface = {
data: null
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
function SyntheticInputEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticEvent.augmentClass(SyntheticInputEvent, InputEventInterface);
module.exports = SyntheticInputEvent;
},{"./SyntheticEvent":99}],102:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticKeyboardEvent
* @typechecks static-only
*/
'use strict';
var SyntheticUIEvent = require('./SyntheticUIEvent');
var getEventCharCode = require('./getEventCharCode');
var getEventKey = require('./getEventKey');
var getEventModifierState = require('./getEventModifierState');
/**
* @interface KeyboardEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var KeyboardEventInterface = {
key: getEventKey,
location: null,
ctrlKey: null,
shiftKey: null,
altKey: null,
metaKey: null,
repeat: null,
locale: null,
getModifierState: getEventModifierState,
// Legacy Interface
charCode: function (event) {
// `charCode` is the result of a KeyPress event and represents the value of
// the actual printable character.
// KeyPress is deprecated, but its replacement is not yet final and not
// implemented in any major browser. Only KeyPress has charCode.
if (event.type === 'keypress') {
return getEventCharCode(event);
}
return 0;
},
keyCode: function (event) {
// `keyCode` is the result of a KeyDown/Up event and represents the value of
// physical keyboard key.
// The actual meaning of the value depends on the users' keyboard layout
// which cannot be detected. Assuming that it is a US keyboard layout
// provides a surprisingly accurate mapping for US and European users.
// Due to this, it is left to the user to implement at this time.
if (event.type === 'keydown' || event.type === 'keyup') {
return event.keyCode;
}
return 0;
},
which: function (event) {
// `which` is an alias for either `keyCode` or `charCode` depending on the
// type of the event.
if (event.type === 'keypress') {
return getEventCharCode(event);
}
if (event.type === 'keydown' || event.type === 'keyup') {
return event.keyCode;
}
return 0;
}
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface);
module.exports = SyntheticKeyboardEvent;
},{"./SyntheticUIEvent":105,"./getEventCharCode":118,"./getEventKey":119,"./getEventModifierState":120}],103:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticMouseEvent
* @typechecks static-only
*/
'use strict';
var SyntheticUIEvent = require('./SyntheticUIEvent');
var ViewportMetrics = require('./ViewportMetrics');
var getEventModifierState = require('./getEventModifierState');
/**
* @interface MouseEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var MouseEventInterface = {
screenX: null,
screenY: null,
clientX: null,
clientY: null,
ctrlKey: null,
shiftKey: null,
altKey: null,
metaKey: null,
getModifierState: getEventModifierState,
button: function (event) {
// Webkit, Firefox, IE9+
// which: 1 2 3
// button: 0 1 2 (standard)
var button = event.button;
if ('which' in event) {
return button;
}
// IE<9
// which: undefined
// button: 0 0 0
// button: 1 4 2 (onmouseup)
return button === 2 ? 2 : button === 4 ? 1 : 0;
},
buttons: null,
relatedTarget: function (event) {
return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement);
},
// "Proprietary" Interface.
pageX: function (event) {
return 'pageX' in event ? event.pageX : event.clientX + ViewportMetrics.currentScrollLeft;
},
pageY: function (event) {
return 'pageY' in event ? event.pageY : event.clientY + ViewportMetrics.currentScrollTop;
}
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface);
module.exports = SyntheticMouseEvent;
},{"./SyntheticUIEvent":105,"./ViewportMetrics":108,"./getEventModifierState":120}],104:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticTouchEvent
* @typechecks static-only
*/
'use strict';
var SyntheticUIEvent = require('./SyntheticUIEvent');
var getEventModifierState = require('./getEventModifierState');
/**
* @interface TouchEvent
* @see http://www.w3.org/TR/touch-events/
*/
var TouchEventInterface = {
touches: null,
targetTouches: null,
changedTouches: null,
altKey: null,
metaKey: null,
ctrlKey: null,
shiftKey: null,
getModifierState: getEventModifierState
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface);
module.exports = SyntheticTouchEvent;
},{"./SyntheticUIEvent":105,"./getEventModifierState":120}],105:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticUIEvent
* @typechecks static-only
*/
'use strict';
var SyntheticEvent = require('./SyntheticEvent');
var getEventTarget = require('./getEventTarget');
/**
* @interface UIEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var UIEventInterface = {
view: function (event) {
if (event.view) {
return event.view;
}
var target = getEventTarget(event);
if (target != null && target.window === target) {
// target is a window object
return target;
}
var doc = target.ownerDocument;
// TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
if (doc) {
return doc.defaultView || doc.parentWindow;
} else {
return window;
}
},
detail: function (event) {
return event.detail || 0;
}
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticEvent}
*/
function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface);
module.exports = SyntheticUIEvent;
},{"./SyntheticEvent":99,"./getEventTarget":121}],106:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticWheelEvent
* @typechecks static-only
*/
'use strict';
var SyntheticMouseEvent = require('./SyntheticMouseEvent');
/**
* @interface WheelEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var WheelEventInterface = {
deltaX: function (event) {
return 'deltaX' in event ? event.deltaX :
// Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
'wheelDeltaX' in event ? -event.wheelDeltaX : 0;
},
deltaY: function (event) {
return 'deltaY' in event ? event.deltaY :
// Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
'wheelDeltaY' in event ? -event.wheelDeltaY :
// Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
'wheelDelta' in event ? -event.wheelDelta : 0;
},
deltaZ: null,
// Browsers without "deltaMode" is reporting in raw wheel delta where one
// notch on the scroll is always +/- 120, roughly equivalent to pixels.
// A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or
// ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size.
deltaMode: null
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticMouseEvent}
*/
function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface);
module.exports = SyntheticWheelEvent;
},{"./SyntheticMouseEvent":103}],107:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule Transaction
*/
'use strict';
var invariant = require('fbjs/lib/invariant');
/**
* `Transaction` creates a black box that is able to wrap any method such that
* certain invariants are maintained before and after the method is invoked
* (Even if an exception is thrown while invoking the wrapped method). Whoever
* instantiates a transaction can provide enforcers of the invariants at
* creation time. The `Transaction` class itself will supply one additional
* automatic invariant for you - the invariant that any transaction instance
* should not be run while it is already being run. You would typically create a
* single instance of a `Transaction` for reuse multiple times, that potentially
* is used to wrap several different methods. Wrappers are extremely simple -
* they only require implementing two methods.
*
* <pre>
* wrappers (injected at creation time)
* + +
* | |
* +-----------------|--------|--------------+
* | v | |
* | +---------------+ | |
* | +--| wrapper1 |---|----+ |
* | | +---------------+ v | |
* | | +-------------+ | |
* | | +----| wrapper2 |--------+ |
* | | | +-------------+ | | |
* | | | | | |
* | v v v v | wrapper
* | +---+ +---+ +---------+ +---+ +---+ | invariants
* perform(anyMethod) | | | | | | | | | | | | maintained
* +----------------->|-|---|-|---|-->|anyMethod|---|---|-|---|-|-------->
* | | | | | | | | | | | |
* | | | | | | | | | | | |
* | | | | | | | | | | | |
* | +---+ +---+ +---------+ +---+ +---+ |
* | initialize close |
* +-----------------------------------------+
* </pre>
*
* Use cases:
* - Preserving the input selection ranges before/after reconciliation.
* Restoring selection even in the event of an unexpected error.
* - Deactivating events while rearranging the DOM, preventing blurs/focuses,
* while guaranteeing that afterwards, the event system is reactivated.
* - Flushing a queue of collected DOM mutations to the main UI thread after a
* reconciliation takes place in a worker thread.
* - Invoking any collected `componentDidUpdate` callbacks after rendering new
* content.
* - (Future use case): Wrapping particular flushes of the `ReactWorker` queue
* to preserve the `scrollTop` (an automatic scroll aware DOM).
* - (Future use case): Layout calculations before and after DOM updates.
*
* Transactional plugin API:
* - A module that has an `initialize` method that returns any precomputation.
* - and a `close` method that accepts the precomputation. `close` is invoked
* when the wrapped process is completed, or has failed.
*
* @param {Array<TransactionalWrapper>} transactionWrapper Wrapper modules
* that implement `initialize` and `close`.
* @return {Transaction} Single transaction for reuse in thread.
*
* @class Transaction
*/
var Mixin = {
/**
* Sets up this instance so that it is prepared for collecting metrics. Does
* so such that this setup method may be used on an instance that is already
* initialized, in a way that does not consume additional memory upon reuse.
* That can be useful if you decide to make your subclass of this mixin a
* "PooledClass".
*/
reinitializeTransaction: function () {
this.transactionWrappers = this.getTransactionWrappers();
if (this.wrapperInitData) {
this.wrapperInitData.length = 0;
} else {
this.wrapperInitData = [];
}
this._isInTransaction = false;
},
_isInTransaction: false,
/**
* @abstract
* @return {Array<TransactionWrapper>} Array of transaction wrappers.
*/
getTransactionWrappers: null,
isInTransaction: function () {
return !!this._isInTransaction;
},
/**
* Executes the function within a safety window. Use this for the top level
* methods that result in large amounts of computation/mutations that would
* need to be safety checked. The optional arguments helps prevent the need
* to bind in many cases.
*
* @param {function} method Member of scope to call.
* @param {Object} scope Scope to invoke from.
* @param {Object?=} a Argument to pass to the method.
* @param {Object?=} b Argument to pass to the method.
* @param {Object?=} c Argument to pass to the method.
* @param {Object?=} d Argument to pass to the method.
* @param {Object?=} e Argument to pass to the method.
* @param {Object?=} f Argument to pass to the method.
*
* @return {*} Return value from `method`.
*/
perform: function (method, scope, a, b, c, d, e, f) {
!!this.isInTransaction() ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Transaction.perform(...): Cannot initialize a transaction when there ' + 'is already an outstanding transaction.') : invariant(false) : undefined;
var errorThrown;
var ret;
try {
this._isInTransaction = true;
// Catching errors makes debugging more difficult, so we start with
// errorThrown set to true before setting it to false after calling
// close -- if it's still set to true in the finally block, it means
// one of these calls threw.
errorThrown = true;
this.initializeAll(0);
ret = method.call(scope, a, b, c, d, e, f);
errorThrown = false;
} finally {
try {
if (errorThrown) {
// If `method` throws, prefer to show that stack trace over any thrown
// by invoking `closeAll`.
try {
this.closeAll(0);
} catch (err) {}
} else {
// Since `method` didn't throw, we don't want to silence the exception
// here.
this.closeAll(0);
}
} finally {
this._isInTransaction = false;
}
}
return ret;
},
initializeAll: function (startIndex) {
var transactionWrappers = this.transactionWrappers;
for (var i = startIndex; i < transactionWrappers.length; i++) {
var wrapper = transactionWrappers[i];
try {
// Catching errors makes debugging more difficult, so we start with the
// OBSERVED_ERROR state before overwriting it with the real return value
// of initialize -- if it's still set to OBSERVED_ERROR in the finally
// block, it means wrapper.initialize threw.
this.wrapperInitData[i] = Transaction.OBSERVED_ERROR;
this.wrapperInitData[i] = wrapper.initialize ? wrapper.initialize.call(this) : null;
} finally {
if (this.wrapperInitData[i] === Transaction.OBSERVED_ERROR) {
// The initializer for wrapper i threw an error; initialize the
// remaining wrappers but silence any exceptions from them to ensure
// that the first error is the one to bubble up.
try {
this.initializeAll(i + 1);
} catch (err) {}
}
}
}
},
/**
* Invokes each of `this.transactionWrappers.close[i]` functions, passing into
* them the respective return values of `this.transactionWrappers.init[i]`
* (`close`rs that correspond to initializers that failed will not be
* invoked).
*/
closeAll: function (startIndex) {
!this.isInTransaction() ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Transaction.closeAll(): Cannot close transaction when none are open.') : invariant(false) : undefined;
var transactionWrappers = this.transactionWrappers;
for (var i = startIndex; i < transactionWrappers.length; i++) {
var wrapper = transactionWrappers[i];
var initData = this.wrapperInitData[i];
var errorThrown;
try {
// Catching errors makes debugging more difficult, so we start with
// errorThrown set to true before setting it to false after calling
// close -- if it's still set to true in the finally block, it means
// wrapper.close threw.
errorThrown = true;
if (initData !== Transaction.OBSERVED_ERROR && wrapper.close) {
wrapper.close.call(this, initData);
}
errorThrown = false;
} finally {
if (errorThrown) {
// The closer for wrapper i threw an error; close the remaining
// wrappers but silence any exceptions from them to ensure that the
// first error is the one to bubble up.
try {
this.closeAll(i + 1);
} catch (e) {}
}
}
}
this.wrapperInitData.length = 0;
}
};
var Transaction = {
Mixin: Mixin,
/**
* Token to look for to determine if an error occurred.
*/
OBSERVED_ERROR: {}
};
module.exports = Transaction;
}).call(this,require('_process'))
},{"_process":164,"fbjs/lib/invariant":151}],108:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ViewportMetrics
*/
'use strict';
var ViewportMetrics = {
currentScrollLeft: 0,
currentScrollTop: 0,
refreshScrollValues: function (scrollPosition) {
ViewportMetrics.currentScrollLeft = scrollPosition.x;
ViewportMetrics.currentScrollTop = scrollPosition.y;
}
};
module.exports = ViewportMetrics;
},{}],109:[function(require,module,exports){
(function (process){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule accumulateInto
*/
'use strict';
var invariant = require('fbjs/lib/invariant');
/**
*
* Accumulates items that must not be null or undefined into the first one. This
* is used to conserve memory by avoiding array allocations, and thus sacrifices
* API cleanness. Since `current` can be null before being passed in and not
* null after this function, make sure to assign it back to `current`:
*
* `a = accumulateInto(a, b);`
*
* This API should be sparingly used. Try `accumulate` for something cleaner.
*
* @return {*|array<*>} An accumulation of items.
*/
function accumulateInto(current, next) {
!(next != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : invariant(false) : undefined;
if (current == null) {
return next;
}
// Both are not empty. Warning: Never call x.concat(y) when you are not
// certain that x is an Array (x could be a string with concat method).
var currentIsArray = Array.isArray(current);
var nextIsArray = Array.isArray(next);
if (currentIsArray && nextIsArray) {
current.push.apply(current, next);
return current;
}
if (currentIsArray) {
current.push(next);
return current;
}
if (nextIsArray) {
// A bit too dangerous to mutate `next`.
return [current].concat(next);
}
return [current, next];
}
module.exports = accumulateInto;
}).call(this,require('_process'))
},{"_process":164,"fbjs/lib/invariant":151}],110:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule adler32
*/
'use strict';
var MOD = 65521;
// adler32 is not cryptographically strong, and is only used to sanity check that
// markup generated on the server matches the markup generated on the client.
// This implementation (a modified version of the SheetJS version) has been optimized
// for our use case, at the expense of conforming to the adler32 specification
// for non-ascii inputs.
function adler32(data) {
var a = 1;
var b = 0;
var i = 0;
var l = data.length;
var m = l & ~0x3;
while (i < m) {
for (; i < Math.min(i + 4096, m); i += 4) {
b += (a += data.charCodeAt(i)) + (a += data.charCodeAt(i + 1)) + (a += data.charCodeAt(i + 2)) + (a += data.charCodeAt(i + 3));
}
a %= MOD;
b %= MOD;
}
for (; i < l; i++) {
b += a += data.charCodeAt(i);
}
a %= MOD;
b %= MOD;
return a | b << 16;
}
module.exports = adler32;
},{}],111:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule canDefineProperty
*/
'use strict';
var canDefineProperty = false;
if (process.env.NODE_ENV !== 'production') {
try {
Object.defineProperty({}, 'x', { get: function () {} });
canDefineProperty = true;
} catch (x) {
// IE will fail on defineProperty
}
}
module.exports = canDefineProperty;
}).call(this,require('_process'))
},{"_process":164}],112:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule dangerousStyleValue
* @typechecks static-only
*/
'use strict';
var CSSProperty = require('./CSSProperty');
var isUnitlessNumber = CSSProperty.isUnitlessNumber;
/**
* Convert a value into the proper css writable value. The style name `name`
* should be logical (no hyphens), as specified
* in `CSSProperty.isUnitlessNumber`.
*
* @param {string} name CSS property name such as `topMargin`.
* @param {*} value CSS property value such as `10px`.
* @return {string} Normalized style value with dimensions applied.
*/
function dangerousStyleValue(name, value) {
// Note that we've removed escapeTextForBrowser() calls here since the
// whole string will be escaped when the attribute is injected into
// the markup. If you provide unsafe user data here they can inject
// arbitrary CSS which may be problematic (I couldn't repro this):
// https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
// http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
// This is not an XSS hole but instead a potential CSS injection issue
// which has lead to a greater discussion about how we're going to
// trust URLs moving forward. See #2115901
var isEmpty = value == null || typeof value === 'boolean' || value === '';
if (isEmpty) {
return '';
}
var isNonNumeric = isNaN(value);
if (isNonNumeric || value === 0 || isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) {
return '' + value; // cast to string
}
if (typeof value === 'string') {
value = value.trim();
}
return value + 'px';
}
module.exports = dangerousStyleValue;
},{"./CSSProperty":10}],113:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule deprecated
*/
'use strict';
var assign = require('./Object.assign');
var warning = require('fbjs/lib/warning');
/**
* This will log a single deprecation notice per function and forward the call
* on to the new API.
*
* @param {string} fnName The name of the function
* @param {string} newModule The module that fn will exist in
* @param {string} newPackage The module that fn will exist in
* @param {*} ctx The context this forwarded call should run in
* @param {function} fn The function to forward on to
* @return {function} The function that will warn once and then call fn
*/
function deprecated(fnName, newModule, newPackage, ctx, fn) {
var warned = false;
if (process.env.NODE_ENV !== 'production') {
var newFn = function () {
process.env.NODE_ENV !== 'production' ? warning(warned,
// Require examples in this string must be split to prevent React's
// build tools from mistaking them for real requires.
// Otherwise the build tools will attempt to build a '%s' module.
'React.%s is deprecated. Please use %s.%s from require' + '(\'%s\') ' + 'instead.', fnName, newModule, fnName, newPackage) : undefined;
warned = true;
return fn.apply(ctx, arguments);
};
// We need to make sure all properties of the original fn are copied over.
// In particular, this is needed to support PropTypes
return assign(newFn, fn);
}
return fn;
}
module.exports = deprecated;
}).call(this,require('_process'))
},{"./Object.assign":29,"_process":164,"fbjs/lib/warning":162}],114:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule escapeTextContentForBrowser
*/
'use strict';
var ESCAPE_LOOKUP = {
'&': '&',
'>': '>',
'<': '<',
'"': '"',
'\'': '''
};
var ESCAPE_REGEX = /[&><"']/g;
function escaper(match) {
return ESCAPE_LOOKUP[match];
}
/**
* Escapes text to prevent scripting attacks.
*
* @param {*} text Text value to escape.
* @return {string} An escaped string.
*/
function escapeTextContentForBrowser(text) {
return ('' + text).replace(ESCAPE_REGEX, escaper);
}
module.exports = escapeTextContentForBrowser;
},{}],115:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule findDOMNode
* @typechecks static-only
*/
'use strict';
var ReactCurrentOwner = require('./ReactCurrentOwner');
var ReactInstanceMap = require('./ReactInstanceMap');
var ReactMount = require('./ReactMount');
var invariant = require('fbjs/lib/invariant');
var warning = require('fbjs/lib/warning');
/**
* Returns the DOM node rendered by this element.
*
* @param {ReactComponent|DOMElement} componentOrElement
* @return {?DOMElement} The root node of this element.
*/
function findDOMNode(componentOrElement) {
if (process.env.NODE_ENV !== 'production') {
var owner = ReactCurrentOwner.current;
if (owner !== null) {
process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing getDOMNode or findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : undefined;
owner._warnedAboutRefsInRender = true;
}
}
if (componentOrElement == null) {
return null;
}
if (componentOrElement.nodeType === 1) {
return componentOrElement;
}
if (ReactInstanceMap.has(componentOrElement)) {
return ReactMount.getNodeFromInstance(componentOrElement);
}
!(componentOrElement.render == null || typeof componentOrElement.render !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findDOMNode was called on an unmounted component.') : invariant(false) : undefined;
!false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)', Object.keys(componentOrElement)) : invariant(false) : undefined;
}
module.exports = findDOMNode;
}).call(this,require('_process'))
},{"./ReactCurrentOwner":41,"./ReactInstanceMap":69,"./ReactMount":72,"_process":164,"fbjs/lib/invariant":151,"fbjs/lib/warning":162}],116:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule flattenChildren
*/
'use strict';
var traverseAllChildren = require('./traverseAllChildren');
var warning = require('fbjs/lib/warning');
/**
* @param {function} traverseContext Context passed through traversal.
* @param {?ReactComponent} child React child component.
* @param {!string} name String name of key path to child.
*/
function flattenSingleChildIntoContext(traverseContext, child, name) {
// We found a component instance.
var result = traverseContext;
var keyUnique = result[name] === undefined;
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', name) : undefined;
}
if (keyUnique && child != null) {
result[name] = child;
}
}
/**
* Flattens children that are typically specified as `props.children`. Any null
* children will not be included in the resulting object.
* @return {!object} flattened children keyed by name.
*/
function flattenChildren(children) {
if (children == null) {
return children;
}
var result = {};
traverseAllChildren(children, flattenSingleChildIntoContext, result);
return result;
}
module.exports = flattenChildren;
}).call(this,require('_process'))
},{"./traverseAllChildren":134,"_process":164,"fbjs/lib/warning":162}],117:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule forEachAccumulated
*/
'use strict';
/**
* @param {array} arr an "accumulation" of items which is either an Array or
* a single item. Useful when paired with the `accumulate` module. This is a
* simple utility that allows us to reason about a collection of items, but
* handling the case when there is exactly one item (and we do not need to
* allocate an array).
*/
var forEachAccumulated = function (arr, cb, scope) {
if (Array.isArray(arr)) {
arr.forEach(cb, scope);
} else if (arr) {
cb.call(scope, arr);
}
};
module.exports = forEachAccumulated;
},{}],118:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule getEventCharCode
* @typechecks static-only
*/
'use strict';
/**
* `charCode` represents the actual "character code" and is safe to use with
* `String.fromCharCode`. As such, only keys that correspond to printable
* characters produce a valid `charCode`, the only exception to this is Enter.
* The Tab-key is considered non-printable and does not have a `charCode`,
* presumably because it does not produce a tab-character in browsers.
*
* @param {object} nativeEvent Native browser event.
* @return {number} Normalized `charCode` property.
*/
function getEventCharCode(nativeEvent) {
var charCode;
var keyCode = nativeEvent.keyCode;
if ('charCode' in nativeEvent) {
charCode = nativeEvent.charCode;
// FF does not set `charCode` for the Enter-key, check against `keyCode`.
if (charCode === 0 && keyCode === 13) {
charCode = 13;
}
} else {
// IE8 does not implement `charCode`, but `keyCode` has the correct value.
charCode = keyCode;
}
// Some non-printable keys are reported in `charCode`/`keyCode`, discard them.
// Must not discard the (non-)printable Enter-key.
if (charCode >= 32 || charCode === 13) {
return charCode;
}
return 0;
}
module.exports = getEventCharCode;
},{}],119:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule getEventKey
* @typechecks static-only
*/
'use strict';
var getEventCharCode = require('./getEventCharCode');
/**
* Normalization of deprecated HTML5 `key` values
* @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
*/
var normalizeKey = {
'Esc': 'Escape',
'Spacebar': ' ',
'Left': 'ArrowLeft',
'Up': 'ArrowUp',
'Right': 'ArrowRight',
'Down': 'ArrowDown',
'Del': 'Delete',
'Win': 'OS',
'Menu': 'ContextMenu',
'Apps': 'ContextMenu',
'Scroll': 'ScrollLock',
'MozPrintableKey': 'Unidentified'
};
/**
* Translation from legacy `keyCode` to HTML5 `key`
* Only special keys supported, all others depend on keyboard layout or browser
* @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
*/
var translateToKey = {
8: 'Backspace',
9: 'Tab',
12: 'Clear',
13: 'Enter',
16: 'Shift',
17: 'Control',
18: 'Alt',
19: 'Pause',
20: 'CapsLock',
27: 'Escape',
32: ' ',
33: 'PageUp',
34: 'PageDown',
35: 'End',
36: 'Home',
37: 'ArrowLeft',
38: 'ArrowUp',
39: 'ArrowRight',
40: 'ArrowDown',
45: 'Insert',
46: 'Delete',
112: 'F1', 113: 'F2', 114: 'F3', 115: 'F4', 116: 'F5', 117: 'F6',
118: 'F7', 119: 'F8', 120: 'F9', 121: 'F10', 122: 'F11', 123: 'F12',
144: 'NumLock',
145: 'ScrollLock',
224: 'Meta'
};
/**
* @param {object} nativeEvent Native browser event.
* @return {string} Normalized `key` property.
*/
function getEventKey(nativeEvent) {
if (nativeEvent.key) {
// Normalize inconsistent values reported by browsers due to
// implementations of a working draft specification.
// FireFox implements `key` but returns `MozPrintableKey` for all
// printable characters (normalized to `Unidentified`), ignore it.
var key = normalizeKey[nativeEvent.key] || nativeEvent.key;
if (key !== 'Unidentified') {
return key;
}
}
// Browser does not implement `key`, polyfill as much of it as we can.
if (nativeEvent.type === 'keypress') {
var charCode = getEventCharCode(nativeEvent);
// The enter-key is technically both printable and non-printable and can
// thus be captured by `keypress`, no other non-printable key should.
return charCode === 13 ? 'Enter' : String.fromCharCode(charCode);
}
if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
// While user keyboard layout determines the actual meaning of each
// `keyCode` value, almost all function keys have a universal value.
return translateToKey[nativeEvent.keyCode] || 'Unidentified';
}
return '';
}
module.exports = getEventKey;
},{"./getEventCharCode":118}],120:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule getEventModifierState
* @typechecks static-only
*/
'use strict';
/**
* Translation from modifier key to the associated property in the event.
* @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
*/
var modifierKeyToProp = {
'Alt': 'altKey',
'Control': 'ctrlKey',
'Meta': 'metaKey',
'Shift': 'shiftKey'
};
// IE8 does not implement getModifierState so we simply map it to the only
// modifier keys exposed by the event itself, does not support Lock-keys.
// Currently, all major browsers except Chrome seems to support Lock-keys.
function modifierStateGetter(keyArg) {
var syntheticEvent = this;
var nativeEvent = syntheticEvent.nativeEvent;
if (nativeEvent.getModifierState) {
return nativeEvent.getModifierState(keyArg);
}
var keyProp = modifierKeyToProp[keyArg];
return keyProp ? !!nativeEvent[keyProp] : false;
}
function getEventModifierState(nativeEvent) {
return modifierStateGetter;
}
module.exports = getEventModifierState;
},{}],121:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule getEventTarget
* @typechecks static-only
*/
'use strict';
/**
* Gets the target node from a native browser event by accounting for
* inconsistencies in browser DOM APIs.
*
* @param {object} nativeEvent Native browser event.
* @return {DOMEventTarget} Target node.
*/
function getEventTarget(nativeEvent) {
var target = nativeEvent.target || nativeEvent.srcElement || window;
// Safari may fire events on text nodes (Node.TEXT_NODE is 3).
// @see http://www.quirksmode.org/js/events_properties.html
return target.nodeType === 3 ? target.parentNode : target;
}
module.exports = getEventTarget;
},{}],122:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule getIteratorFn
* @typechecks static-only
*/
'use strict';
/* global Symbol */
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
/**
* Returns the iterator method function contained on the iterable object.
*
* Be sure to invoke the function with the iterable as context:
*
* var iteratorFn = getIteratorFn(myIterable);
* if (iteratorFn) {
* var iterator = iteratorFn.call(myIterable);
* ...
* }
*
* @param {?object} maybeIterable
* @return {?function}
*/
function getIteratorFn(maybeIterable) {
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
if (typeof iteratorFn === 'function') {
return iteratorFn;
}
}
module.exports = getIteratorFn;
},{}],123:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule getNodeForCharacterOffset
*/
'use strict';
/**
* Given any node return the first leaf node without children.
*
* @param {DOMElement|DOMTextNode} node
* @return {DOMElement|DOMTextNode}
*/
function getLeafNode(node) {
while (node && node.firstChild) {
node = node.firstChild;
}
return node;
}
/**
* Get the next sibling within a container. This will walk up the
* DOM if a node's siblings have been exhausted.
*
* @param {DOMElement|DOMTextNode} node
* @return {?DOMElement|DOMTextNode}
*/
function getSiblingNode(node) {
while (node) {
if (node.nextSibling) {
return node.nextSibling;
}
node = node.parentNode;
}
}
/**
* Get object describing the nodes which contain characters at offset.
*
* @param {DOMElement|DOMTextNode} root
* @param {number} offset
* @return {?object}
*/
function getNodeForCharacterOffset(root, offset) {
var node = getLeafNode(root);
var nodeStart = 0;
var nodeEnd = 0;
while (node) {
if (node.nodeType === 3) {
nodeEnd = nodeStart + node.textContent.length;
if (nodeStart <= offset && nodeEnd >= offset) {
return {
node: node,
offset: offset - nodeStart
};
}
nodeStart = nodeEnd;
}
node = getLeafNode(getSiblingNode(node));
}
}
module.exports = getNodeForCharacterOffset;
},{}],124:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule getTextContentAccessor
*/
'use strict';
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
var contentKey = null;
/**
* Gets the key used to access text content on a DOM node.
*
* @return {?string} Key used to access text content.
* @internal
*/
function getTextContentAccessor() {
if (!contentKey && ExecutionEnvironment.canUseDOM) {
// Prefer textContent to innerText because many browsers support both but
// SVG <text> elements don't support innerText even when <div> does.
contentKey = 'textContent' in document.documentElement ? 'textContent' : 'innerText';
}
return contentKey;
}
module.exports = getTextContentAccessor;
},{"fbjs/lib/ExecutionEnvironment":137}],125:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule instantiateReactComponent
* @typechecks static-only
*/
'use strict';
var ReactCompositeComponent = require('./ReactCompositeComponent');
var ReactEmptyComponent = require('./ReactEmptyComponent');
var ReactNativeComponent = require('./ReactNativeComponent');
var assign = require('./Object.assign');
var invariant = require('fbjs/lib/invariant');
var warning = require('fbjs/lib/warning');
// To avoid a cyclic dependency, we create the final class in this module
var ReactCompositeComponentWrapper = function () {};
assign(ReactCompositeComponentWrapper.prototype, ReactCompositeComponent.Mixin, {
_instantiateReactComponent: instantiateReactComponent
});
function getDeclarationErrorAddendum(owner) {
if (owner) {
var name = owner.getName();
if (name) {
return ' Check the render method of `' + name + '`.';
}
}
return '';
}
/**
* Check if the type reference is a known internal type. I.e. not a user
* provided composite type.
*
* @param {function} type
* @return {boolean} Returns true if this is a valid internal type.
*/
function isInternalComponentType(type) {
return typeof type === 'function' && typeof type.prototype !== 'undefined' && typeof type.prototype.mountComponent === 'function' && typeof type.prototype.receiveComponent === 'function';
}
/**
* Given a ReactNode, create an instance that will actually be mounted.
*
* @param {ReactNode} node
* @return {object} A new instance of the element's constructor.
* @protected
*/
function instantiateReactComponent(node) {
var instance;
if (node === null || node === false) {
instance = new ReactEmptyComponent(instantiateReactComponent);
} else if (typeof node === 'object') {
var element = node;
!(element && (typeof element.type === 'function' || typeof element.type === 'string')) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Element type is invalid: expected a string (for built-in components) ' + 'or a class/function (for composite components) but got: %s.%s', element.type == null ? element.type : typeof element.type, getDeclarationErrorAddendum(element._owner)) : invariant(false) : undefined;
// Special case string values
if (typeof element.type === 'string') {
instance = ReactNativeComponent.createInternalComponent(element);
} else if (isInternalComponentType(element.type)) {
// This is temporarily available for custom components that are not string
// representations. I.e. ART. Once those are updated to use the string
// representation, we can drop this code path.
instance = new element.type(element);
} else {
instance = new ReactCompositeComponentWrapper();
}
} else if (typeof node === 'string' || typeof node === 'number') {
instance = ReactNativeComponent.createInstanceForText(node);
} else {
!false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Encountered invalid React node of type %s', typeof node) : invariant(false) : undefined;
}
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(typeof instance.construct === 'function' && typeof instance.mountComponent === 'function' && typeof instance.receiveComponent === 'function' && typeof instance.unmountComponent === 'function', 'Only React Components can be mounted.') : undefined;
}
// Sets up the instance. This can probably just move into the constructor now.
instance.construct(node);
// These two fields are used by the DOM and ART diffing algorithms
// respectively. Instead of using expandos on components, we should be
// storing the state needed by the diffing algorithms elsewhere.
instance._mountIndex = 0;
instance._mountImage = null;
if (process.env.NODE_ENV !== 'production') {
instance._isOwnerNecessary = false;
instance._warnedAboutRefsInRender = false;
}
// Internal instances should fully constructed at this point, so they should
// not get any new fields added to them at this point.
if (process.env.NODE_ENV !== 'production') {
if (Object.preventExtensions) {
Object.preventExtensions(instance);
}
}
return instance;
}
module.exports = instantiateReactComponent;
}).call(this,require('_process'))
},{"./Object.assign":29,"./ReactCompositeComponent":40,"./ReactEmptyComponent":61,"./ReactNativeComponent":75,"_process":164,"fbjs/lib/invariant":151,"fbjs/lib/warning":162}],126:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule isEventSupported
*/
'use strict';
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
var useHasFeature;
if (ExecutionEnvironment.canUseDOM) {
useHasFeature = document.implementation && document.implementation.hasFeature &&
// always returns true in newer browsers as per the standard.
// @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
document.implementation.hasFeature('', '') !== true;
}
/**
* Checks if an event is supported in the current execution environment.
*
* NOTE: This will not work correctly for non-generic events such as `change`,
* `reset`, `load`, `error`, and `select`.
*
* Borrows from Modernizr.
*
* @param {string} eventNameSuffix Event name, e.g. "click".
* @param {?boolean} capture Check if the capture phase is supported.
* @return {boolean} True if the event is supported.
* @internal
* @license Modernizr 3.0.0pre (Custom Build) | MIT
*/
function isEventSupported(eventNameSuffix, capture) {
if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) {
return false;
}
var eventName = 'on' + eventNameSuffix;
var isSupported = (eventName in document);
if (!isSupported) {
var element = document.createElement('div');
element.setAttribute(eventName, 'return;');
isSupported = typeof element[eventName] === 'function';
}
if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') {
// This is the only way to test support for the `wheel` event in IE9+.
isSupported = document.implementation.hasFeature('Events.wheel', '3.0');
}
return isSupported;
}
module.exports = isEventSupported;
},{"fbjs/lib/ExecutionEnvironment":137}],127:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule isTextInputElement
*/
'use strict';
/**
* @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
*/
var supportedInputTypes = {
'color': true,
'date': true,
'datetime': true,
'datetime-local': true,
'email': true,
'month': true,
'number': true,
'password': true,
'range': true,
'search': true,
'tel': true,
'text': true,
'time': true,
'url': true,
'week': true
};
function isTextInputElement(elem) {
var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
return nodeName && (nodeName === 'input' && supportedInputTypes[elem.type] || nodeName === 'textarea');
}
module.exports = isTextInputElement;
},{}],128:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule onlyChild
*/
'use strict';
var ReactElement = require('./ReactElement');
var invariant = require('fbjs/lib/invariant');
/**
* Returns the first child in a collection of children and verifies that there
* is only one child in the collection. The current implementation of this
* function assumes that a single child gets passed without a wrapper, but the
* purpose of this helper function is to abstract away the particular structure
* of children.
*
* @param {?object} children Child collection structure.
* @return {ReactComponent} The first and only `ReactComponent` contained in the
* structure.
*/
function onlyChild(children) {
!ReactElement.isValidElement(children) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'onlyChild must be passed a children with exactly one child.') : invariant(false) : undefined;
return children;
}
module.exports = onlyChild;
}).call(this,require('_process'))
},{"./ReactElement":59,"_process":164,"fbjs/lib/invariant":151}],129:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule quoteAttributeValueForBrowser
*/
'use strict';
var escapeTextContentForBrowser = require('./escapeTextContentForBrowser');
/**
* Escapes attribute value to prevent scripting attacks.
*
* @param {*} value Value to escape.
* @return {string} An escaped string.
*/
function quoteAttributeValueForBrowser(value) {
return '"' + escapeTextContentForBrowser(value) + '"';
}
module.exports = quoteAttributeValueForBrowser;
},{"./escapeTextContentForBrowser":114}],130:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule renderSubtreeIntoContainer
*/
'use strict';
var ReactMount = require('./ReactMount');
module.exports = ReactMount.renderSubtreeIntoContainer;
},{"./ReactMount":72}],131:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule setInnerHTML
*/
/* globals MSApp */
'use strict';
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
var WHITESPACE_TEST = /^[ \r\n\t\f]/;
var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/;
/**
* Set the innerHTML property of a node, ensuring that whitespace is preserved
* even in IE8.
*
* @param {DOMElement} node
* @param {string} html
* @internal
*/
var setInnerHTML = function (node, html) {
node.innerHTML = html;
};
// Win8 apps: Allow all html to be inserted
if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
setInnerHTML = function (node, html) {
MSApp.execUnsafeLocalFunction(function () {
node.innerHTML = html;
});
};
}
if (ExecutionEnvironment.canUseDOM) {
// IE8: When updating a just created node with innerHTML only leading
// whitespace is removed. When updating an existing node with innerHTML
// whitespace in root TextNodes is also collapsed.
// @see quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html
// Feature detection; only IE8 is known to behave improperly like this.
var testElement = document.createElement('div');
testElement.innerHTML = ' ';
if (testElement.innerHTML === '') {
setInnerHTML = function (node, html) {
// Magic theory: IE8 supposedly differentiates between added and updated
// nodes when processing innerHTML, innerHTML on updated nodes suffers
// from worse whitespace behavior. Re-adding a node like this triggers
// the initial and more favorable whitespace behavior.
// TODO: What to do on a detached node?
if (node.parentNode) {
node.parentNode.replaceChild(node, node);
}
// We also implement a workaround for non-visible tags disappearing into
// thin air on IE8, this only happens if there is no visible text
// in-front of the non-visible tags. Piggyback on the whitespace fix
// and simply check if any non-visible tags appear in the source.
if (WHITESPACE_TEST.test(html) || html[0] === '<' && NONVISIBLE_TEST.test(html)) {
// Recover leading whitespace by temporarily prepending any character.
// \uFEFF has the potential advantage of being zero-width/invisible.
// UglifyJS drops U+FEFF chars when parsing, so use String.fromCharCode
// in hopes that this is preserved even if "\uFEFF" is transformed to
// the actual Unicode character (by Babel, for example).
// https://github.com/mishoo/UglifyJS2/blob/v2.4.20/lib/parse.js#L216
node.innerHTML = String.fromCharCode(0xFEFF) + html;
// deleteData leaves an empty `TextNode` which offsets the index of all
// children. Definitely want to avoid this.
var textNode = node.firstChild;
if (textNode.data.length === 1) {
node.removeChild(textNode);
} else {
textNode.deleteData(0, 1);
}
} else {
node.innerHTML = html;
}
};
}
}
module.exports = setInnerHTML;
},{"fbjs/lib/ExecutionEnvironment":137}],132:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule setTextContent
*/
'use strict';
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
var escapeTextContentForBrowser = require('./escapeTextContentForBrowser');
var setInnerHTML = require('./setInnerHTML');
/**
* Set the textContent property of a node, ensuring that whitespace is preserved
* even in IE8. innerText is a poor substitute for textContent and, among many
* issues, inserts <br> instead of the literal newline chars. innerHTML behaves
* as it should.
*
* @param {DOMElement} node
* @param {string} text
* @internal
*/
var setTextContent = function (node, text) {
node.textContent = text;
};
if (ExecutionEnvironment.canUseDOM) {
if (!('textContent' in document.documentElement)) {
setTextContent = function (node, text) {
setInnerHTML(node, escapeTextContentForBrowser(text));
};
}
}
module.exports = setTextContent;
},{"./escapeTextContentForBrowser":114,"./setInnerHTML":131,"fbjs/lib/ExecutionEnvironment":137}],133:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule shouldUpdateReactComponent
* @typechecks static-only
*/
'use strict';
/**
* Given a `prevElement` and `nextElement`, determines if the existing
* instance should be updated as opposed to being destroyed or replaced by a new
* instance. Both arguments are elements. This ensures that this logic can
* operate on stateless trees without any backing instance.
*
* @param {?object} prevElement
* @param {?object} nextElement
* @return {boolean} True if the existing instance should be updated.
* @protected
*/
function shouldUpdateReactComponent(prevElement, nextElement) {
var prevEmpty = prevElement === null || prevElement === false;
var nextEmpty = nextElement === null || nextElement === false;
if (prevEmpty || nextEmpty) {
return prevEmpty === nextEmpty;
}
var prevType = typeof prevElement;
var nextType = typeof nextElement;
if (prevType === 'string' || prevType === 'number') {
return nextType === 'string' || nextType === 'number';
} else {
return nextType === 'object' && prevElement.type === nextElement.type && prevElement.key === nextElement.key;
}
return false;
}
module.exports = shouldUpdateReactComponent;
},{}],134:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule traverseAllChildren
*/
'use strict';
var ReactCurrentOwner = require('./ReactCurrentOwner');
var ReactElement = require('./ReactElement');
var ReactInstanceHandles = require('./ReactInstanceHandles');
var getIteratorFn = require('./getIteratorFn');
var invariant = require('fbjs/lib/invariant');
var warning = require('fbjs/lib/warning');
var SEPARATOR = ReactInstanceHandles.SEPARATOR;
var SUBSEPARATOR = ':';
/**
* TODO: Test that a single child and an array with one item have the same key
* pattern.
*/
var userProvidedKeyEscaperLookup = {
'=': '=0',
'.': '=1',
':': '=2'
};
var userProvidedKeyEscapeRegex = /[=.:]/g;
var didWarnAboutMaps = false;
function userProvidedKeyEscaper(match) {
return userProvidedKeyEscaperLookup[match];
}
/**
* Generate a key string that identifies a component within a set.
*
* @param {*} component A component that could contain a manual key.
* @param {number} index Index that is used if a manual key is not provided.
* @return {string}
*/
function getComponentKey(component, index) {
if (component && component.key != null) {
// Explicit key
return wrapUserProvidedKey(component.key);
}
// Implicit key determined by the index in the set
return index.toString(36);
}
/**
* Escape a component key so that it is safe to use in a reactid.
*
* @param {*} text Component key to be escaped.
* @return {string} An escaped string.
*/
function escapeUserProvidedKey(text) {
return ('' + text).replace(userProvidedKeyEscapeRegex, userProvidedKeyEscaper);
}
/**
* Wrap a `key` value explicitly provided by the user to distinguish it from
* implicitly-generated keys generated by a component's index in its parent.
*
* @param {string} key Value of a user-provided `key` attribute
* @return {string}
*/
function wrapUserProvidedKey(key) {
return '$' + escapeUserProvidedKey(key);
}
/**
* @param {?*} children Children tree container.
* @param {!string} nameSoFar Name of the key path so far.
* @param {!function} callback Callback to invoke with each child found.
* @param {?*} traverseContext Used to pass information throughout the traversal
* process.
* @return {!number} The number of children in this subtree.
*/
function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
var type = typeof children;
if (type === 'undefined' || type === 'boolean') {
// All of the above are perceived as null.
children = null;
}
if (children === null || type === 'string' || type === 'number' || ReactElement.isValidElement(children)) {
callback(traverseContext, children,
// If it's the only child, treat the name as if it was wrapped in an array
// so that it's consistent if the number of children grows.
nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
return 1;
}
var child;
var nextName;
var subtreeCount = 0; // Count of children found in the current subtree.
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
if (Array.isArray(children)) {
for (var i = 0; i < children.length; i++) {
child = children[i];
nextName = nextNamePrefix + getComponentKey(child, i);
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
}
} else {
var iteratorFn = getIteratorFn(children);
if (iteratorFn) {
var iterator = iteratorFn.call(children);
var step;
if (iteratorFn !== children.entries) {
var ii = 0;
while (!(step = iterator.next()).done) {
child = step.value;
nextName = nextNamePrefix + getComponentKey(child, ii++);
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
}
} else {
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(didWarnAboutMaps, 'Using Maps as children is not yet fully supported. It is an ' + 'experimental feature that might be removed. Convert it to a ' + 'sequence / iterable of keyed ReactElements instead.') : undefined;
didWarnAboutMaps = true;
}
// Iterator will provide entry [k,v] tuples rather than values.
while (!(step = iterator.next()).done) {
var entry = step.value;
if (entry) {
child = entry[1];
nextName = nextNamePrefix + wrapUserProvidedKey(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0);
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
}
}
}
} else if (type === 'object') {
var addendum = '';
if (process.env.NODE_ENV !== 'production') {
addendum = ' If you meant to render a collection of children, use an array ' + 'instead or wrap the object using createFragment(object) from the ' + 'React add-ons.';
if (children._isReactElement) {
addendum = ' It looks like you\'re using an element created by a different ' + 'version of React. Make sure to use only one copy of React.';
}
if (ReactCurrentOwner.current) {
var name = ReactCurrentOwner.current.getName();
if (name) {
addendum += ' Check the render method of `' + name + '`.';
}
}
}
var childrenString = String(children);
!false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : invariant(false) : undefined;
}
}
return subtreeCount;
}
/**
* Traverses children that are typically specified as `props.children`, but
* might also be specified through attributes:
*
* - `traverseAllChildren(this.props.children, ...)`
* - `traverseAllChildren(this.props.leftPanelChildren, ...)`
*
* The `traverseContext` is an optional argument that is passed through the
* entire traversal. It can be used to store accumulations or anything else that
* the callback might find relevant.
*
* @param {?*} children Children tree object.
* @param {!function} callback To invoke upon traversing each child.
* @param {?*} traverseContext Context for traversal.
* @return {!number} The number of children in this subtree.
*/
function traverseAllChildren(children, callback, traverseContext) {
if (children == null) {
return 0;
}
return traverseAllChildrenImpl(children, '', callback, traverseContext);
}
module.exports = traverseAllChildren;
}).call(this,require('_process'))
},{"./ReactCurrentOwner":41,"./ReactElement":59,"./ReactInstanceHandles":68,"./getIteratorFn":122,"_process":164,"fbjs/lib/invariant":151,"fbjs/lib/warning":162}],135:[function(require,module,exports){
(function (process){
/**
* Copyright 2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule validateDOMNesting
*/
'use strict';
var assign = require('./Object.assign');
var emptyFunction = require('fbjs/lib/emptyFunction');
var warning = require('fbjs/lib/warning');
var validateDOMNesting = emptyFunction;
if (process.env.NODE_ENV !== 'production') {
// This validation code was written based on the HTML5 parsing spec:
// https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
//
// Note: this does not catch all invalid nesting, nor does it try to (as it's
// not clear what practical benefit doing so provides); instead, we warn only
// for cases where the parser will give a parse tree differing from what React
// intended. For example, <b><div></div></b> is invalid but we don't warn
// because it still parses correctly; we do warn for other cases like nested
// <p> tags where the beginning of the second element implicitly closes the
// first, causing a confusing mess.
// https://html.spec.whatwg.org/multipage/syntax.html#special
var specialTags = ['address', 'applet', 'area', 'article', 'aside', 'base', 'basefont', 'bgsound', 'blockquote', 'body', 'br', 'button', 'caption', 'center', 'col', 'colgroup', 'dd', 'details', 'dir', 'div', 'dl', 'dt', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'iframe', 'img', 'input', 'isindex', 'li', 'link', 'listing', 'main', 'marquee', 'menu', 'menuitem', 'meta', 'nav', 'noembed', 'noframes', 'noscript', 'object', 'ol', 'p', 'param', 'plaintext', 'pre', 'script', 'section', 'select', 'source', 'style', 'summary', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'title', 'tr', 'track', 'ul', 'wbr', 'xmp'];
// https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
var inScopeTags = ['applet', 'caption', 'html', 'table', 'td', 'th', 'marquee', 'object', 'template',
// https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point
// TODO: Distinguish by namespace here -- for <title>, including it here
// errs on the side of fewer warnings
'foreignObject', 'desc', 'title'];
// https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-button-scope
var buttonScopeTags = inScopeTags.concat(['button']);
// https://html.spec.whatwg.org/multipage/syntax.html#generate-implied-end-tags
var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt'];
var emptyAncestorInfo = {
parentTag: null,
formTag: null,
aTagInScope: null,
buttonTagInScope: null,
nobrTagInScope: null,
pTagInButtonScope: null,
listItemTagAutoclosing: null,
dlItemTagAutoclosing: null
};
var updatedAncestorInfo = function (oldInfo, tag, instance) {
var ancestorInfo = assign({}, oldInfo || emptyAncestorInfo);
var info = { tag: tag, instance: instance };
if (inScopeTags.indexOf(tag) !== -1) {
ancestorInfo.aTagInScope = null;
ancestorInfo.buttonTagInScope = null;
ancestorInfo.nobrTagInScope = null;
}
if (buttonScopeTags.indexOf(tag) !== -1) {
ancestorInfo.pTagInButtonScope = null;
}
// See rules for 'li', 'dd', 'dt' start tags in
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
if (specialTags.indexOf(tag) !== -1 && tag !== 'address' && tag !== 'div' && tag !== 'p') {
ancestorInfo.listItemTagAutoclosing = null;
ancestorInfo.dlItemTagAutoclosing = null;
}
ancestorInfo.parentTag = info;
if (tag === 'form') {
ancestorInfo.formTag = info;
}
if (tag === 'a') {
ancestorInfo.aTagInScope = info;
}
if (tag === 'button') {
ancestorInfo.buttonTagInScope = info;
}
if (tag === 'nobr') {
ancestorInfo.nobrTagInScope = info;
}
if (tag === 'p') {
ancestorInfo.pTagInButtonScope = info;
}
if (tag === 'li') {
ancestorInfo.listItemTagAutoclosing = info;
}
if (tag === 'dd' || tag === 'dt') {
ancestorInfo.dlItemTagAutoclosing = info;
}
return ancestorInfo;
};
/**
* Returns whether
*/
var isTagValidWithParent = function (tag, parentTag) {
// First, let's check if we're in an unusual parsing mode...
switch (parentTag) {
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect
case 'select':
return tag === 'option' || tag === 'optgroup' || tag === '#text';
case 'optgroup':
return tag === 'option' || tag === '#text';
// Strictly speaking, seeing an <option> doesn't mean we're in a <select>
// but
case 'option':
return tag === '#text';
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intd
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incaption
// No special behavior since these rules fall back to "in body" mode for
// all except special table nodes which cause bad parsing behavior anyway.
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intr
case 'tr':
return tag === 'th' || tag === 'td' || tag === 'style' || tag === 'script' || tag === 'template';
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intbody
case 'tbody':
case 'thead':
case 'tfoot':
return tag === 'tr' || tag === 'style' || tag === 'script' || tag === 'template';
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incolgroup
case 'colgroup':
return tag === 'col' || tag === 'template';
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intable
case 'table':
return tag === 'caption' || tag === 'colgroup' || tag === 'tbody' || tag === 'tfoot' || tag === 'thead' || tag === 'style' || tag === 'script' || tag === 'template';
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead
case 'head':
return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template';
// https://html.spec.whatwg.org/multipage/semantics.html#the-html-element
case 'html':
return tag === 'head' || tag === 'body';
}
// Probably in the "in body" parsing mode, so we outlaw only tag combos
// where the parsing rules cause implicit opens or closes to be added.
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
switch (tag) {
case 'h1':
case 'h2':
case 'h3':
case 'h4':
case 'h5':
case 'h6':
return parentTag !== 'h1' && parentTag !== 'h2' && parentTag !== 'h3' && parentTag !== 'h4' && parentTag !== 'h5' && parentTag !== 'h6';
case 'rp':
case 'rt':
return impliedEndTags.indexOf(parentTag) === -1;
case 'caption':
case 'col':
case 'colgroup':
case 'frame':
case 'head':
case 'tbody':
case 'td':
case 'tfoot':
case 'th':
case 'thead':
case 'tr':
// These tags are only valid with a few parents that have special child
// parsing rules -- if we're down here, then none of those matched and
// so we allow it only if we don't know what the parent is, as all other
// cases are invalid.
return parentTag == null;
}
return true;
};
/**
* Returns whether
*/
var findInvalidAncestorForTag = function (tag, ancestorInfo) {
switch (tag) {
case 'address':
case 'article':
case 'aside':
case 'blockquote':
case 'center':
case 'details':
case 'dialog':
case 'dir':
case 'div':
case 'dl':
case 'fieldset':
case 'figcaption':
case 'figure':
case 'footer':
case 'header':
case 'hgroup':
case 'main':
case 'menu':
case 'nav':
case 'ol':
case 'p':
case 'section':
case 'summary':
case 'ul':
case 'pre':
case 'listing':
case 'table':
case 'hr':
case 'xmp':
case 'h1':
case 'h2':
case 'h3':
case 'h4':
case 'h5':
case 'h6':
return ancestorInfo.pTagInButtonScope;
case 'form':
return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope;
case 'li':
return ancestorInfo.listItemTagAutoclosing;
case 'dd':
case 'dt':
return ancestorInfo.dlItemTagAutoclosing;
case 'button':
return ancestorInfo.buttonTagInScope;
case 'a':
// Spec says something about storing a list of markers, but it sounds
// equivalent to this check.
return ancestorInfo.aTagInScope;
case 'nobr':
return ancestorInfo.nobrTagInScope;
}
return null;
};
/**
* Given a ReactCompositeComponent instance, return a list of its recursive
* owners, starting at the root and ending with the instance itself.
*/
var findOwnerStack = function (instance) {
if (!instance) {
return [];
}
var stack = [];
/*eslint-disable space-after-keywords */
do {
/*eslint-enable space-after-keywords */
stack.push(instance);
} while (instance = instance._currentElement._owner);
stack.reverse();
return stack;
};
var didWarn = {};
validateDOMNesting = function (childTag, childInstance, ancestorInfo) {
ancestorInfo = ancestorInfo || emptyAncestorInfo;
var parentInfo = ancestorInfo.parentTag;
var parentTag = parentInfo && parentInfo.tag;
var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo;
var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo);
var problematic = invalidParent || invalidAncestor;
if (problematic) {
var ancestorTag = problematic.tag;
var ancestorInstance = problematic.instance;
var childOwner = childInstance && childInstance._currentElement._owner;
var ancestorOwner = ancestorInstance && ancestorInstance._currentElement._owner;
var childOwners = findOwnerStack(childOwner);
var ancestorOwners = findOwnerStack(ancestorOwner);
var minStackLen = Math.min(childOwners.length, ancestorOwners.length);
var i;
var deepestCommon = -1;
for (i = 0; i < minStackLen; i++) {
if (childOwners[i] === ancestorOwners[i]) {
deepestCommon = i;
} else {
break;
}
}
var UNKNOWN = '(unknown)';
var childOwnerNames = childOwners.slice(deepestCommon + 1).map(function (inst) {
return inst.getName() || UNKNOWN;
});
var ancestorOwnerNames = ancestorOwners.slice(deepestCommon + 1).map(function (inst) {
return inst.getName() || UNKNOWN;
});
var ownerInfo = [].concat(
// If the parent and child instances have a common owner ancestor, start
// with that -- otherwise we just start with the parent's owners.
deepestCommon !== -1 ? childOwners[deepestCommon].getName() || UNKNOWN : [], ancestorOwnerNames, ancestorTag,
// If we're warning about an invalid (non-parent) ancestry, add '...'
invalidAncestor ? ['...'] : [], childOwnerNames, childTag).join(' > ');
var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + ownerInfo;
if (didWarn[warnKey]) {
return;
}
didWarn[warnKey] = true;
if (invalidParent) {
var info = '';
if (ancestorTag === 'table' && childTag === 'tr') {
info += ' Add a <tbody> to your code to match the DOM tree generated by ' + 'the browser.';
}
process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): <%s> cannot appear as a child of <%s>. ' + 'See %s.%s', childTag, ancestorTag, ownerInfo, info) : undefined;
} else {
process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): <%s> cannot appear as a descendant of ' + '<%s>. See %s.', childTag, ancestorTag, ownerInfo) : undefined;
}
}
};
validateDOMNesting.ancestorInfoContextKey = '__validateDOMNesting_ancestorInfo$' + Math.random().toString(36).slice(2);
validateDOMNesting.updatedAncestorInfo = updatedAncestorInfo;
// For testing
validateDOMNesting.isTagValidInContext = function (tag, ancestorInfo) {
ancestorInfo = ancestorInfo || emptyAncestorInfo;
var parentInfo = ancestorInfo.parentTag;
var parentTag = parentInfo && parentInfo.tag;
return isTagValidWithParent(tag, parentTag) && !findInvalidAncestorForTag(tag, ancestorInfo);
};
}
module.exports = validateDOMNesting;
}).call(this,require('_process'))
},{"./Object.assign":29,"_process":164,"fbjs/lib/emptyFunction":143,"fbjs/lib/warning":162}],136:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule EventListener
* @typechecks
*/
'use strict';
var emptyFunction = require('./emptyFunction');
/**
* Upstream version of event listener. Does not take into account specific
* nature of platform.
*/
var EventListener = {
/**
* Listen to DOM events during the bubble phase.
*
* @param {DOMEventTarget} target DOM element to register listener on.
* @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
* @param {function} callback Callback function.
* @return {object} Object with a `remove` method.
*/
listen: function (target, eventType, callback) {
if (target.addEventListener) {
target.addEventListener(eventType, callback, false);
return {
remove: function () {
target.removeEventListener(eventType, callback, false);
}
};
} else if (target.attachEvent) {
target.attachEvent('on' + eventType, callback);
return {
remove: function () {
target.detachEvent('on' + eventType, callback);
}
};
}
},
/**
* Listen to DOM events during the capture phase.
*
* @param {DOMEventTarget} target DOM element to register listener on.
* @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
* @param {function} callback Callback function.
* @return {object} Object with a `remove` method.
*/
capture: function (target, eventType, callback) {
if (target.addEventListener) {
target.addEventListener(eventType, callback, true);
return {
remove: function () {
target.removeEventListener(eventType, callback, true);
}
};
} else {
if (process.env.NODE_ENV !== 'production') {
console.error('Attempted to listen to events during the capture phase on a ' + 'browser that does not support the capture phase. Your application ' + 'will not receive some events.');
}
return {
remove: emptyFunction
};
}
},
registerDefault: function () {}
};
module.exports = EventListener;
}).call(this,require('_process'))
},{"./emptyFunction":143,"_process":164}],137:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ExecutionEnvironment
*/
'use strict';
var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
/**
* Simple, lightweight module assisting with the detection and context of
* Worker. Helps avoid circular dependencies and allows code to reason about
* whether or not they are in a Worker, even if they never include the main
* `ReactWorker` dependency.
*/
var ExecutionEnvironment = {
canUseDOM: canUseDOM,
canUseWorkers: typeof Worker !== 'undefined',
canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent),
canUseViewport: canUseDOM && !!window.screen,
isInWorker: !canUseDOM // For now, this is true - might change in the future.
};
module.exports = ExecutionEnvironment;
},{}],138:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule camelize
* @typechecks
*/
"use strict";
var _hyphenPattern = /-(.)/g;
/**
* Camelcases a hyphenated string, for example:
*
* > camelize('background-color')
* < "backgroundColor"
*
* @param {string} string
* @return {string}
*/
function camelize(string) {
return string.replace(_hyphenPattern, function (_, character) {
return character.toUpperCase();
});
}
module.exports = camelize;
},{}],139:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule camelizeStyleName
* @typechecks
*/
'use strict';
var camelize = require('./camelize');
var msPattern = /^-ms-/;
/**
* Camelcases a hyphenated CSS property name, for example:
*
* > camelizeStyleName('background-color')
* < "backgroundColor"
* > camelizeStyleName('-moz-transition')
* < "MozTransition"
* > camelizeStyleName('-ms-transition')
* < "msTransition"
*
* As Andi Smith suggests
* (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
* is converted to lowercase `ms`.
*
* @param {string} string
* @return {string}
*/
function camelizeStyleName(string) {
return camelize(string.replace(msPattern, 'ms-'));
}
module.exports = camelizeStyleName;
},{"./camelize":138}],140:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule containsNode
* @typechecks
*/
'use strict';
var isTextNode = require('./isTextNode');
/*eslint-disable no-bitwise */
/**
* Checks if a given DOM node contains or is another DOM node.
*
* @param {?DOMNode} outerNode Outer DOM node.
* @param {?DOMNode} innerNode Inner DOM node.
* @return {boolean} True if `outerNode` contains or is `innerNode`.
*/
function containsNode(_x, _x2) {
var _again = true;
_function: while (_again) {
var outerNode = _x,
innerNode = _x2;
_again = false;
if (!outerNode || !innerNode) {
return false;
} else if (outerNode === innerNode) {
return true;
} else if (isTextNode(outerNode)) {
return false;
} else if (isTextNode(innerNode)) {
_x = outerNode;
_x2 = innerNode.parentNode;
_again = true;
continue _function;
} else if (outerNode.contains) {
return outerNode.contains(innerNode);
} else if (outerNode.compareDocumentPosition) {
return !!(outerNode.compareDocumentPosition(innerNode) & 16);
} else {
return false;
}
}
}
module.exports = containsNode;
},{"./isTextNode":153}],141:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule createArrayFromMixed
* @typechecks
*/
'use strict';
var toArray = require('./toArray');
/**
* Perform a heuristic test to determine if an object is "array-like".
*
* A monk asked Joshu, a Zen master, "Has a dog Buddha nature?"
* Joshu replied: "Mu."
*
* This function determines if its argument has "array nature": it returns
* true if the argument is an actual array, an `arguments' object, or an
* HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()).
*
* It will return false for other array-like objects like Filelist.
*
* @param {*} obj
* @return {boolean}
*/
function hasArrayNature(obj) {
return(
// not null/false
!!obj && (
// arrays are objects, NodeLists are functions in Safari
typeof obj == 'object' || typeof obj == 'function') &&
// quacks like an array
'length' in obj &&
// not window
!('setInterval' in obj) &&
// no DOM node should be considered an array-like
// a 'select' element has 'length' and 'item' properties on IE8
typeof obj.nodeType != 'number' && (
// a real array
Array.isArray(obj) ||
// arguments
'callee' in obj ||
// HTMLCollection/NodeList
'item' in obj)
);
}
/**
* Ensure that the argument is an array by wrapping it in an array if it is not.
* Creates a copy of the argument if it is already an array.
*
* This is mostly useful idiomatically:
*
* var createArrayFromMixed = require('createArrayFromMixed');
*
* function takesOneOrMoreThings(things) {
* things = createArrayFromMixed(things);
* ...
* }
*
* This allows you to treat `things' as an array, but accept scalars in the API.
*
* If you need to convert an array-like object, like `arguments`, into an array
* use toArray instead.
*
* @param {*} obj
* @return {array}
*/
function createArrayFromMixed(obj) {
if (!hasArrayNature(obj)) {
return [obj];
} else if (Array.isArray(obj)) {
return obj.slice();
} else {
return toArray(obj);
}
}
module.exports = createArrayFromMixed;
},{"./toArray":161}],142:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule createNodesFromMarkup
* @typechecks
*/
/*eslint-disable fb-www/unsafe-html*/
'use strict';
var ExecutionEnvironment = require('./ExecutionEnvironment');
var createArrayFromMixed = require('./createArrayFromMixed');
var getMarkupWrap = require('./getMarkupWrap');
var invariant = require('./invariant');
/**
* Dummy container used to render all markup.
*/
var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
/**
* Pattern used by `getNodeName`.
*/
var nodeNamePattern = /^\s*<(\w+)/;
/**
* Extracts the `nodeName` of the first element in a string of markup.
*
* @param {string} markup String of markup.
* @return {?string} Node name of the supplied markup.
*/
function getNodeName(markup) {
var nodeNameMatch = markup.match(nodeNamePattern);
return nodeNameMatch && nodeNameMatch[1].toLowerCase();
}
/**
* Creates an array containing the nodes rendered from the supplied markup. The
* optionally supplied `handleScript` function will be invoked once for each
* <script> element that is rendered. If no `handleScript` function is supplied,
* an exception is thrown if any <script> elements are rendered.
*
* @param {string} markup A string of valid HTML markup.
* @param {?function} handleScript Invoked once for each rendered <script>.
* @return {array<DOMElement|DOMTextNode>} An array of rendered nodes.
*/
function createNodesFromMarkup(markup, handleScript) {
var node = dummyNode;
!!!dummyNode ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createNodesFromMarkup dummy not initialized') : invariant(false) : undefined;
var nodeName = getNodeName(markup);
var wrap = nodeName && getMarkupWrap(nodeName);
if (wrap) {
node.innerHTML = wrap[1] + markup + wrap[2];
var wrapDepth = wrap[0];
while (wrapDepth--) {
node = node.lastChild;
}
} else {
node.innerHTML = markup;
}
var scripts = node.getElementsByTagName('script');
if (scripts.length) {
!handleScript ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createNodesFromMarkup(...): Unexpected <script> element rendered.') : invariant(false) : undefined;
createArrayFromMixed(scripts).forEach(handleScript);
}
var nodes = createArrayFromMixed(node.childNodes);
while (node.lastChild) {
node.removeChild(node.lastChild);
}
return nodes;
}
module.exports = createNodesFromMarkup;
}).call(this,require('_process'))
},{"./ExecutionEnvironment":137,"./createArrayFromMixed":141,"./getMarkupWrap":147,"./invariant":151,"_process":164}],143:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule emptyFunction
*/
"use strict";
function makeEmptyFunction(arg) {
return function () {
return arg;
};
}
/**
* This function accepts and discards inputs; it has no side effects. This is
* primarily useful idiomatically for overridable function endpoints which
* always need to be callable, since JS lacks a null-call idiom ala Cocoa.
*/
function emptyFunction() {}
emptyFunction.thatReturns = makeEmptyFunction;
emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
emptyFunction.thatReturnsNull = makeEmptyFunction(null);
emptyFunction.thatReturnsThis = function () {
return this;
};
emptyFunction.thatReturnsArgument = function (arg) {
return arg;
};
module.exports = emptyFunction;
},{}],144:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule emptyObject
*/
'use strict';
var emptyObject = {};
if (process.env.NODE_ENV !== 'production') {
Object.freeze(emptyObject);
}
module.exports = emptyObject;
}).call(this,require('_process'))
},{"_process":164}],145:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule focusNode
*/
'use strict';
/**
* @param {DOMElement} node input/textarea to focus
*/
function focusNode(node) {
// IE8 can throw "Can't move focus to the control because it is invisible,
// not enabled, or of a type that does not accept the focus." for all kinds of
// reasons that are too expensive and fragile to test.
try {
node.focus();
} catch (e) {}
}
module.exports = focusNode;
},{}],146:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule getActiveElement
* @typechecks
*/
/* eslint-disable fb-www/typeof-undefined */
/**
* Same as document.activeElement but wraps in a try-catch block. In IE it is
* not safe to call document.activeElement if there is nothing focused.
*
* The activeElement will be null only if the document or document body is not
* yet defined.
*/
'use strict';
function getActiveElement() /*?DOMElement*/{
if (typeof document === 'undefined') {
return null;
}
try {
return document.activeElement || document.body;
} catch (e) {
return document.body;
}
}
module.exports = getActiveElement;
},{}],147:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule getMarkupWrap
*/
/*eslint-disable fb-www/unsafe-html */
'use strict';
var ExecutionEnvironment = require('./ExecutionEnvironment');
var invariant = require('./invariant');
/**
* Dummy container used to detect which wraps are necessary.
*/
var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
/**
* Some browsers cannot use `innerHTML` to render certain elements standalone,
* so we wrap them, render the wrapped nodes, then extract the desired node.
*
* In IE8, certain elements cannot render alone, so wrap all elements ('*').
*/
var shouldWrap = {};
var selectWrap = [1, '<select multiple="true">', '</select>'];
var tableWrap = [1, '<table>', '</table>'];
var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
var svgWrap = [1, '<svg xmlns="http://www.w3.org/2000/svg">', '</svg>'];
var markupWrap = {
'*': [1, '?<div>', '</div>'],
'area': [1, '<map>', '</map>'],
'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
'legend': [1, '<fieldset>', '</fieldset>'],
'param': [1, '<object>', '</object>'],
'tr': [2, '<table><tbody>', '</tbody></table>'],
'optgroup': selectWrap,
'option': selectWrap,
'caption': tableWrap,
'colgroup': tableWrap,
'tbody': tableWrap,
'tfoot': tableWrap,
'thead': tableWrap,
'td': trWrap,
'th': trWrap
};
// Initialize the SVG elements since we know they'll always need to be wrapped
// consistently. If they are created inside a <div> they will be initialized in
// the wrong namespace (and will not display).
var svgElements = ['circle', 'clipPath', 'defs', 'ellipse', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'text', 'tspan'];
svgElements.forEach(function (nodeName) {
markupWrap[nodeName] = svgWrap;
shouldWrap[nodeName] = true;
});
/**
* Gets the markup wrap configuration for the supplied `nodeName`.
*
* NOTE: This lazily detects which wraps are necessary for the current browser.
*
* @param {string} nodeName Lowercase `nodeName`.
* @return {?array} Markup wrap configuration, if applicable.
*/
function getMarkupWrap(nodeName) {
!!!dummyNode ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Markup wrapping node not initialized') : invariant(false) : undefined;
if (!markupWrap.hasOwnProperty(nodeName)) {
nodeName = '*';
}
if (!shouldWrap.hasOwnProperty(nodeName)) {
if (nodeName === '*') {
dummyNode.innerHTML = '<link />';
} else {
dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>';
}
shouldWrap[nodeName] = !dummyNode.firstChild;
}
return shouldWrap[nodeName] ? markupWrap[nodeName] : null;
}
module.exports = getMarkupWrap;
}).call(this,require('_process'))
},{"./ExecutionEnvironment":137,"./invariant":151,"_process":164}],148:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule getUnboundedScrollPosition
* @typechecks
*/
'use strict';
/**
* Gets the scroll position of the supplied element or window.
*
* The return values are unbounded, unlike `getScrollPosition`. This means they
* may be negative or exceed the element boundaries (which is possible using
* inertial scrolling).
*
* @param {DOMWindow|DOMElement} scrollable
* @return {object} Map with `x` and `y` keys.
*/
function getUnboundedScrollPosition(scrollable) {
if (scrollable === window) {
return {
x: window.pageXOffset || document.documentElement.scrollLeft,
y: window.pageYOffset || document.documentElement.scrollTop
};
}
return {
x: scrollable.scrollLeft,
y: scrollable.scrollTop
};
}
module.exports = getUnboundedScrollPosition;
},{}],149:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule hyphenate
* @typechecks
*/
'use strict';
var _uppercasePattern = /([A-Z])/g;
/**
* Hyphenates a camelcased string, for example:
*
* > hyphenate('backgroundColor')
* < "background-color"
*
* For CSS style names, use `hyphenateStyleName` instead which works properly
* with all vendor prefixes, including `ms`.
*
* @param {string} string
* @return {string}
*/
function hyphenate(string) {
return string.replace(_uppercasePattern, '-$1').toLowerCase();
}
module.exports = hyphenate;
},{}],150:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule hyphenateStyleName
* @typechecks
*/
'use strict';
var hyphenate = require('./hyphenate');
var msPattern = /^ms-/;
/**
* Hyphenates a camelcased CSS property name, for example:
*
* > hyphenateStyleName('backgroundColor')
* < "background-color"
* > hyphenateStyleName('MozTransition')
* < "-moz-transition"
* > hyphenateStyleName('msTransition')
* < "-ms-transition"
*
* As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
* is converted to `-ms-`.
*
* @param {string} string
* @return {string}
*/
function hyphenateStyleName(string) {
return hyphenate(string).replace(msPattern, '-ms-');
}
module.exports = hyphenateStyleName;
},{"./hyphenate":149}],151:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule invariant
*/
'use strict';
/**
* Use invariant() to assert state which your program assumes to be true.
*
* Provide sprintf-style format (only %s is supported) and arguments
* to provide information about what broke and what you were
* expecting.
*
* The invariant message will be stripped in production, but the invariant
* will remain to ensure logic does not differ in production.
*/
function invariant(condition, format, a, b, c, d, e, f) {
if (process.env.NODE_ENV !== 'production') {
if (format === undefined) {
throw new Error('invariant requires an error message argument');
}
}
if (!condition) {
var error;
if (format === undefined) {
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
} else {
var args = [a, b, c, d, e, f];
var argIndex = 0;
error = new Error(format.replace(/%s/g, function () {
return args[argIndex++];
}));
error.name = 'Invariant Violation';
}
error.framesToPop = 1; // we don't care about invariant's own frame
throw error;
}
}
module.exports = invariant;
}).call(this,require('_process'))
},{"_process":164}],152:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule isNode
* @typechecks
*/
/**
* @param {*} object The object to check.
* @return {boolean} Whether or not the object is a DOM node.
*/
'use strict';
function isNode(object) {
return !!(object && (typeof Node === 'function' ? object instanceof Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string'));
}
module.exports = isNode;
},{}],153:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule isTextNode
* @typechecks
*/
'use strict';
var isNode = require('./isNode');
/**
* @param {*} object The object to check.
* @return {boolean} Whether or not the object is a DOM text node.
*/
function isTextNode(object) {
return isNode(object) && object.nodeType == 3;
}
module.exports = isTextNode;
},{"./isNode":152}],154:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule keyMirror
* @typechecks static-only
*/
'use strict';
var invariant = require('./invariant');
/**
* Constructs an enumeration with keys equal to their value.
*
* For example:
*
* var COLORS = keyMirror({blue: null, red: null});
* var myColor = COLORS.blue;
* var isColorValid = !!COLORS[myColor];
*
* The last line could not be performed if the values of the generated enum were
* not equal to their keys.
*
* Input: {key1: val1, key2: val2}
* Output: {key1: key1, key2: key2}
*
* @param {object} obj
* @return {object}
*/
var keyMirror = function (obj) {
var ret = {};
var key;
!(obj instanceof Object && !Array.isArray(obj)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'keyMirror(...): Argument must be an object.') : invariant(false) : undefined;
for (key in obj) {
if (!obj.hasOwnProperty(key)) {
continue;
}
ret[key] = key;
}
return ret;
};
module.exports = keyMirror;
}).call(this,require('_process'))
},{"./invariant":151,"_process":164}],155:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule keyOf
*/
/**
* Allows extraction of a minified key. Let's the build system minify keys
* without losing the ability to dynamically use key strings as values
* themselves. Pass in an object with a single key/val pair and it will return
* you the string key of that single record. Suppose you want to grab the
* value for a key 'className' inside of an object. Key/val minification may
* have aliased that key to be 'xa12'. keyOf({className: null}) will return
* 'xa12' in that case. Resolve keys you want to use once at startup time, then
* reuse those resolutions.
*/
"use strict";
var keyOf = function (oneKeyObj) {
var key;
for (key in oneKeyObj) {
if (!oneKeyObj.hasOwnProperty(key)) {
continue;
}
return key;
}
return null;
};
module.exports = keyOf;
},{}],156:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule mapObject
*/
'use strict';
var hasOwnProperty = Object.prototype.hasOwnProperty;
/**
* Executes the provided `callback` once for each enumerable own property in the
* object and constructs a new object from the results. The `callback` is
* invoked with three arguments:
*
* - the property value
* - the property name
* - the object being traversed
*
* Properties that are added after the call to `mapObject` will not be visited
* by `callback`. If the values of existing properties are changed, the value
* passed to `callback` will be the value at the time `mapObject` visits them.
* Properties that are deleted before being visited are not visited.
*
* @grep function objectMap()
* @grep function objMap()
*
* @param {?object} object
* @param {function} callback
* @param {*} context
* @return {?object}
*/
function mapObject(object, callback, context) {
if (!object) {
return null;
}
var result = {};
for (var name in object) {
if (hasOwnProperty.call(object, name)) {
result[name] = callback.call(context, object[name], name, object);
}
}
return result;
}
module.exports = mapObject;
},{}],157:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule memoizeStringOnly
* @typechecks static-only
*/
'use strict';
/**
* Memoizes the return value of a function that accepts one string argument.
*
* @param {function} callback
* @return {function}
*/
function memoizeStringOnly(callback) {
var cache = {};
return function (string) {
if (!cache.hasOwnProperty(string)) {
cache[string] = callback.call(this, string);
}
return cache[string];
};
}
module.exports = memoizeStringOnly;
},{}],158:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule performance
* @typechecks
*/
'use strict';
var ExecutionEnvironment = require('./ExecutionEnvironment');
var performance;
if (ExecutionEnvironment.canUseDOM) {
performance = window.performance || window.msPerformance || window.webkitPerformance;
}
module.exports = performance || {};
},{"./ExecutionEnvironment":137}],159:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule performanceNow
* @typechecks
*/
'use strict';
var performance = require('./performance');
var performanceNow;
/**
* Detect if we can use `window.performance.now()` and gracefully fallback to
* `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now
* because of Facebook's testing infrastructure.
*/
if (performance.now) {
performanceNow = function () {
return performance.now();
};
} else {
performanceNow = function () {
return Date.now();
};
}
module.exports = performanceNow;
},{"./performance":158}],160:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule shallowEqual
* @typechecks
*
*/
'use strict';
var hasOwnProperty = Object.prototype.hasOwnProperty;
/**
* Performs equality by iterating through keys on an object and returning false
* when any key has values which are not strictly equal between the arguments.
* Returns true when the values of all keys are strictly equal.
*/
function shallowEqual(objA, objB) {
if (objA === objB) {
return true;
}
if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
return false;
}
var keysA = Object.keys(objA);
var keysB = Object.keys(objB);
if (keysA.length !== keysB.length) {
return false;
}
// Test for A's keys different from B.
var bHasOwnProperty = hasOwnProperty.bind(objB);
for (var i = 0; i < keysA.length; i++) {
if (!bHasOwnProperty(keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) {
return false;
}
}
return true;
}
module.exports = shallowEqual;
},{}],161:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule toArray
* @typechecks
*/
'use strict';
var invariant = require('./invariant');
/**
* Convert array-like objects to arrays.
*
* This API assumes the caller knows the contents of the data type. For less
* well defined inputs use createArrayFromMixed.
*
* @param {object|function|filelist} obj
* @return {array}
*/
function toArray(obj) {
var length = obj.length;
// Some browse builtin objects can report typeof 'function' (e.g. NodeList in
// old versions of Safari).
!(!Array.isArray(obj) && (typeof obj === 'object' || typeof obj === 'function')) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Array-like object expected') : invariant(false) : undefined;
!(typeof length === 'number') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object needs a length property') : invariant(false) : undefined;
!(length === 0 || length - 1 in obj) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object should have keys for indices') : invariant(false) : undefined;
// Old IE doesn't give collections access to hasOwnProperty. Assume inputs
// without method will throw during the slice call and skip straight to the
// fallback.
if (obj.hasOwnProperty) {
try {
return Array.prototype.slice.call(obj);
} catch (e) {
// IE < 9 does not support Array#slice on collections objects
}
}
// Fall back to copying key by key. This assumes all keys have a value,
// so will not preserve sparsely populated inputs.
var ret = Array(length);
for (var ii = 0; ii < length; ii++) {
ret[ii] = obj[ii];
}
return ret;
}
module.exports = toArray;
}).call(this,require('_process'))
},{"./invariant":151,"_process":164}],162:[function(require,module,exports){
(function (process){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule warning
*/
'use strict';
var emptyFunction = require('./emptyFunction');
/**
* Similar to invariant but only logs a warning if the condition is not met.
* This can be used to log issues in development environments in critical
* paths. Removing the logging code for production environments will keep the
* same logic and follow the same code paths.
*/
var warning = emptyFunction;
if (process.env.NODE_ENV !== 'production') {
warning = function (condition, format) {
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
args[_key - 2] = arguments[_key];
}
if (format === undefined) {
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
}
if (format.indexOf('Failed Composite propType: ') === 0) {
return; // Ignore CompositeComponent proptype check.
}
if (!condition) {
var argIndex = 0;
var message = 'Warning: ' + format.replace(/%s/g, function () {
return args[argIndex++];
});
if (typeof console !== 'undefined') {
console.error(message);
}
try {
// --- Welcome to debugging React ---
// This error was thrown as a convenience so that you can use this stack
// to find the callsite that caused this warning to fire.
throw new Error(message);
} catch (x) {}
}
};
}
module.exports = warning;
}).call(this,require('_process'))
},{"./emptyFunction":143,"_process":164}],163:[function(require,module,exports){
'use strict';
module.exports = require('./lib/React');
},{"./lib/React":31}],164:[function(require,module,exports){
// shim for using process in browser
var process = module.exports = {};
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;
function cleanUpNextTick() {
draining = false;
if (currentQueue.length) {
queue = currentQueue.concat(queue);
} else {
queueIndex = -1;
}
if (queue.length) {
drainQueue();
}
}
function drainQueue() {
if (draining) {
return;
}
var timeout = setTimeout(cleanUpNextTick);
draining = true;
var len = queue.length;
while(len) {
currentQueue = queue;
queue = [];
while (++queueIndex < len) {
if (currentQueue) {
currentQueue[queueIndex].run();
}
}
queueIndex = -1;
len = queue.length;
}
currentQueue = null;
draining = false;
clearTimeout(timeout);
}
process.nextTick = function (fun) {
var args = new Array(arguments.length - 1);
if (arguments.length > 1) {
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
}
queue.push(new Item(fun, args));
if (queue.length === 1 && !draining) {
setTimeout(drainQueue, 0);
}
};
// v8 likes predictible objects
function Item(fun, array) {
this.fun = fun;
this.array = array;
}
Item.prototype.run = function () {
this.fun.apply(null, this.array);
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.binding = function (name) {
throw new Error('process.binding is not supported');
};
process.cwd = function () { return '/' };
process.chdir = function (dir) {
throw new Error('process.chdir is not supported');
};
process.umask = function() { return 0; };
},{}],165:[function(require,module,exports){
var React = require('react');
var LocationForm = require('./LocationForm');
var LocationList = require('./LocationList');
var LocationBox = React.createClass({displayName: "LocationBox",
handleLocationAdd: function (newLoc) {
console.log("location add", newLoc);
var newLocations = this.props.locations.concat([newLoc]);
this.props.stateHandler({ locations: newLocations, searchBoxValue: "" }, '/api/weather/location/add', 'POST', newLoc);
},
handleLocationDelete: function (locationId) {
var newLocations = this.props.locations.filter(function(loc){
return loc.locId !== locationId;
});
this.props.stateHandler({ locations: newLocations }, '/api/weather/location/delete', 'POST', { id: locationId });
},
handleLocationSelect: function(index) {
//set all locations as unselected
var newLocations = this.props.locations.map(function (location) {
location.selected = false;
return location;
});
//"select" the single location
newLocations[index].selected = 'true';
this.props.stateHandler({ locations: newLocations, selectedLocation: newLocations[index] });
},
render: function () {
return (
React.createElement("div", {className: "locationBox col-md-4"},
React.createElement("h3", null, "Locations"),
React.createElement(LocationForm, {
addLocClick: this.handleLocationAdd,
searchBoxValue: this.props.searchBoxValue}
),
React.createElement(LocationList, {
className: "location-list",
locations: this.props.locations,
deleteHandler: this.handleLocationDelete,
makeSelected: this.handleLocationSelect}
)
)
)
}
});
module.exports = LocationBox;
},{"./LocationForm":167,"./LocationList":168,"react":163}],166:[function(require,module,exports){
var React = require('react');
var WeatherHeader = require('./WeatherHeader')
var LocationDashboard = React.createClass({displayName: "LocationDashboard",
render: function () {
return (
React.createElement("div", {className: "col-md-8"},
React.createElement(WeatherHeader, {
locationTitle: this.props.weatherData.title,
currently: this.props.weatherData.currently}
),
React.createElement("div", {id: "tabs", className: "tabbable"},
React.createElement("ul", {className: "nav nav-tabs"},
React.createElement("li", {className: "active"}, React.createElement("a", {href: "#panel-806764", "data-toggle": "tab"}, "Forecast"))
),
React.createElement("div", {className: "tab-content"},
React.createElement("div", {id: "panel-806764", className: "tab-pane active"},
React.createElement("p", {dangerouslySetInnerHTML: {__html:this.props.weatherData.description}})
)
)
)
)
)
}
});
module.exports = LocationDashboard;
},{"./WeatherHeader":170,"react":163}],167:[function(require,module,exports){
var React = require('react'),
Autosuggest = require('react-autosuggest');
var LocationForm = React.createClass({displayName: "LocationForm",
getSuggestions: function (input, callback) {
$.get('/api/weather/locationsearch/' + input, function(suggestions) {
setTimeout(callback(null, suggestions.predictions), 300); // Emulate API call
}.bind(this));
},
renderSuggestion: function (suggestion, input) { // In this example, 'suggestion' is a string
return ( // and it returns a ReactElement
React.createElement("span", null, suggestion.description)
);
},
onSuggestionSelected: function(suggestion, event) {
setTimeout(function(){
$('.react-autosuggest input').val('');
},100)
this.props.addLocClick(suggestion);
},
getSuggestionValue: function (suggestionObj) {
return suggestionObj.description;
},
render: function () {
return (
React.createElement("div", {className: "form-group"},
React.createElement(Autosuggest, {
className: "form-control",
id: "search-box",
type: "text",
focusInputOnSuggestionClick: false,
value: this.props.searchBoxValue,
suggestions: this.getSuggestions,
suggestionRenderer: this.renderSuggestion,
onSuggestionSelected: this.onSuggestionSelected,
suggestionValue: this.getSuggestionValue,
showWhen: input => input.trim().length >= 3}
)
)
)
}
});
module.exports = LocationForm;
},{"react":163,"react-autosuggest":1}],168:[function(require,module,exports){
var React = require('react');
var LocationListItem = require('./LocationListItem');
var LocationList = React.createClass({displayName: "LocationList",
generateClass: function(selected) {
var classes = {
"panel-body": true,
"selected": selected ? true : false
};
var classArr = [];
for(var propt in classes){
if (classes[propt]) classArr.push(propt);
}
return classArr.join(" ");
},
render: function () {
var locs = [];
if (this.props.locations.length) {
locs = this.props.locations.map(function(location, index) {
location.classes = this.generateClass(location.selected);
return (
React.createElement(LocationListItem, {
locationName: location.description,
locId: location.locId,
key: location.locId,
index: index,
doDelete: this.props.deleteHandler,
classes: location.classes,
onSelectClick: this.props.makeSelected}
)
);
}, this);
}
return (
React.createElement("div", {className: "panel panel-default"},
locs
)
)
}
});
module.exports = LocationList;
},{"./LocationListItem":169,"react":163}],169:[function(require,module,exports){
var React = require('react');
// var classNames = require( 'classnames' );
var LocationListItem = React.createClass({displayName: "LocationListItem",
doDelete: function (locationId, e) {
console.log('do delete');
var proceed = confirm("Are you sure you want to delete this location?");
if (proceed) this.props.doDelete(locationId);
},
render: function () {
var locationName = this.props.locationName;
return (
React.createElement("div", {className: this.props.classes},
React.createElement("span", {className: "deleteBtn", onClick: this.doDelete.bind(null, this.props.locId)},
React.createElement("span", null,
React.createElement("i", {className: "fa fa-2x fa-trash"}), " |"
)
),
React.createElement("span", {onClick: this.props.onSelectClick.bind(null, this.props.index)}, this.props.locationName)
)
)
}
});
module.exports = LocationListItem;
},{"react":163}],170:[function(require,module,exports){
var React = require('react');
var WeatherHeader = React.createClass({displayName: "WeatherHeader",
render: function () {
return (
React.createElement("div", null,
React.createElement("h3", null, this.props.locationTitle),
React.createElement("p", {className: "text-muted"},
React.createElement("em", null, this.props.currently)
)
)
)
}
});
module.exports = WeatherHeader;
},{"react":163}],171:[function(require,module,exports){
var React = require('react');
var LocationBox = require('./LocationBox');
var LocationDashboard = require('./LocationDashboard');
var WeatherParent = React.createClass({displayName: "WeatherParent",
getInitialState: function () {
return {
selectedLocation: "",
searchBoxValue: "",
weatherData: "",
locations: []
};
},
stateHandler: function(newState, url, type, data) {
//set state if the first arg isn't null
if (newState !== null) {
this.setState(newState);
}
//get weather data if selected Location just changed
if ("selectedLocation" in newState) {
console.log('placeId', newState.selectedLocation.placeId);
$.get('api/weather/location/detail/' + newState.selectedLocation.placeId, function (googleLoc) {
this.getWeatherData(googleLoc.result)
}.bind(this));
}
//return if a url is not passed (we only want to set state)
if (!url) return;
$.ajax({
type: type,
url: url,
contentType: 'application/json',
// dataType: 'json',
data: JSON.stringify(data),
success: function(data){
if (data.weatherLocations) this.stateHandler({locations: data.weatherLocations})
}.bind(this)
});
},
componentDidMount: function() {
/**
* When the component mounts, get a list of the user's locations
*/
$.get(this.props.source, function(result) {
if (this.isMounted()) {
this.setState({
locations: result ? result.weatherLocations : []
});
}
}.bind(this));
},
componentDidUpdate: function(params) {
// update event handler
},
getWeatherData: function (location) {
var latLong = location.geometry.location.lat + "," + location.geometry.location.lng
$.simpleWeather({
location: latLong,
unit: 'f',
success: function(weather) {
this.setState({weatherData: weather});
}.bind(this),
error: function(error) {
console.log('weather error', error);
}
}).bind(this);
},
render: function () {
return (
React.createElement("div", {className: "row"},
React.createElement(LocationBox, {
locations: this.state.locations,
stateHandler: this.stateHandler,
searchBoxValue: this.state.searchBoxValue,
getWeatherData: this.getWeatherData}
),
React.createElement(LocationDashboard, {
weatherData: this.state.weatherData}
)
)
)
}
});
module.exports = WeatherParent;
},{"./LocationBox":165,"./LocationDashboard":166,"react":163}],172:[function(require,module,exports){
var ReactDOM = require('react-dom');
var React = require('react');
var WeatherParent = require('./WeatherParent');
var reactComponent = ReactDOM.render(
React.createElement(WeatherParent, {
source: "/api/weather/locations/get",
delUrl: "/api/weather/locations/delete"}
),
document.getElementById('weatherParent')
)
// var reactComponent = ReactDOM.render(
// <LocationBox
// source="/api/weather/locations/get"
// delUrl="/api/weather/locations/delete"
// />,
// <LocationDashboard/>,
// document.getElementById('locationCol')
// )
},{"./WeatherParent":171,"react":163,"react-dom":7}]},{},[172]);
| benwells/admin.mrbenwells.com | public/js/weather/build/weatherapp.js | JavaScript | mit | 709,898 |
<?php
namespace Admin\NavMenuBundle\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Admin\NavMenuBundle\Entity\NavMenu;
use Admin\NavMenuBundle\Form\NavMenuType;
use Admin\NavMenuBundle\Helpers\Tree\Navigation\AdminNavigationTree;
use Admin\PageBundle\Helpers\Tree\Page\AdminPageTree;
use Symfony\Component\HttpFoundation\Response;
/**
* NavMenu controller.
*
*/
class NavMenuController extends Controller
{
/**
* Lists all NavMenu entities.
*
*/
public function indexAction( $position )
{
$em = $this->getDoctrine()->getManager();
$entities = $em->getRepository('NavMenuBundle:NavMenu')->findByPosition( $position );
//echo $url = $this->generateUrl('navmenu_edit', array('id' => 1, 'position'=>'left')); die();
$tree = new AdminNavigationTree( $this );
$navTree = $tree->createTree($entities);
return $this->render('NavMenuBundle:NavMenu:index.html.twig', array(
'entities' => $entities, 'navTree' => $navTree,
'nav_position' => $position
));
}
/**
* Creates a new NavMenu entity.
*
*/
public function createAction( Request $request)
{
$entity = new NavMenu();
$em = $this->getDoctrine()->getManager();
$pages = $em->getRepository('PageBundle:Page')->findAll();
$position = $request->request->get('position');
$form = $this->createForm(new NavMenuType( $position ), $entity);
$form->submit($request);
$tree = new AdminPageTree();
$pageTree = $tree->createTree( $pages );
if ($form->isValid()) {
$entity->setUserId( $this->get('security.context')->getToken()->getUser()->getId() );
$em->persist($entity);
$em->flush();
$url = $this->generateUrl('navmenu' );
$url .= '/' . $entity->getPosition();
return $this->redirect( $url );
}
return $this->render('NavMenuBundle:NavMenu:new.html.twig', array(
'entity' => $entity,
'form' => $form->createView(),
'pageTree' => $pageTree,
'nav_position' => 'top'
));
}
/**
* Displays a form to create a new NavMenu entity.
*
*/
public function newAction( $position )
{
$entity = new NavMenu();
$em = $this->getDoctrine()->getManager();
$pages = $em->getRepository('PageBundle:Page')->findAll();
$form = $this->createForm(new NavMenuType( $position ), $entity);
$tree = new AdminPageTree();
$pageTree = $tree->createTree( $pages );
return $this->render('NavMenuBundle:NavMenu:new.html.twig', array(
'entity' => $entity,
'form' => $form->createView(),
'pageTree' => $pageTree,
'nav_position' => $position
));
}
/**
* Finds and displays a NavMenu entity.
*
*/
public function showAction($id)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('NavMenuBundle:NavMenu')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find NavMenu entity.');
}
$deleteForm = $this->createDeleteForm($id);
return $this->render('NavMenuBundle:NavMenu:show.html.twig', array(
'entity' => $entity,
'delete_form' => $deleteForm->createView(), ));
}
/**
* Displays a form to edit an existing NavMenu entity.
*
*/
public function editAction($id, $position, $locale)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('NavMenuBundle:NavMenu')->find($id);
$entity->setTranslatableLocale($locale);
$em->refresh($entity);
$pages = $em->getRepository('PageBundle:Page')->findAll();
$tree = new AdminPageTree();
$pageTree = $tree->createTree( $pages );
if (!$entity) {
throw $this->createNotFoundException('Unable to find NavMenu entity.');
}
$editForm = $this->createForm( new NavMenuType( $entity->getPosition() ), $entity );
$deleteForm = $this->createDeleteForm($id);
return $this->render('NavMenuBundle:NavMenu:edit.html.twig', array(
'entity' => $entity,
'edit_form' => $editForm->createView(),
'delete_form' => $deleteForm->createView(),
'pageTree' => $pageTree,
'position' => $position
));
}
/**
* Edits an existing NavMenu entity.
*
*/
public function updateAction(Request $request, $id, $position, $locale)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('NavMenuBundle:NavMenu')->find($id);
$entity->setTranslatableLocale($locale);
if (!$entity) {
throw $this->createNotFoundException('Unable to find NavMenu entity.');
}
$deleteForm = $this->createDeleteForm($id);
$editForm = $this->createForm(new NavMenuType( $entity->getPosition() ), $entity);
$editForm->submit($request);
if ($editForm->isValid()) {
$entity->setUserId( $this->get('security.context')->getToken()->getUser()->getId() );
$em->persist($entity);
$em->flush();
return $this->redirect($this->generateUrl('navmenu_edit', array('id' => $id, 'position' => $position, 'locale'=>$locale)));
}
return $this->render('NavMenuBundle:NavMenu:edit.html.twig', array(
'entity' => $entity,
'edit_form' => $editForm->createView(),
'delete_form' => $deleteForm->createView(),
'position' => $position
));
}
/**
* Deletes a NavMenu entity.
*
*/
public function deleteAction(Request $request, $id)
{
$form = $this->createDeleteForm($id);
$form->submit($request);
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('NavMenuBundle:NavMenu')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find NavMenu entity.');
}
$em->remove($entity);
$em->flush();
}
return $this->redirect($this->generateUrl('navmenu'));
}
/**
* Creates a form to delete a NavMenu entity by id.
*
* @param mixed $id The entity id
*
* @return \Symfony\Component\Form\Form The form
*/
private function createDeleteForm($id)
{
return $this->createFormBuilder(array('id' => $id))
->add('id', 'hidden')
->getForm()
;
}
public function arangeAction(Request $request, $position)
{
$navTree = $request->request->get('nav_tree');
$tree = new AdminNavigationTree( $this );
$nav = $tree->treeToArray( $navTree );
$em = $this->getDoctrine()->getManager();
$i = 0;
foreach( $nav as $n ){
$entity = $em->getRepository('NavMenuBundle:NavMenu')->find($n['id']);
$entity->setParentId( $n['parentId'] );
$entity->setSort( $i );
$em->persist($entity);
$em->flush();
$i++;
}
$response = new Response('Hello '.'arange', 200);
$response = new Response(json_encode(array('status' => true, 'arange' => true)));
$response->headers->set('Content-Type', 'application/json');
return $response;
}
}
| azdevelop/uprava | src/Admin/NavMenuBundle/Controller/NavMenuController.php | PHP | mit | 7,749 |
package com.fionapet.business.facade;
import com.fionapet.business.entity.Warehouse;
import org.dubbo.x.service.CURDService;
import org.dubbo.x.facade.RestServiceBase;
import com.fionapet.business.service.WarehouseService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* 仓库信息表
* Created by tom on 2016-08-27 10:45:14.
*/
public class WarehouseRestServiceImpl extends RestServiceBase<Warehouse> implements WarehouseRestService {
private static final Logger LOGGER = LoggerFactory.getLogger(WarehouseRestServiceImpl.class);
private WarehouseService warehouseService;
public WarehouseService getWarehouseService() {
return warehouseService;
}
public void setWarehouseService(WarehouseService warehouseService) {
this.warehouseService = warehouseService;
}
@Override
public CURDService<Warehouse> getService() {
return warehouseService;
}
}
| bqw5189/pet-hospital | fionapet-business/fionapet-business-rest-provider/src/main/java/com/fionapet/business/facade/WarehouseRestServiceImpl.java | Java | mit | 932 |
import React, { Component } from 'react';
import { connect } from 'react-redux';
import Landing from '../pages/Landing';
import { setAuthenticated } from '../actions/app';
export default function(ComposedComponent){
class Authenticate extends Component {
setAuthenticated(state){
this.props.setAuthenticated(state);
}
componentWillMount(){
/*
let location = window.location.pathname;
console.log(location);
let self = this;
let userPool = this.props.app.aws.cognito.userPool;
let cognitoUser = userPool.getCurrentUser();
if(cognitoUser !== null){
this.setAuthenticated(true);
return
} else {
if(location == "/"){
return;
}
if(!location == "/"){
self.context.router.push("/login");
}
}
*/
}
componentWillUpdate(nextProps){
/*
let location = window.location.pathname;
let userPool = this.props.app.aws.cognito.userPool;
let cognitoUser = userPool.getCurrentUser();
if(location == "/"){
return;
}
if(cognitoUser == null){
this.context.router.push("/login");
}
*/
}
render(){
if(this.props.app.isAuthenticated === false){
return (
<ComposedComponent>
<Landing { ...this.props } />
</ComposedComponent>
);
} else {
return (
<ComposedComponent>
{ this.props.children }
</ComposedComponent>
);
}
}
}
const mapDispatchToProps = (dispatch) => {
return {
setAuthenticated: (state) => {
dispatch(setAuthenticated(state));
},
setAWSCognitoUserPool: (userPoolId, clientId) => {
let poolData = {
UserPoolId: userPoolId,
ClientId: clientId
};
let userPool = new CognitoUserPool(poolData);
dispatch(setAWSCognitoUserPool(userPool));
}
};
};
function mapStateToProps(state, ownProps){
return {
app: state.app
};
}
Authenticate.contextTypes = {
router: React.PropTypes.object.isRequired
};
return connect(mapStateToProps, mapDispatchToProps)(Authenticate);
}
| jeffersonsteelflex69/mytv | client/src/utils/AuthRequired.js | JavaScript | mit | 2,006 |
var class_all_pawns_must_die_1_1_uci_init_command =
[
[ "Execute", "class_all_pawns_must_die_1_1_uci_init_command.html#a05a5de2a2813a65504aa70b98a397f14", null ]
]; | manixaist/AllPawnsMustDie | docs/html/class_all_pawns_must_die_1_1_uci_init_command.js | JavaScript | mit | 168 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-06-27 07:56
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('posts', '0020_auto_20160627_0139'),
]
operations = [
migrations.RemoveField(
model_name='like',
name='company',
),
migrations.RemoveField(
model_name='like',
name='user',
),
migrations.DeleteModel(
name='Like',
),
]
| iharsh234/eElectronics | posts/migrations/0021_auto_20160627_1326.py | Python | mit | 580 |
class ChannelPolicy < ApplicationPolicy
def admin?
user.present? && (record.user == user ||
record.members.include?(user) ||
is_admin?
)
end
class Scope < Struct.new(:user, :scope)
def resolve
if user.admin?
scope
else
owned = scope.where(user: user)
membered = scope.where(id: user.channels.map(&:id))
online = scope.with_state('online')
scope.from("(#{owned.to_sql} UNION #{membered.to_sql} UNION #{online.to_sql}) as channels")
end
end
end
end
| MicroPasts/micropasts-crowdfunding | app/policies/channel_policy.rb | Ruby | mit | 591 |
<?php
abstract class Gwilym_FSM_StreamParser extends Gwilym_FSM
{
protected $_originalStream;
protected $_stream;
protected $_opener;
public function __construct ($stream)
{
parent::__construct();
$this->_originalStream = $stream;
}
public function start ()
{
if (!$this->_started) {
if (is_resource($this->_originalStream)) {
$this->_stream = $this->_originalStream;
$this->_opener = false;
} else {
$this->_stream = fopen($this->_originalStream, 'r');
$this->_opener = true;
}
fseek($this->_stream, 0);
}
parent::start();
}
public function stop ()
{
if ($this->_started) {
if ($this->_opener) {
fclose($this->_stream);
}
$this->_stream = null;
}
parent::stop();
}
}
| gwilym/gwilym-php | lib/Gwilym/FSM/StreamParser.php | PHP | mit | 744 |
<?php
namespace Drupal\nine_mobile_product\Form;
use Drupal\taxonomy\Entity\Term;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Database\Connection;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Ajax\AjaxResponse;
use Drupal\Core\Ajax\OpenDialogCommand;
/**
* Class NineMobileListMobileForm.
*
* @package Drupal\nine_mobile_product\Form
*/
class NineMobileListMobileForm extends FormBase {
/**
* @var \Drupal\Core\Database\Connection
*/
protected $connection;
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'nine_mobile_list_mobile_form';
}
/**
* Class constructor.
*/
public function __construct(Connection $connection) {
$this->connection = $connection;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
// Instantiates this form class.
return new static(
// Load the service required to construct this class.
$container->get('database')
);
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$brands = $form_state->getValue('brands');
if ($brands) {
$brands = array_filter($brands);
}
$form['#attached']['library'][] = 'core/drupal.dialog.ajax';
// Brand.
$connection = $this->connection;
$query = $connection->select('search_api_db_product_index', 'i');
$query->fields('i', ['field_brand']);
$query->addExpression('COUNT(*)', 'count');
$query->groupBy('i.field_brand');
$query->orderBy('count', 'DESC');
$result = $query->execute();
$options = [];
while ($record = $result->fetchAssoc()) {
$term = Term::load($record['field_brand']);
$options[$term->id()] = $term->getName();
}
$form['brands'] = [
'#type' => 'checkboxes',
'#options' => $options,
'#title' => $this->t('Brands'),
'#ajax' => [
'callback' => [get_called_class(), 'uploadAjaxCallback'],
'wrapper' => 'edit-product-list',
],
];
// Color.
$colors = $form_state->getValue('colors');
if ($colors) {
$colors = array_filter($colors);
}
$options = [];
$query = $connection->select('search_api_db_product_index', 'i');
$query->fields('i', ['color_name']);
$query->addExpression('COUNT(*)', 'count');
$query->groupBy('i.color_name');
$query->orderBy('count', 'DESC');
$result = $query->execute();
while ($record = $result->fetchAssoc()) {
// $term = \Drupal\taxonomy\Entity\Term::load($record['color_name']);.
$options[$record['color_name']] = $record['color_name'];
}
$form['colors'] = [
'#type' => 'checkboxes',
'#options' => $options,
'#title' => $this->t('Colors'),
'#ajax' => [
'callback' => [get_called_class(), 'uploadAjaxCallback'],
'wrapper' => 'edit-product-list',
],
];
// operating_system.
$operating_system = $form_state->getValue('operating_system');
if ($operating_system) {
$operating_system = array_filter($operating_system);
}
$options = [];
$query = $connection->select('search_api_db_product_index', 'i');
$query->fields('i', ['field_operating_system']);
$query->addExpression('COUNT(*)', 'count');
$query->groupBy('i.field_operating_system');
$query->orderBy('count', 'DESC');
$result = $query->execute();
while ($record = $result->fetchAssoc()) {
$term = Term::load($record['field_operating_system']);
$options[$term->id()] = $term->getName();
}
$form['operating_system'] = [
'#type' => 'checkboxes',
'#options' => $options,
'#title' => $this->t('Operating system'),
'#ajax' => [
'callback' => [get_called_class(), 'uploadAjaxCallback'],
'wrapper' => 'product-list',
],
];
// Condition/availability.
$condition_availability = $form_state->getValue('condition_availability');
if ($condition_availability) {
$condition_availability = array_filter($condition_availability);
}
$options = [];
$query = $connection->select('search_api_db_product_index', 'i');
$query->fields('i', ['field_condition_availability']);
$query->addExpression('COUNT(*)', 'count');
$query->groupBy('i.field_condition_availability');
$query->orderBy('count', 'DESC');
$result = $query->execute();
while ($record = $result->fetchAssoc()) {
$term = Term::load($record['field_condition_availability']);
$options[$term->id()] = $term->getName();
}
$form['condition_availability'] = [
'#type' => 'checkboxes',
'#options' => $options,
'#title' => $this->t('Condition/availability'),
'#ajax' => [
'callback' => [get_called_class(), 'uploadAjaxCallback'],
'wrapper' => 'product-list',
],
];
if (!empty($form_state->getValues())) {
$filters = [
'brands' => $brands,
'colors' => $colors,
'condition_availability' => $condition_availability,
'operating_system' => $operating_system,
];
// $product_ids = $this->getProductIdsByFilter($filters);
}
else {
}
$view = views_embed_view('product', 'block_1');
// Default
// $view = \Drupal::service('renderer')->render($view);
// $form['product_list'] = array(
// '#type' => 'container',
// '#attributes' => array(
// 'class' => 'accommodation',
// 'id' => 'product-list',
// ),
// 'content' => $view,.
// );.
$filters = [
'brands' => ['8'],
];
$product_ids = $this->getProductIdsByFilter($filters);
return $form;
}
/**
* Ajax callback
* We will return Ajax command
* See https://api.drupal.org/api/drupal/core!core.api.php/group/ajax/8.2.x.
*/
public static function uploadAjaxCallback($form, FormStateInterface $form_state) {
$response = new AjaxResponse();
$title = 'Hello title dialog';
$response->addCommand(new OpenDialogCommand('#product-list', $title, 'This is demo content'));
return $response;
}
/**
*
*/
public function getProductIdsByFilter($filters) {
$connection = $this->connection;
$query = $connection->select('search_api_db_product_index', 'i');
$query->fields('i', ['item_id']);
if (isset($filters['brands'])) {
$query->condition('i.field_brand', $filters['brands'], 'IN');
}
if (isset($filters['colors'])) {
$query->condition('i.color_name', $filters['brands'], 'IN');
}
if (isset($filters['condition_availability'])) {
$query->condition('i.field_condition_availability', $filters['condition_availability'], 'IN');
}
if (isset($filters['operating_system'])) {
$query->condition('i.field_operating_system', $filters['operating_system'], 'IN');
}
$query->condition('i.type', 'mobile', '=');
$result = $query->execute();
$result = $result->fetchAll();
$pids = [];
foreach ($result as $key => $value) {
$item_id = $value->item_id;
$parts = explode(':', $item_id);
$product_id = str_replace('commerce_product/', '', $parts[1]);
$pids[] = $product_id;
}
return $pids;
}
/**
* {@inheritdoc}
*/
public function validateForm(array &$form, FormStateInterface $form_state) {
parent::validateForm($form, $form_state);
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
// Display result.
foreach ($form_state->getValues() as $key => $value) {
drupal_set_message($key . ': ' . $value);
}
}
}
| tannguyen04/9mobile | web/modules/custom/nine_mobile_product/src/Form/NineMobileListMobileForm.php | PHP | mit | 7,676 |
package gwt.client.def;
import gwt.client.TCF;
import gwt.client.TConstants;
import gwt.shared.model.SDocType;
import gwt.shared.model.SFiscalYear;
import java.util.List;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.view.client.ProvidesKey;
public class DocTypeListDefImpl extends ListDef<SFiscalYear, SDocType> {
private static final TConstants constants = TCF.get();
private static DocTypeListDefImpl instance = null;
public static DocTypeListDefImpl getInstance() {
if (instance == null) {
instance = new DocTypeListDefImpl();
}
return instance;
}
@Override
public List<SDocType> getList(SFiscalYear l) {
return l.getSDocTypeList();
}
@Override
public ProvidesKey<SDocType> getKeyProvider() {
return new ProvidesKey<SDocType>() {
public Object getKey(SDocType sDocType) {
return sDocType == null ? null : sDocType.getKeyString();
}
};
}
@Override
public String getKeyString(SDocType e) {
return e == null ? null : e.getKeyString();
}
@Override
public int getColumnSize() {
return 4;
}
@Override
public String getColumnName(int i) {
switch(i){
case 0:
return constants.code();
case 1:
return constants.name();
case 2:
return constants.journalType();
case 3:
return constants.journalDesc();
default:
throw new AssertionError(i);
}
}
@Override
public String getColumnValue(SDocType sDocType, int i) {
switch(i){
case 0:
return sDocType.getCode();
case 1:
return sDocType.getName();
case 2:
return sDocType.getJournalTypeShortName();
case 3:
return sDocType.getJournalDesc();
default:
throw new AssertionError(i);
}
}
@Override
public boolean hasFooter(int i) {
return false;
}
@Override
public String getFooterValue(List<SDocType> list, int i) {
return null;
}
@Override
public boolean hasSort(int i) {
return false;
}
@Override
public int getCompare(SDocType e1, SDocType e2, int i) {
return 0;
}
@Override
public boolean hasWidth(int i) {
return false;
}
@Override
public double getWidthValue(int i) {
return 0;
}
@Override
public Unit getWidthUnit(int i) {
return null;
}
}
| witterk/thai-accounting | src/gwt/client/def/DocTypeListDefImpl.java | Java | mit | 2,758 |
/*
* File: myclass.cpp
* Author: mateus
*
* Created on December 17, 2013, 6:56 PM
*/
#include "myclass.h"
myclass::myclass() {
}
myclass::myclass(const myclass& orig) {
}
myclass::~myclass() {
}
bool myclass::operator() (int left, int right){
return true;
}
| mvendra/sandboxes | c_cpp/func_obj/myclass.cpp | C++ | mit | 277 |
package org.softuni;
import java.io.*;
import java.util.Arrays;
public class _03_CountCharacterTypes {
public static void main(String[] args) {
try (
FileReader reader = new FileReader("resources/Words.txt");
PrintWriter writer = new PrintWriter(
new FileWriter("resources/CountCharactersTypesOutput.txt"))
) {
Character[] punctuation = {
'.', ',', '!', '?',
};
Character[] vowels = {
'a', 'e', 'i', 'o', 'u',
};
Character[] consonants = {
'b', 'c', 'd', 'f', 'g',
'h', 'j', 'k', 'l', 'm',
'n', 'p', 'q', 'r', 's',
't', 'v', 'w', 'x', 'z',
'y', // Not sure if this isn't a vowel, but in the problem condition it isn't.
};
int i;
int countPunct = 0;
int countVowel = 0;
int countCons = 0;
while ((i = reader.read()) != -1) {
if (CharArrayContainsChar(punctuation, (char) i)) {
countPunct++;
} else if (CharArrayContainsChar(vowels, (char) i)) {
countVowel++;
} else if (CharArrayContainsChar(consonants, (char) i)) {
countCons++;
}
}
writer.printf("Vowels: %d\r\n", countVowel);
writer.printf("Consonants: %d\r\n", countCons);
writer.printf("Punctuation: %d\r\n", countPunct);
} catch (IOException e) {
System.out.println(e.toString());
}
}
private static boolean CharArrayContainsChar(Character[] charArr, char ch) {
Character checkChar = ch;
if (Arrays.stream(charArr).anyMatch(
c -> c.toString().equals(checkChar.toString().toLowerCase())
)) {
return true;
}
return false;
}
}
| sholev/SoftUni | Fundamentals-2.0/JavaFundamentals/Homework/JavaStreams/src/org/softuni/_03_CountCharacterTypes.java | Java | mit | 2,018 |
/* eslint-disable func-names */
/* eslint quote-props: ["error", "consistent"]*/
"use strict";
const rp = require("request-promise-native");
const Alexa = require("alexa-sdk");
const beaufort = require("beaufort-scale");
const format = require("string-format");
const APP_ID = undefined; // TODO replace with your app ID (OPTIONAL).
const languageStrings = {
"en-GB": {
translation: {
SKILL_NAME: "British Weer",
// current temp options
GET_CURRENT_MESSAGE_FEELS_LIKE: "In {city} it is currently {currentTemp} degrees, but it feels like {currentFeelsLikeTemp}.",
GET_CURRENT_MESSAGE_FEELS_LIKE_IS_CURRENT: "In {city} it is currently {currentTemp} degrees.",
GET_MAX_MIN_TEMP_MESSAGE: "The low for the rest of the day will be {dailyMinTemp} degrees with a high of {dailyMaxTemp} degrees.",
GET_WIND_MESSAGE: "Wind is currently a {windType}.",
GET_RAIN_MESSAGE_NOW: "There is a {rain.chanceOfRain} percent chance of rain this hour.",
GET_RAIN_MESSAGE_FUTURE: "There is a {rain.chanceOfRain} percent chance of rain in around {rain.hoursUntilRain} hours.",
GET_NO_RAIN_FOR_REST_OF_DAY: "There is no chance of rain for the rest of the day.",
HELP_MESSAGE: "You can say tell me the weather, or, when is it going to rain. You can also just say quit. What can I help you with?",
HELP_REPROMPT: "What can I help you with?",
STOP_MESSAGE: "Goodbye!"
}
},
"en-US": {
translation: {
SKILL_NAME: "American Weer",
// current temp options
GET_CURRENT_MESSAGE_FEELS_LIKE: "In {city} it is currently {currentTemp} degrees, but it feels like {currentFeelsLikeTemp}.",
GET_CURRENT_MESSAGE_FEELS_LIKE_IS_CURRENT: "In {city} it is currently {currentTemp} degrees.",
GET_MAX_MIN_TEMP_MESSAGE: "The low for the rest of the day will be {dailyMinTemp} degrees with a high of {dailyMaxTemp} degrees.",
GET_WIND_MESSAGE: "Wind is currently a {windType}.",
GET_RAIN_MESSAGE_NOW: "There is a {rain.chanceOfRain} percent chance of rain this hour.",
GET_RAIN_MESSAGE_FUTURE: "There is a {rain.chanceOfRain} percent chance of rain in around {rain.hoursUntilRain} hours.",
GET_NO_RAIN_FOR_REST_OF_DAY: "There is no chance of rain for the rest of the day.",
HELP_MESSAGE: "You can say tell me the weather, or, when is it going to rain. You can also just say quit. What can I help you with?",
HELP_REPROMPT: "What can I help you with?",
STOP_MESSAGE: "Goodbye!"
}
}
// 'de-DE': {
// translation: {
// FACTS: [
// 'Ein Jahr dauert auf dem Merkur nur 88 Tage.',
// 'Die Venus ist zwar weiter von der Sonne entfernt, hat aber höhere Temperaturen als Merkur.',
// 'Venus dreht sich entgegen dem Uhrzeigersinn, möglicherweise aufgrund eines früheren Zusammenstoßes mit einem Asteroiden.',
// 'Auf dem Mars erscheint die Sonne nur halb so groß wie auf der Erde.',
// 'Die Erde ist der einzige Planet, der nicht nach einem Gott benannt ist.',
// 'Jupiter hat den kürzesten Tag aller Planeten.',
// 'Die Milchstraßengalaxis wird in etwa 5 Milliarden Jahren mit der Andromeda-Galaxis zusammenstoßen.',
// 'Die Sonne macht rund 99,86 % der Masse im Sonnensystem aus.',
// 'Die Sonne ist eine fast perfekte Kugel.',
// 'Eine Sonnenfinsternis kann alle ein bis zwei Jahre eintreten. Sie ist daher ein seltenes Ereignis.',
// 'Der Saturn strahlt zweieinhalb mal mehr Energie in den Weltraum aus als er von der Sonne erhält.',
// 'Die Temperatur in der Sonne kann 15 Millionen Grad Celsius erreichen.',
// 'Der Mond entfernt sich von unserem Planeten etwa 3,8 cm pro Jahr.',
// ],
// SKILL_NAME: 'Weltraumwissen auf Deutsch',
// GET_WEATHER_MESSAGE: 'Hier sind deine Fakten: ',
// HELP_MESSAGE: 'Du kannst sagen, „Nenne mir einen Fakt über den Weltraum“, oder du kannst „Beenden“ sagen... Wie kann ich dir helfen?',
// HELP_REPROMPT: 'Wie kann ich dir helfen?',
// STOP_MESSAGE: 'Auf Wiedersehen!',
// },
// },
};
const buienRaderForecast = function(
forecast,
hours_ahead_to_check_rain,
rain_percent_threshold = 9
) {
const rain = (forecast, hours_ahead_to_check_rain) => {
// the site only returns an hours array containing the amount of hours left depending on request time
let hoursLeftInDay = Object.keys(forecast["days"][0]["hours"]).length;
let hoursToCheck;
// only go through the rest of the hours in the day, even if user asks for more
if (hoursLeftInDay < hours_ahead_to_check_rain) {
hoursToCheck = hoursLeftInDay;
} else {
hoursToCheck = hours_ahead_to_check_rain;
}
// find the hour when there is a chance of rain
forecast["days"][0]["hours"].map((hour, rain_percent_threshold) => {
let chanceOfRain = hour.precipation;
if (chanceOfRain > rain_percent_threshold) {
return {
chanceOfRain: chanceOfRain,
hoursUntilRain: i
};
}
});
return null; // there is no rain up coming
};
let currentTemp = roundFloat(forecast["days"][0]["hours"][0]["temperature"]);
let currentFeelsLikeTemp = roundFloat(
forecast["days"][0]["hours"][0]["feeltemperature"]
);
return {
dailyMaxTemp: roundFloat(forecast["days"][0]["maxtemp"]),
dailyMinTemp: roundFloat(forecast["days"][0]["mintemp"]),
currentTemp: currentTemp,
currentFeelsLikeTemp: currentFeelsLikeTemp,
feelsLikeEqualCurrentTemp: currentTemp === currentFeelsLikeTemp,
windType: beaufort(
forecast["days"][0]["hours"][0]["windspeed"]
).desc.toLowerCase(),
rain: rain(forecast, hours_ahead_to_check_rain)
};
};
// round temperatures which come in as floats
const roundFloat = float => {
return Math.round(float);
};
const handlers = {
LaunchRequest: function() {
this.emit("GetWeer");
},
GetWeerRainIntent: function() {
let options = {
uri: "https://api.buienradar.nl/data/forecast/1.1/all/2747596",
json: true
};
rp(options)
.then(weather => {
let forecast = buienRaderForecast(weather, 24, 0);
forecast["city"] = "Schiedam";
let speechOut = [];
// rain message
if (forecast.rain) {
speechOut.push(
format(
forecast.rain.hoursUntilRain > 0
? this.t("GET_RAIN_MESSAGE_FUTURE")
: this.t("GET_RAIN_MESSAGE_NOW"),
forecast
)
);
} else {
speechOut.push(this.t("GET_NO_RAIN_FOR_REST_OF_DAY"));
}
this.emit(
":tellWithCard",
speechOut.join(" "),
this.t("SKILL_NAME"),
speechOut.join(" ")
);
})
.catch(err => {
const speechOutput = "Failed to query for Weather information: " + err;
this.emit(
":tellWithCard",
speechOutput,
this.t("SKILL_NAME"),
speechOutput
);
});
},
GetWeerIntent: function() {
this.emit("GetWeer");
},
GetWeer: function() {
let options = {
uri: "https://api.buienradar.nl/data/forecast/1.1/all/2747596",
json: true
};
rp(options)
.then(weather => {
let forecast = buienRaderForecast(weather, 5);
forecast["city"] = "Schiedam";
let speechOut = [];
// get current temp
speechOut.push(
format(
forecast.feelsLikeEqualCurrentTemp
? this.t("GET_CURRENT_MESSAGE_FEELS_LIKE_IS_CURRENT")
: this.t("GET_CURRENT_MESSAGE_FEELS_LIKE"),
forecast
)
);
// min max temp message
speechOut.push(format(this.t("GET_MAX_MIN_TEMP_MESSAGE"), forecast));
// wind message
speechOut.push(format(this.t("GET_WIND_MESSAGE"), forecast));
// rain message
if (forecast.rain) {
speechOut.push(
format(
forecast.rain.hoursUntilRain > 0
? this.t("GET_RAIN_MESSAGE_FUTURE")
: this.t("GET_RAIN_MESSAGE_NOW"),
forecast
)
);
}
this.emit(
":tellWithCard",
speechOut.join(" "),
this.t("SKILL_NAME"),
speechOut.join(" ")
);
})
.catch(err => {
const speechOutput = "Failed to query for Weather information: " + err;
this.emit(
":tellWithCard",
speechOutput,
this.t("SKILL_NAME"),
speechOutput
);
});
},
"AMAZON.HelpIntent": function() {
const speechOutput = this.t("HELP_MESSAGE");
const reprompt = this.t("HELP_MESSAGE");
this.emit(":ask", speechOutput, reprompt);
},
"AMAZON.CancelIntent": function() {
this.emit(":tell", this.t("STOP_MESSAGE"));
},
"AMAZON.StopIntent": function() {
this.emit(":tell", this.t("STOP_MESSAGE"));
},
SessionEndedRequest: function() {
this.emit(":tell", this.t("STOP_MESSAGE"));
}
};
exports.handler = (event, context) => {
const alexa = Alexa.handler(event, context);
alexa.APP_ID = APP_ID;
// To enable string internationalization (i18n) features, set a resources object.
alexa.resources = languageStrings;
alexa.registerHandlers(handlers);
alexa.execute();
};
| MattHodge/alexa | buienradar/src/index.js | JavaScript | mit | 9,489 |
#include "cbookmark.h"
#include "assert/advanced_assert.h"
DISABLE_COMPILER_WARNINGS
#include <QStringBuilder>
#include <QStringList>
RESTORE_COMPILER_WARNINGS
CBookmark::CBookmark(const QString & serializedBookmark)
{
const QStringList components = serializedBookmark.split(';');
assert_and_return_r(components.size() == 2, );
filePath = components[0];
wordIndex = (size_t)components[1].toULongLong();
}
CBookmark::CBookmark(const QString& path, const size_t position) : filePath(path), wordIndex(position)
{
}
QString CBookmark::toString() const
{
return filePath % ';' % QString::number(wordIndex);
}
| VioletGiraffe/FasterThanSight | core/bookmarks/cbookmark.cpp | C++ | mit | 639 |
using System;
namespace ApiTemplate.Api.Domain.Common
{
/// <summary>
/// From Vladimir Khorikov Pluralsight course - DDD and EF Core: Preserving Encapsulation
/// https://app.pluralsight.com/library/courses/ddd-ef-core-preserving-encapsulation/table-of-contents
/// </summary>
public abstract class Entity
{
public int Id { get; set; }
protected Entity()
{
}
protected Entity(int id)
: this()
{
Id = id;
}
public override bool Equals(object obj)
{
if (!(obj is Entity other))
return false;
if (ReferenceEquals(this, other))
return true;
if (GetRealType() != other.GetRealType())
return false;
if (Id == 0 || other.Id == 0)
return false;
return Id == other.Id;
}
public static bool operator ==(Entity a, Entity b)
{
if (a is null && b is null)
return true;
if (a is null || b is null)
return false;
return a.Equals(b);
}
public static bool operator !=(Entity a, Entity b)
{
return !(a == b);
}
public override int GetHashCode()
{
return (GetRealType().ToString() + Id).GetHashCode();
}
private Type GetRealType()
{
Type type = GetType();
if (type.ToString().Contains("Castle.Proxies."))
return type.BaseType;
return type;
}
}
} | mwhelan/Specify | src/Samples/AspNetCoreApi/app/Api/Domain/Common/Entity.cs | C# | mit | 1,643 |
import time
from multiprocessing import Value
import pytest
from dash import Dash, Input, Output, State, callback_context, html, dcc, dash_table
from dash.exceptions import PreventUpdate
def test_cbmt001_called_multiple_times_and_out_of_order(dash_duo):
app = Dash(__name__)
app.layout = html.Div([html.Button(id="input", n_clicks=0), html.Div(id="output")])
call_count = Value("i", 0)
@app.callback(Output("output", "children"), [Input("input", "n_clicks")])
def update_output(n_clicks):
call_count.value = call_count.value + 1
if n_clicks == 1:
time.sleep(1)
return n_clicks
dash_duo.start_server(app)
dash_duo.multiple_click("#input", clicks=3)
time.sleep(3)
assert call_count.value == 4, "get called 4 times"
assert dash_duo.find_element("#output").text == "3", "clicked button 3 times"
assert not dash_duo.redux_state_is_loading
dash_duo.percy_snapshot(
name="test_callbacks_called_multiple_times_and_out_of_order"
)
def test_cbmt002_canceled_intermediate_callback(dash_duo):
# see https://github.com/plotly/dash/issues/1053
app = Dash(__name__)
app.layout = html.Div(
[
dcc.Input(id="a", value="x"),
html.Div("b", id="b"),
html.Div("c", id="c"),
html.Div(id="out"),
]
)
@app.callback(
Output("out", "children"),
[Input("a", "value"), Input("b", "children"), Input("c", "children")],
)
def set_out(a, b, c):
return "{}/{}/{}".format(a, b, c)
@app.callback(Output("b", "children"), [Input("a", "value")])
def set_b(a):
raise PreventUpdate
@app.callback(Output("c", "children"), [Input("a", "value")])
def set_c(a):
return a
dash_duo.start_server(app)
dash_duo.wait_for_text_to_equal("#out", "x/b/x")
chars = "x"
for i in list(range(10)) * 2:
dash_duo.find_element("#a").send_keys(str(i))
chars += str(i)
dash_duo.wait_for_text_to_equal("#out", "{0}/b/{0}".format(chars))
def test_cbmt003_chain_with_table(dash_duo):
# see https://github.com/plotly/dash/issues/1071
app = Dash(__name__)
app.layout = html.Div(
[
html.Div(id="a1"),
html.Div(id="a2"),
html.Div(id="b1"),
html.H1(id="b2"),
html.Button("Update", id="button"),
dash_table.DataTable(id="table"),
]
)
@app.callback(
# Changing the order of outputs here fixes the issue
[Output("a2", "children"), Output("a1", "children")],
[Input("button", "n_clicks")],
)
def a12(n):
return "a2: {!s}".format(n), "a1: {!s}".format(n)
@app.callback(Output("b1", "children"), [Input("a1", "children")])
def b1(a1):
return "b1: '{!s}'".format(a1)
@app.callback(
Output("b2", "children"),
[Input("a2", "children"), Input("table", "selected_cells")],
)
def b2(a2, selected_cells):
return "b2: '{!s}', {!s}".format(a2, selected_cells)
dash_duo.start_server(app)
dash_duo.wait_for_text_to_equal("#a1", "a1: None")
dash_duo.wait_for_text_to_equal("#a2", "a2: None")
dash_duo.wait_for_text_to_equal("#b1", "b1: 'a1: None'")
dash_duo.wait_for_text_to_equal("#b2", "b2: 'a2: None', None")
dash_duo.find_element("#button").click()
dash_duo.wait_for_text_to_equal("#a1", "a1: 1")
dash_duo.wait_for_text_to_equal("#a2", "a2: 1")
dash_duo.wait_for_text_to_equal("#b1", "b1: 'a1: 1'")
dash_duo.wait_for_text_to_equal("#b2", "b2: 'a2: 1', None")
dash_duo.find_element("#button").click()
dash_duo.wait_for_text_to_equal("#a1", "a1: 2")
dash_duo.wait_for_text_to_equal("#a2", "a2: 2")
dash_duo.wait_for_text_to_equal("#b1", "b1: 'a1: 2'")
dash_duo.wait_for_text_to_equal("#b2", "b2: 'a2: 2', None")
@pytest.mark.parametrize("MULTI", [False, True])
def test_cbmt004_chain_with_sliders(MULTI, dash_duo):
app = Dash(__name__)
app.layout = html.Div(
[
html.Button("Button", id="button"),
html.Div(
[
html.Label(id="label1"),
dcc.Slider(id="slider1", min=0, max=10, value=0),
]
),
html.Div(
[
html.Label(id="label2"),
dcc.Slider(id="slider2", min=0, max=10, value=0),
]
),
]
)
if MULTI:
@app.callback(
[Output("slider1", "value"), Output("slider2", "value")],
[Input("button", "n_clicks")],
)
def update_slider_vals(n):
if not n:
raise PreventUpdate
return n, n
else:
@app.callback(Output("slider1", "value"), [Input("button", "n_clicks")])
def update_slider1_val(n):
if not n:
raise PreventUpdate
return n
@app.callback(Output("slider2", "value"), [Input("button", "n_clicks")])
def update_slider2_val(n):
if not n:
raise PreventUpdate
return n
@app.callback(Output("label1", "children"), [Input("slider1", "value")])
def update_slider1_label(val):
return "Slider1 value {}".format(val)
@app.callback(Output("label2", "children"), [Input("slider2", "value")])
def update_slider2_label(val):
return "Slider2 value {}".format(val)
dash_duo.start_server(app)
dash_duo.wait_for_text_to_equal("#label1", "")
dash_duo.wait_for_text_to_equal("#label2", "")
dash_duo.find_element("#button").click()
dash_duo.wait_for_text_to_equal("#label1", "Slider1 value 1")
dash_duo.wait_for_text_to_equal("#label2", "Slider2 value 1")
dash_duo.find_element("#button").click()
dash_duo.wait_for_text_to_equal("#label1", "Slider1 value 2")
dash_duo.wait_for_text_to_equal("#label2", "Slider2 value 2")
def test_cbmt005_multi_converging_chain(dash_duo):
app = Dash(__name__)
app.layout = html.Div(
[
html.Button("Button 1", id="b1"),
html.Button("Button 2", id="b2"),
dcc.Slider(id="slider1", min=-5, max=5),
dcc.Slider(id="slider2", min=-5, max=5),
html.Div(id="out"),
]
)
@app.callback(
[Output("slider1", "value"), Output("slider2", "value")],
[Input("b1", "n_clicks"), Input("b2", "n_clicks")],
)
def update_sliders(button1, button2):
if not callback_context.triggered:
raise PreventUpdate
if callback_context.triggered[0]["prop_id"] == "b1.n_clicks":
return -1, -1
else:
return 1, 1
@app.callback(
Output("out", "children"),
[Input("slider1", "value"), Input("slider2", "value")],
)
def update_graph(s1, s2):
return "x={}, y={}".format(s1, s2)
dash_duo.start_server(app)
dash_duo.wait_for_text_to_equal("#out", "")
dash_duo.find_element("#b1").click()
dash_duo.wait_for_text_to_equal("#out", "x=-1, y=-1")
dash_duo.find_element("#b2").click()
dash_duo.wait_for_text_to_equal("#out", "x=1, y=1")
def test_cbmt006_derived_props(dash_duo):
app = Dash(__name__)
app.layout = html.Div(
[html.Div(id="output"), html.Button("click", id="btn"), dcc.Store(id="store")]
)
@app.callback(
Output("output", "children"),
[Input("store", "modified_timestamp")],
[State("store", "data")],
)
def on_data(ts, data):
return data
@app.callback(Output("store", "data"), [Input("btn", "n_clicks")])
def on_click(n_clicks):
return n_clicks or 0
dash_duo.start_server(app)
dash_duo.wait_for_text_to_equal("#output", "0")
dash_duo.find_element("#btn").click()
dash_duo.wait_for_text_to_equal("#output", "1")
dash_duo.find_element("#btn").click()
dash_duo.wait_for_text_to_equal("#output", "2")
def test_cbmt007_early_preventupdate_inputs_above_below(dash_duo):
app = Dash(__name__, suppress_callback_exceptions=True)
app.layout = html.Div(id="content")
@app.callback(Output("content", "children"), [Input("content", "style")])
def content(_):
return html.Div(
[
html.Div(42, id="above-in"),
html.Div(id="above-dummy"),
html.Hr(),
html.Div(0, id="above-out"),
html.Div(0, id="below-out"),
html.Hr(),
html.Div(id="below-dummy"),
html.Div(44, id="below-in"),
]
)
# Create 4 callbacks - 2 above, 2 below.
for pos in ("above", "below"):
@app.callback(
Output("{}-dummy".format(pos), "children"),
[Input("{}-dummy".format(pos), "style")],
)
def dummy(_):
raise PreventUpdate
@app.callback(
Output("{}-out".format(pos), "children"),
[Input("{}-in".format(pos), "children")],
)
def out(v):
return v
dash_duo.start_server(app)
# as of https://github.com/plotly/dash/issues/1223, above-out would be 0
dash_duo.wait_for_text_to_equal("#above-out", "42")
dash_duo.wait_for_text_to_equal("#below-out", "44")
def test_cbmt008_direct_chain(dash_duo):
app = Dash(__name__)
app.layout = html.Div(
[
dcc.Input(id="input-1", value="input 1"),
dcc.Input(id="input-2"),
html.Div("test", id="output"),
]
)
call_counts = {"output": Value("i", 0), "input-2": Value("i", 0)}
@app.callback(Output("input-2", "value"), Input("input-1", "value"))
def update_input(input1):
call_counts["input-2"].value += 1
return "<<{}>>".format(input1)
@app.callback(
Output("output", "children"),
Input("input-1", "value"),
Input("input-2", "value"),
)
def update_output(input1, input2):
call_counts["output"].value += 1
return "{} + {}".format(input1, input2)
dash_duo.start_server(app)
dash_duo.wait_for_text_to_equal("#input-1", "input 1")
dash_duo.wait_for_text_to_equal("#input-2", "<<input 1>>")
dash_duo.wait_for_text_to_equal("#output", "input 1 + <<input 1>>")
assert call_counts["output"].value == 1
assert call_counts["input-2"].value == 1
dash_duo.find_element("#input-1").send_keys("x")
dash_duo.wait_for_text_to_equal("#input-1", "input 1x")
dash_duo.wait_for_text_to_equal("#input-2", "<<input 1x>>")
dash_duo.wait_for_text_to_equal("#output", "input 1x + <<input 1x>>")
assert call_counts["output"].value == 2
assert call_counts["input-2"].value == 2
dash_duo.find_element("#input-2").send_keys("y")
dash_duo.wait_for_text_to_equal("#input-2", "<<input 1x>>y")
dash_duo.wait_for_text_to_equal("#output", "input 1x + <<input 1x>>y")
dash_duo.wait_for_text_to_equal("#input-1", "input 1x")
assert call_counts["output"].value == 3
assert call_counts["input-2"].value == 2
def test_cbmt009_branched_chain(dash_duo):
app = Dash(__name__)
app.layout = html.Div(
[
dcc.Input(id="grandparent", value="input 1"),
dcc.Input(id="parent-a"),
dcc.Input(id="parent-b"),
html.Div(id="child-a"),
html.Div(id="child-b"),
]
)
call_counts = {
"parent-a": Value("i", 0),
"parent-b": Value("i", 0),
"child-a": Value("i", 0),
"child-b": Value("i", 0),
}
@app.callback(Output("parent-a", "value"), Input("grandparent", "value"))
def update_parenta(value):
call_counts["parent-a"].value += 1
return "a: {}".format(value)
@app.callback(Output("parent-b", "value"), Input("grandparent", "value"))
def update_parentb(value):
time.sleep(0.2)
call_counts["parent-b"].value += 1
return "b: {}".format(value)
@app.callback(
Output("child-a", "children"),
Input("parent-a", "value"),
Input("parent-b", "value"),
)
def update_childa(parenta_value, parentb_value):
time.sleep(0.5)
call_counts["child-a"].value += 1
return "{} + {}".format(parenta_value, parentb_value)
@app.callback(
Output("child-b", "children"),
Input("parent-a", "value"),
Input("parent-b", "value"),
Input("grandparent", "value"),
)
def update_childb(parenta_value, parentb_value, grandparent_value):
call_counts["child-b"].value += 1
return "{} + {} + {}".format(parenta_value, parentb_value, grandparent_value)
dash_duo.start_server(app)
dash_duo.wait_for_text_to_equal("#child-a", "a: input 1 + b: input 1")
dash_duo.wait_for_text_to_equal("#child-b", "a: input 1 + b: input 1 + input 1")
dash_duo.wait_for_text_to_equal("#parent-a", "a: input 1")
dash_duo.wait_for_text_to_equal("#parent-b", "b: input 1")
assert call_counts["parent-a"].value == 1
assert call_counts["parent-b"].value == 1
assert call_counts["child-a"].value == 1
assert call_counts["child-b"].value == 1
def test_cbmt010_shared_grandparent(dash_duo):
app = Dash(__name__)
app.layout = html.Div(
[
html.Div("id", id="session-id"),
dcc.Dropdown(id="dropdown-1"),
dcc.Dropdown(id="dropdown-2"),
html.Div(id="output"),
]
)
options = [{"value": "a", "label": "a"}]
call_counts = {"dropdown_1": Value("i", 0), "dropdown_2": Value("i", 0)}
@app.callback(
Output("dropdown-1", "options"),
[Input("dropdown-1", "value"), Input("session-id", "children")],
)
def dropdown_1(value, session_id):
call_counts["dropdown_1"].value += 1
return options
@app.callback(
Output("dropdown-2", "options"),
Input("dropdown-2", "value"),
Input("session-id", "children"),
)
def dropdown_2(value, session_id):
call_counts["dropdown_2"].value += 1
return options
@app.callback(
Output("output", "children"),
Input("dropdown-1", "value"),
Input("dropdown-2", "value"),
)
def set_output(v1, v2):
return (v1 or "b") + (v2 or "b")
dash_duo.start_server(app)
dash_duo.wait_for_text_to_equal("#output", "bb")
assert call_counts["dropdown_1"].value == 1
assert call_counts["dropdown_2"].value == 1
assert not dash_duo.get_logs()
def test_cbmt011_callbacks_triggered_on_generated_output(dash_duo):
app = Dash(__name__, suppress_callback_exceptions=True)
call_counts = {"tab1": Value("i", 0), "tab2": Value("i", 0)}
app.layout = html.Div(
[
dcc.Dropdown(
id="outer-controls",
options=[{"label": i, "value": i} for i in ["a", "b"]],
value="a",
),
dcc.RadioItems(
options=[
{"label": "Tab 1", "value": 1},
{"label": "Tab 2", "value": 2},
],
value=1,
id="tabs",
),
html.Div(id="tab-output"),
]
)
@app.callback(Output("tab-output", "children"), Input("tabs", "value"))
def display_content(value):
return html.Div([html.Div(id="tab-{}-output".format(value))])
@app.callback(Output("tab-1-output", "children"), Input("outer-controls", "value"))
def display_tab1_output(value):
call_counts["tab1"].value += 1
return 'Selected "{}" in tab 1'.format(value)
@app.callback(Output("tab-2-output", "children"), Input("outer-controls", "value"))
def display_tab2_output(value):
call_counts["tab2"].value += 1
return 'Selected "{}" in tab 2'.format(value)
dash_duo.start_server(app)
dash_duo.wait_for_text_to_equal("#tab-output", 'Selected "a" in tab 1')
dash_duo.wait_for_text_to_equal("#tab-1-output", 'Selected "a" in tab 1')
assert call_counts["tab1"].value == 1
assert call_counts["tab2"].value == 0
dash_duo.find_elements('input[type="radio"]')[1].click()
dash_duo.wait_for_text_to_equal("#tab-output", 'Selected "a" in tab 2')
dash_duo.wait_for_text_to_equal("#tab-2-output", 'Selected "a" in tab 2')
assert call_counts["tab1"].value == 1
assert call_counts["tab2"].value == 1
assert not dash_duo.get_logs()
@pytest.mark.parametrize("generate", [False, True])
def test_cbmt012_initialization_with_overlapping_outputs(generate, dash_duo):
app = Dash(__name__, suppress_callback_exceptions=generate)
block = html.Div(
[
html.Div(id="input-1", children="input-1"),
html.Div(id="input-2", children="input-2"),
html.Div(id="input-3", children="input-3"),
html.Div(id="input-4", children="input-4"),
html.Div(id="input-5", children="input-5"),
html.Div(id="output-1"),
html.Div(id="output-2"),
html.Div(id="output-3"),
html.Div(id="output-4"),
]
)
call_counts = {
"container": Value("i", 0),
"output-1": Value("i", 0),
"output-2": Value("i", 0),
"output-3": Value("i", 0),
"output-4": Value("i", 0),
}
if generate:
app.layout = html.Div([html.Div(id="input"), html.Div(id="container")])
@app.callback(Output("container", "children"), Input("input", "children"))
def set_content(_):
call_counts["container"].value += 1
return block
else:
app.layout = block
def generate_callback(outputid):
def callback(*args):
call_counts[outputid].value += 1
return "{}, {}".format(*args)
return callback
for i in range(1, 5):
outputid = "output-{}".format(i)
app.callback(
Output(outputid, "children"),
Input("input-{}".format(i), "children"),
Input("input-{}".format(i + 1), "children"),
)(generate_callback(outputid))
dash_duo.start_server(app)
for i in range(1, 5):
outputid = "output-{}".format(i)
dash_duo.wait_for_text_to_equal(
"#{}".format(outputid), "input-{}, input-{}".format(i, i + 1)
)
assert call_counts[outputid].value == 1
assert call_counts["container"].value == (1 if generate else 0)
| plotly/dash | tests/integration/callbacks/test_multiple_callbacks.py | Python | mit | 18,497 |
/*
* This file is part of: Xfolite (J2ME XForms client)
*
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
*
* Contact: Oskari Koskimies <oskari.koskimies@nokia.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser
* General Public License along with this program.
* If not, see <http://www.gnu.org/licenses/>.
*/
package com.nokia.xfolite.xforms.dom;
import com.nokia.xfolite.xforms.model.*;
import com.nokia.xfolite.xml.dom.Document;
import com.nokia.xfolite.xml.dom.Element;
import com.nokia.xfolite.xml.dom.Node;
import com.nokia.xfolite.xml.dom.events.DOMEvent;
import com.nokia.xfolite.xml.xpath.NodeSet;
/**
* This class is used to add repeat-specific functionality to itemset class.
*/
public class RepeatElement extends ItemsetElement {
private RepeatItemElement selected;
RepeatElement(Document ownerDocument, String aNamespaceURI, String aPrefix, String aLocalName) {
super(ownerDocument, aNamespaceURI, aPrefix, aLocalName);
}
public boolean elementParsed() {
super.elementParsed();
// We need to create a group that corresponds to the repeat
// so we can easily add and delete items.
return true;
}
// Redefine not to listen for events. Repeat does not care if the children change
// Nodeset changes are always signaled with reEvaluate method.
protected void registerEventListeners() {
}
// Redefine so that we don't try to notify parent form control anymore
// Instead we should notify our own control
public void reEvaluateChildContexts(boolean force) {
//#debug info
System.out.println("Repeat: reEvaluateChildContexts");
setItems();
if (localName == "tbody") { // Rebuild table
Node parent = parentNode;
while(parent != null && parent.getLocalName() != "table") {
parent = parent.getParentNode();
}
if (parent != null) {
((XFormsElement)parent).dispatchLocalEvent(DOMEvent.XFORMS_REBUILD_CONTROL);
}
}
}
// Redefine to do nothing.
public void handleEvent(DOMEvent evt) {
}
public String getItemName() {
return "repeat-item";
}
public void setSelected(int index) {
RepeatItemElement repeatItem = getRepeatItem(index);
setSelected(index, repeatItem);
}
public void setSelected(RepeatItemElement repeatItem)
{
int index = getIndex(repeatItem);
setSelected(index, repeatItem);
}
public boolean isSelected(RepeatItemElement repeatItem) {
return selected == repeatItem;
}
private void setSelected(int index, RepeatItemElement repeatItem) {
//#debug info
System.out.println("setSelected(" + index + "," + repeatItem + ")");
if (index > 0)
{
String id = getAttribute("id");
if (id != "")
{
getModel().setRepeatIndex(id, index);
}
}
if (repeatItem != null) {
if (selected != null)
{
selected.dispatchEvent(DOMEvent.XFORMS_DESELECT);
}
selected = repeatItem;
//#debug info
System.out.println("Dispatching XFORMS_SELECT to " + selected.getLocalName() + "(" + selected.getClass().getName() + ")");
selected.dispatchEvent(DOMEvent.XFORMS_SELECT);
}
}
void clearSelected()
{
if (selected != null)
{
// TODO: Remove "selected mark" for repeat item for selected
}
selected = null;
String id = getAttribute("id");
if (id != "")
{
getModel().setRepeatIndex(id, 0);
}
}
int getIndex(RepeatItemElement item)
{
if (! isBound())
{
return 0;
}
Node node = item.getContext().contextNode;
NodeSet nodeset = binding.getBoundNodes();
int count = nodeset.getLength();
for (int i=0; i < count; i++)
{
if (node == nodeset.item(i))
{
return i+1; // First node has index 1 in XForms
}
}
return 0;
}
RepeatItemElement getRepeatItem(int index)
{
Node n = this.getFirstChild();
int curIndex = 0;
while (n != null) {
if (n instanceof RepeatItemElement) {
curIndex++;
if (curIndex == index) {
return (RepeatItemElement) n;
}
}
n = n.getNextSibling();
}
return null;
}
}
| okoskimi/Xfolite | source/com/nokia/xfolite/xforms/dom/RepeatElement.java | Java | mit | 4,838 |
import { Component } from '@angular/core';
import { Router, ActivatedRoute, Params } from '@angular/router';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'app';
}
| gersanco/modelartsstudio | client/src/app/app.component.ts | TypeScript | mit | 273 |
namespace H3Control
{
using System.Collections.Generic;
using System.Linq;
public class H3WhiteListConfig
{
public static string WhiteListArg;
public static bool HasWhiteList
{
get { return WhiteList.Count > 0; }
}
public static HashSet<string> WhiteList
{
get
{
var s = WhiteListArg;
return s != null && s.Length > 0
? new HashSet<string>(s
.Split(',', ';')
.Select(x => x.Trim())
.Where(x => x.Length > 0))
: new HashSet<string>();
}
}
}
} | devizer/h3control | H3Control/H3WhiteListConfig.cs | C# | mit | 712 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.Extensions.Logging;
using Moq;
using NUnit.Framework;
using SFA.DAS.CommitmentsV2.Application.Commands.AddCohort;
using SFA.DAS.CommitmentsV2.Data;
using SFA.DAS.CommitmentsV2.Domain.Entities;
using SFA.DAS.CommitmentsV2.Domain.Interfaces;
using SFA.DAS.CommitmentsV2.Mapping;
using SFA.DAS.CommitmentsV2.Models;
using SFA.DAS.CommitmentsV2.Types;
using SFA.DAS.Encoding;
using SFA.DAS.Testing;
namespace SFA.DAS.CommitmentsV2.UnitTests.Application.Commands
{
[TestFixture]
[Parallelizable]
public class AddCohortCommandHandlerTests : FluentTest<AddCohortCommandHandlerTestFixture>
{
[Test]
public async Task ShouldCreateCohort()
{
const string expectedHash = "ABC123";
const long providerId = 1;
const long accountId = 2;
const long accountLegalEntityId = 3;
long? transferSenderId = 4;
int? pledgeApplicationId = 5;
var fixtures = new AddCohortCommandHandlerTestFixture()
.WithGeneratedHash(expectedHash);
var response = await fixtures.Handle(accountId, accountLegalEntityId, providerId, transferSenderId, pledgeApplicationId, "Course1");
fixtures.CohortDomainServiceMock.Verify(x => x.CreateCohort(providerId, accountId, accountLegalEntityId, transferSenderId, pledgeApplicationId,
It.IsAny<DraftApprenticeshipDetails>(),
fixtures.UserInfo,
It.IsAny<CancellationToken>()));
Assert.AreEqual(expectedHash, response.Reference);
}
}
public class TestLogger : ILogger<AddCohortHandler>
{
private readonly List<(LogLevel logLevel, Exception exception, string message)> _logMessages = new List<(LogLevel logLevel, Exception exception, string message)>();
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
{
_logMessages.Add((logLevel, exception, formatter(state, exception)));
}
public bool IsEnabled(LogLevel logLevel)
{
return true;
}
public IDisposable BeginScope<TState>(TState state)
{
throw new NotImplementedException();
}
public bool HasErrors => _logMessages.Any(l => l.logLevel == LogLevel.Error);
public bool HasInfo => _logMessages.Any(l => l.logLevel == LogLevel.Information);
}
public class AddCohortCommandHandlerTestFixture
{
public ProviderCommitmentsDbContext Db { get; set; }
public Mock<Provider> Provider { get; set; }
public AddCohortCommandHandlerTestFixture()
{
Db = new ProviderCommitmentsDbContext(new DbContextOptionsBuilder<ProviderCommitmentsDbContext>()
.UseInMemoryDatabase(Guid.NewGuid().ToString())
.Options);
EncodingServiceMock = new Mock<IEncodingService>();
DraftApprenticeshipDetailsMapperMock =
new Mock<IOldMapper<AddCohortCommand, DraftApprenticeshipDetails>>();
DraftApprenticeshipDetailsMapperMock.Setup(x => x.Map(It.IsAny<AddCohortCommand>()))
.ReturnsAsync(() => new DraftApprenticeshipDetails());
var commitment = new Cohort();
commitment.Apprenticeships.Add(new DraftApprenticeship());
CohortDomainServiceMock = new Mock<ICohortDomainService>();
CohortDomainServiceMock.Setup(x => x.CreateCohort(It.IsAny<long>(), It.IsAny<long>(), It.IsAny<long>(), It.IsAny<long?>(), It.IsAny<int?>(),
It.IsAny<DraftApprenticeshipDetails>(), It.IsAny<UserInfo>(), It.IsAny<CancellationToken>()))
.ReturnsAsync(commitment);
Logger = new TestLogger();
UserInfo = new UserInfo();
}
public Mock<IEncodingService> EncodingServiceMock { get; }
public IEncodingService EncodingService => EncodingServiceMock.Object;
public Mock<IOldMapper<AddCohortCommand, DraftApprenticeshipDetails>> DraftApprenticeshipDetailsMapperMock { get; }
public Mock<ICohortDomainService> CohortDomainServiceMock { get; }
public TestLogger Logger { get; }
public UserInfo UserInfo { get; }
public AddCohortCommandHandlerTestFixture WithGeneratedHash(string hash)
{
EncodingServiceMock
.Setup(hs => hs.Encode(It.IsAny<long>(), It.Is<EncodingType>(encoding => encoding == EncodingType.CohortReference)))
.Returns(hash);
return this;
}
public async Task<AddCohortResult> Handle(long accountId, long accountLegalEntity, long providerId, long? transferSenderId, int? pledgeApplicationId, string courseCode)
{
Db.SaveChanges();
var command = new AddCohortCommand(
accountId,
accountLegalEntity,
providerId,
courseCode,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
transferSenderId,
pledgeApplicationId,
UserInfo);
var handler = new AddCohortHandler(new Lazy<ProviderCommitmentsDbContext>(() => Db),
EncodingService,
Logger,
DraftApprenticeshipDetailsMapperMock.Object,
CohortDomainServiceMock.Object);
var response = await handler.Handle(command, CancellationToken.None);
await Db.SaveChangesAsync();
return response;
}
}
} | SkillsFundingAgency/das-commitments | src/CommitmentsV2/SFA.DAS.CommitmentsV2.UnitTests/Application/Commands/AddCohortCommandHandlerTests.cs | C# | mit | 6,110 |
'use strict';
// Programs controller
angular.module('programs').controller('ProgramsController', ['$scope', '$http', '$stateParams', '$location', 'Authentication', 'Programs', 'Comments', 'ProgramsComment', 'Likes', 'ProgramsLike', 'Search',
function($scope, $http, $stateParams, $location, Authentication, Programs, Comments, ProgramsComment, Likes, ProgramsLike, Search) {
$scope.authentication = Authentication;
var geocoder;
// SearchResults for Programs
$scope.searchResults = Search.searchResults;
if ($scope.searchResults.length < 1) {
$scope.noResult = true;
} else {
$scope.noResult = false;
}
// Autocomplete
$scope.location = '';
$scope.options2 = {
country: 'ng'
};
$scope.details2 = '';
//Date picker
$scope.today = function() {
$scope.dt = new Date();
var curr_date = $scope.dt.getDate();
var curr_month = $scope.dt.getMonth();
var curr_year = $scope.dt.getFullYear();
$scope.dt = curr_year + curr_month + curr_date;
};
$scope.today();
$scope.clear = function() {
$scope.dt = null;
};
// Disable weekend selection
$scope.disabled = function(date, mode) {
return (mode === 'day' && (date.getDay() === 0 || date.getDay() === 6));
};
$scope.toggleMin = function() {
$scope.minDate = $scope.minDate ? null : new Date();
};
$scope.toggleMin();
$scope.open = function($event) {
$event.preventDefault();
$event.stopPropagation();
$scope.opened = true;
};
$scope.dateOptions = {
formatYear: 'yy',
startingDay: 1
};
$scope.formats = ['dd-MMMM-yyyy', 'yyyy/MM/dd', 'dd.MM.yyyy', 'shortDate'];
$scope.format = $scope.formats[1];
$scope.stringFiles = [];
//Image Upload
$scope.onFileSelect = function($file) {
$scope.select = $file;
if ($scope.select[0].type === 'image/gif' || $scope.select[0].type === 'image/png' || $scope.select[0].type === 'image/jpg' || $scope.select[0].type === 'image/jpeg') {
var reader = new FileReader();
reader.onload = function(e) {
$scope.stringFiles.push({
path: e.target.result
});
};
reader.readAsDataURL($scope.select[0]);
}
};
// Create new Program object
$scope.create = function() {
var program = new Programs({
category: this.category,
name: this.name,
location: this.location,
programDate: this.programDate,
description: this.description
});
program.image = $scope.stringFiles;
// Redirect after save
program.$save(function(response) {
$location.path('programs/' + response._id);
// Clear form fields
$scope.name = '';
$scope.location = '';
$scope.description = '';
}, function(errorResponse) {
$scope.error = errorResponse.data.message;
});
};
// Remove existing Program
$scope.remove = function(program) {
if (program) {
program.$remove();
for (var i in $scope.programs) {
if ($scope.programs[i] === program) {
$scope.programs.splice(i, 1);
}
}
} else {
$scope.program.$remove(function() {
$location.path('programs');
});
}
};
// Update existing Program
$scope.update = function() {
var program = $scope.program;
program.$update(function() {
$location.path('programs/' + program._id);
}, function(errorResponse) {
$scope.error = errorResponse.data.message;
});
};
// Find a list of Programs
$scope.find = function() {
$scope.programs = Programs.query().sort();
};
function fixDate(i) {
i = i.toString();
return i.length === 1 ? '0' + i : i;
}
//Find existing Program
$scope.findOne = function() {
$scope.programContent = Programs.get({
programId: $stateParams.programId
}, function(response) {
$scope.qrcodeUrl = 'https://api.qrserver.com/v1/create-qr-code/?size=350x350&data=';
// Setting Map Position
try{
geocoder = new google.maps.Geocoder();
var options = {
zoom: 17
};
var map = new google.maps.Map(document.getElementById('map_canvas'), options);
var sAddress = $scope.programContent.program.location;
geocoder.geocode({
'address': sAddress
}, function(results, status) {
if (status === google.maps.GeocoderStatus.OK) {
$scope.marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location,
animation: google.maps.Animation.BOUNCE
});
map.setCenter(results[0].geometry.location);
}
});
}
catch(e0)
{
}
$scope.program = $scope.programContent.program;
//Formating Date
var cdate = new Date($scope.program.programDate);
cdate = cdate.getFullYear() + '-' + fixDate(cdate.getMonth() + 1) + '-' + fixDate(cdate.getDate());
//Setting QR Code
var qrData = encodeURIComponent('Title: ' + $scope.program.name + '\nDescription: ' + $scope.program.description + '\nDate: ' + cdate + '\nLocation: ' + $scope.program.location);
$scope.qrcodeUrl = $scope.qrcodeUrl + qrData;
delete $scope.programContent.program;
delete $scope.programContent.userlike;
for (var i in $scope.programContent) {
$scope.program[i] = $scope.programContent[i];
}
//Check if user has liked Event before
$scope.hasLiked = $scope.programContent.userlike ? true : false;
});
//Get Program Comments
$scope.comments = ProgramsComment.query({
programId: $stateParams.programId
});
};
$scope.addComments = function() {
// Create new Comment object
var comment = new ProgramsComment({
comment: $scope.newComment
});
//Redirect after save
comment.$save({
programId: $stateParams.programId
}, function(response) {
$scope.findOne();
$scope.newComment = '';
}, function(errorResponse) {
$scope.error = errorResponse.data.message;
});
};
$scope.doLike = function() {
// Create new Like object
var likeObject = {
like: true
};
var like = new ProgramsLike(likeObject);
//Redirect after save
like.$save({
programId: $stateParams.programId
}, function(response) {
$scope.hasLiked = response;
if (response) {
if (response.like) {
$scope.program.likes.push(response._id);
} else {
var i = $scope.program.likes.indexOf(response._id);
if (i > -1) {
$scope.program.likes.splice(i, 1);
$scope.hasLiked = false;
}
}
}
}, function(errorResponse) {
$scope.error = errorResponse.data.message;
});
};
}
]);
| andela-tkomolafe/naijabuzz | public/modules/programs/controllers/programs.client.controller.js | JavaScript | mit | 8,607 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Commencement.Core.Domain;
using Commencement.Core.Helpers;
using UCDArch.Core.PersistanceSupport;
namespace Commencement.Controllers.ViewModels
{
public class TermcodeViewModel
{
public IList<vTermCode> VTermCodes;
public IList<TermCodeUnion> AllTermCodes;
public static TermcodeViewModel Create(IRepository Repository)
{
var viewModel = new TermcodeViewModel();
var termCodes = Repository.OfType<TermCode>().Queryable.OrderByDescending(a => a.IsActive).ThenBy(a => a.Id);
viewModel.AllTermCodes = termCodes.Select(a => new TermCodeUnion {IsActive = a.IsActive, IsInTermCode = true, Name = a.Name, TermCodeId = a.Id, RegistrationBegin = a.RegistrationBegin, RegistrationDeadline = a.RegistrationDeadline}).ToList();
viewModel.VTermCodes = Repository.OfType<vTermCode>().Queryable.Where(a => a.StartDate >= DateTime.UtcNow.ToPacificTime()) .ToList();
var count = 0;
foreach (var vTermCode in viewModel.VTermCodes.Where(vTermCode => !viewModel.AllTermCodes.AsQueryable().Where(a => a.TermCodeId == vTermCode.Id).Any()))
{
viewModel.AllTermCodes.Add(new TermCodeUnion(){IsActive = false, IsInTermCode = false, Name = vTermCode.Description, TermCodeId = vTermCode.Id});
count++;
if (count >= 3)
{
break;
}
}
return viewModel;
}
}
public class TermCodeUnion
{
public string TermCodeId { get; set; }
public string Name { get; set; }
public bool IsActive { get; set; }
public bool IsInTermCode { get; set; }
public DateTime RegistrationBegin { get; set; }
public DateTime RegistrationDeadline { get; set; }
}
} | ucdavis/Commencement | Commencement.Mvc/Controllers/ViewModels/TermcodeViewModel.cs | C# | mit | 1,972 |
/*!
* Angular Material Design
* https://github.com/angular/material
* @license MIT
* v1.1.0-rc.5-master-3a0f323
*/
goog.provide('ngmaterial.components.icon');
goog.require('ngmaterial.core');
/**
* @ngdoc module
* @name material.components.icon
* @description
* Icon
*/
angular.module('material.components.icon', ['material.core']);
angular
.module('material.components.icon')
.directive('mdIcon', ['$mdIcon', '$mdTheming', '$mdAria', '$sce', mdIconDirective]);
/**
* @ngdoc directive
* @name mdIcon
* @module material.components.icon
*
* @restrict E
*
* @description
* The `md-icon` directive makes it easier to use vector-based icons in your app (as opposed to
* raster-based icons types like PNG). The directive supports both icon fonts and SVG icons.
*
* Icons should be consider view-only elements that should not be used directly as buttons; instead nest a `<md-icon>`
* inside a `md-button` to add hover and click features.
*
* ### Icon fonts
* Icon fonts are a technique in which you use a font where the glyphs in the font are
* your icons instead of text. Benefits include a straightforward way to bundle everything into a
* single HTTP request, simple scaling, easy color changing, and more.
*
* `md-icon` lets you consume an icon font by letting you reference specific icons in that font
* by name rather than character code.
*
* ### SVG
* For SVGs, the problem with using `<img>` or a CSS `background-image` is that you can't take
* advantage of some SVG features, such as styling specific parts of the icon with CSS or SVG
* animation.
*
* `md-icon` makes it easier to use SVG icons by *inlining* the SVG into an `<svg>` element in the
* document. The most straightforward way of referencing an SVG icon is via URL, just like a
* traditional `<img>`. `$mdIconProvider`, as a convenience, lets you _name_ an icon so you can
* reference it by name instead of URL throughout your templates.
*
* Additionally, you may not want to make separate HTTP requests for every icon, so you can bundle
* your SVG icons together and pre-load them with $mdIconProvider as an icon set. An icon set can
* also be given a name, which acts as a namespace for individual icons, so you can reference them
* like `"social:cake"`.
*
* When using SVGs, both external SVGs (via URLs) or sets of SVGs [from icon sets] can be
* easily loaded and used.When use font-icons, developers must following three (3) simple steps:
*
* <ol>
* <li>Load the font library. e.g.<br/>
* `<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
* rel="stylesheet">`
* </li>
* <li>
* Use either (a) font-icon class names or (b) font ligatures to render the font glyph by using
* its textual name
* </li>
* <li>
* Use `<md-icon md-font-icon="classname" />` or <br/>
* use `<md-icon md-font-set="font library classname or alias"> textual_name </md-icon>` or <br/>
* use `<md-icon md-font-set="font library classname or alias"> numerical_character_reference </md-icon>`
* </li>
* </ol>
*
* Full details for these steps can be found:
*
* <ul>
* <li>http://google.github.io/material-design-icons/</li>
* <li>http://google.github.io/material-design-icons/#icon-font-for-the-web</li>
* </ul>
*
* The Material Design icon style <code>.material-icons</code> and the icon font references are published in
* Material Design Icons:
*
* <ul>
* <li>http://www.google.com/design/icons/</li>
* <li>https://www.google.com/design/icons/#ic_accessibility</li>
* </ul>
*
* <h2 id="material_design_icons">Material Design Icons</h2>
* Using the Material Design Icon-Selector, developers can easily and quickly search for a Material Design font-icon and
* determine its textual name and character reference code. Click on any icon to see the slide-up information
* panel with details regarding a SVG download or information on the font-icon usage.
*
* <a href="https://www.google.com/design/icons/#ic_accessibility" target="_blank" style="border-bottom:none;">
* <img src="https://cloud.githubusercontent.com/assets/210413/7902490/fe8dd14c-0780-11e5-98fb-c821cc6475e6.png"
* aria-label="Material Design Icon-Selector" style="max-width:75%;padding-left:10%">
* </a>
*
* <span class="image_caption">
* Click on the image above to link to the
* <a href="https://www.google.com/design/icons/#ic_accessibility" target="_blank">Material Design Icon-Selector</a>.
* </span>
*
* @param {string} md-font-icon String name of CSS icon associated with the font-face will be used
* to render the icon. Requires the fonts and the named CSS styles to be preloaded.
* @param {string} md-font-set CSS style name associated with the font library; which will be assigned as
* the class for the font-icon ligature. This value may also be an alias that is used to lookup the classname;
* internally use `$mdIconProvider.fontSet(<alias>)` to determine the style name.
* @param {string} md-svg-src String URL (or expression) used to load, cache, and display an
* external SVG.
* @param {string} md-svg-icon md-svg-icon String name used for lookup of the icon from the internal cache;
* interpolated strings or expressions may also be used. Specific set names can be used with
* the syntax `<set name>:<icon name>`.<br/><br/>
* To use icon sets, developers are required to pre-register the sets using the `$mdIconProvider` service.
* @param {string=} aria-label Labels icon for accessibility. If an empty string is provided, icon
* will be hidden from accessibility layer with `aria-hidden="true"`. If there's no aria-label on the icon
* nor a label on the parent element, a warning will be logged to the console.
* @param {string=} alt Labels icon for accessibility. If an empty string is provided, icon
* will be hidden from accessibility layer with `aria-hidden="true"`. If there's no alt on the icon
* nor a label on the parent element, a warning will be logged to the console.
*
* @usage
* When using SVGs:
* <hljs lang="html">
*
* <!-- Icon ID; may contain optional icon set prefix; icons must registered using $mdIconProvider -->
* <md-icon md-svg-icon="social:android" aria-label="android " ></md-icon>
*
* <!-- Icon urls; may be preloaded in templateCache -->
* <md-icon md-svg-src="/android.svg" aria-label="android " ></md-icon>
* <md-icon md-svg-src="{{ getAndroid() }}" aria-label="android " ></md-icon>
*
* </hljs>
*
* Use the <code>$mdIconProvider</code> to configure your application with
* svg iconsets.
*
* <hljs lang="js">
* angular.module('appSvgIconSets', ['ngMaterial'])
* .controller('DemoCtrl', function($scope) {})
* .config(function($mdIconProvider) {
* $mdIconProvider
* .iconSet('social', 'img/icons/sets/social-icons.svg', 24)
* .defaultIconSet('img/icons/sets/core-icons.svg', 24);
* });
* </hljs>
*
*
* When using Font Icons with classnames:
* <hljs lang="html">
*
* <md-icon md-font-icon="android" aria-label="android" ></md-icon>
* <md-icon class="icon_home" aria-label="Home" ></md-icon>
*
* </hljs>
*
* When using Material Font Icons with ligatures:
* <hljs lang="html">
* <!--
* For Material Design Icons
* The class '.material-icons' is auto-added if a style has NOT been specified
* since `material-icons` is the default fontset. So your markup:
* -->
* <md-icon> face </md-icon>
* <!-- becomes this at runtime: -->
* <md-icon md-font-set="material-icons"> face </md-icon>
* <!-- If the fontset does not support ligature names, then we need to use the ligature unicode.-->
* <md-icon>  </md-icon>
* <!-- The class '.material-icons' must be manually added if other styles are also specified-->
* <md-icon class="material-icons md-light md-48"> face </md-icon>
* </hljs>
*
* When using other Font-Icon libraries:
*
* <hljs lang="js">
* // Specify a font-icon style alias
* angular.config(function($mdIconProvider) {
* $mdIconProvider.fontSet('md', 'material-icons');
* });
* </hljs>
*
* <hljs lang="html">
* <md-icon md-font-set="md">favorite</md-icon>
* </hljs>
*
*/
function mdIconDirective($mdIcon, $mdTheming, $mdAria, $sce) {
return {
restrict: 'E',
link : postLink
};
/**
* Directive postLink
* Supports embedded SVGs, font-icons, & external SVGs
*/
function postLink(scope, element, attr) {
$mdTheming(element);
var lastFontIcon = attr.mdFontIcon;
var lastFontSet = $mdIcon.fontSet(attr.mdFontSet);
prepareForFontIcon();
attr.$observe('mdFontIcon', fontIconChanged);
attr.$observe('mdFontSet', fontIconChanged);
// Keep track of the content of the svg src so we can compare against it later to see if the
// attribute is static (and thus safe).
var originalSvgSrc = element[0].getAttribute(attr.$attr.mdSvgSrc);
// If using a font-icon, then the textual name of the icon itself
// provides the aria-label.
var label = attr.alt || attr.mdFontIcon || attr.mdSvgIcon || element.text();
var attrName = attr.$normalize(attr.$attr.mdSvgIcon || attr.$attr.mdSvgSrc || '');
if ( !attr['aria-label'] ) {
if (label !== '' && !parentsHaveText() ) {
$mdAria.expect(element, 'aria-label', label);
$mdAria.expect(element, 'role', 'img');
} else if ( !element.text() ) {
// If not a font-icon with ligature, then
// hide from the accessibility layer.
$mdAria.expect(element, 'aria-hidden', 'true');
}
}
if (attrName) {
// Use either pre-configured SVG or URL source, respectively.
attr.$observe(attrName, function(attrVal) {
// If using svg-src and the value is static (i.e., is exactly equal to the compile-time
// `md-svg-src` value), then it is implicitly trusted.
if (!isInlineSvg(attrVal) && attrVal === originalSvgSrc) {
attrVal = $sce.trustAsUrl(attrVal);
}
element.empty();
if (attrVal) {
$mdIcon(attrVal)
.then(function(svg) {
element.empty();
element.append(svg);
});
}
});
}
function parentsHaveText() {
var parent = element.parent();
if (parent.attr('aria-label') || parent.text()) {
return true;
}
else if(parent.parent().attr('aria-label') || parent.parent().text()) {
return true;
}
return false;
}
function prepareForFontIcon() {
if (!attr.mdSvgIcon && !attr.mdSvgSrc) {
if (attr.mdFontIcon) {
element.addClass('md-font ' + attr.mdFontIcon);
}
element.addClass(lastFontSet);
}
}
function fontIconChanged() {
if (!attr.mdSvgIcon && !attr.mdSvgSrc) {
if (attr.mdFontIcon) {
element.removeClass(lastFontIcon);
element.addClass(attr.mdFontIcon);
lastFontIcon = attr.mdFontIcon;
}
var fontSet = $mdIcon.fontSet(attr.mdFontSet);
if (lastFontSet !== fontSet) {
element.removeClass(lastFontSet);
element.addClass(fontSet);
lastFontSet = fontSet;
}
}
}
}
/**
* Gets whether the given svg src is an inline ("data:" style) SVG.
* @param {string} svgSrc The svg src.
* @returns {boolean} Whether the src is an inline SVG.
*/
function isInlineSvg(svgSrc) {
var dataUrlRegex = /^data:image\/svg\+xml[\s*;\w\-\=]*?(base64)?,(.*)$/i;
return dataUrlRegex.test(svgSrc);
}
}
angular
.module('material.components.icon')
.constant('$$mdSvgRegistry', {
'mdTabsArrow': 'data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxnPjxwb2x5Z29uIHBvaW50cz0iMTUuNCw3LjQgMTQsNiA4LDEyIDE0LDE4IDE1LjQsMTYuNiAxMC44LDEyICIvPjwvZz48L3N2Zz4=',
'mdClose': 'data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxnPjxwYXRoIGQ9Ik0xOSA2LjQxbC0xLjQxLTEuNDEtNS41OSA1LjU5LTUuNTktNS41OS0xLjQxIDEuNDEgNS41OSA1LjU5LTUuNTkgNS41OSAxLjQxIDEuNDEgNS41OS01LjU5IDUuNTkgNS41OSAxLjQxLTEuNDEtNS41OS01LjU5eiIvPjwvZz48L3N2Zz4=',
'mdCancel': 'data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxnPjxwYXRoIGQ9Ik0xMiAyYy01LjUzIDAtMTAgNC40Ny0xMCAxMHM0LjQ3IDEwIDEwIDEwIDEwLTQuNDcgMTAtMTAtNC40Ny0xMC0xMC0xMHptNSAxMy41OWwtMS40MSAxLjQxLTMuNTktMy41OS0zLjU5IDMuNTktMS40MS0xLjQxIDMuNTktMy41OS0zLjU5LTMuNTkgMS40MS0xLjQxIDMuNTkgMy41OSAzLjU5LTMuNTkgMS40MSAxLjQxLTMuNTkgMy41OSAzLjU5IDMuNTl6Ii8+PC9nPjwvc3ZnPg==',
'mdMenu': 'data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxwYXRoIGQ9Ik0zLDZIMjFWOEgzVjZNMywxMUgyMVYxM0gzVjExTTMsMTZIMjFWMThIM1YxNloiIC8+PC9zdmc+',
'mdToggleArrow': 'data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgNDggNDgiPjxwYXRoIGQ9Ik0yNCAxNmwtMTIgMTIgMi44MyAyLjgzIDkuMTctOS4xNyA5LjE3IDkuMTcgMi44My0yLjgzeiIvPjxwYXRoIGQ9Ik0wIDBoNDh2NDhoLTQ4eiIgZmlsbD0ibm9uZSIvPjwvc3ZnPg==',
'mdCalendar': 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMTkgM2gtMVYxaC0ydjJIOFYxSDZ2Mkg1Yy0xLjExIDAtMS45OS45LTEuOTkgMkwzIDE5YzAgMS4xLjg5IDIgMiAyaDE0YzEuMSAwIDItLjkgMi0yVjVjMC0xLjEtLjktMi0yLTJ6bTAgMTZINVY4aDE0djExek03IDEwaDV2NUg3eiIvPjwvc3ZnPg=='
})
.provider('$mdIcon', MdIconProvider);
/**
* @ngdoc service
* @name $mdIconProvider
* @module material.components.icon
*
* @description
* `$mdIconProvider` is used only to register icon IDs with URLs. These configuration features allow
* icons and icon sets to be pre-registered and associated with source URLs **before** the `<md-icon />`
* directives are compiled.
*
* If using font-icons, the developer is responsible for loading the fonts.
*
* If using SVGs, loading of the actual svg files are deferred to on-demand requests and are loaded
* internally by the `$mdIcon` service using the `$templateRequest` service. When an SVG is
* requested by name/ID, the `$mdIcon` service searches its registry for the associated source URL;
* that URL is used to on-demand load and parse the SVG dynamically.
*
* The `$templateRequest` service expects the icons source to be loaded over trusted URLs.<br/>
* This means, when loading icons from an external URL, you have to trust the URL in the `$sceDelegateProvider`.
*
* <hljs lang="js">
* app.config(function($sceDelegateProvider) {
* $sceDelegateProvider.resourceUrlWhitelist([
* // Adding 'self' to the whitelist, will allow requests from the current origin.
* 'self',
* // Using double asterisks here, will allow all URLs to load.
* // We recommend to only specify the given domain you want to allow.
* '**'
* ]);
* });
* </hljs>
*
* Read more about the [$sceDelegateProvider](https://docs.angularjs.org/api/ng/provider/$sceDelegateProvider).
*
* **Notice:** Most font-icons libraries do not support ligatures (for example `fontawesome`).<br/>
* In such cases you are not able to use the icon's ligature name - Like so:
*
* <hljs lang="html">
* <md-icon md-font-set="fa">fa-bell</md-icon>
* </hljs>
*
* You should instead use the given unicode, instead of the ligature name.
*
* <p ng-hide="true"> ##// Notice we can't use a hljs element here, because the characters will be escaped.</p>
* ```html
* <md-icon md-font-set="fa"></md-icon>
* ```
*
* All unicode ligatures are prefixed with the `&#x` string.
*
* @usage
* <hljs lang="js">
* app.config(function($mdIconProvider) {
*
* // Configure URLs for icons specified by [set:]id.
*
* $mdIconProvider
* .defaultFontSet( 'fa' ) // This sets our default fontset className.
* .defaultIconSet('my/app/icons.svg') // Register a default set of SVG icons
* .iconSet('social', 'my/app/social.svg') // Register a named icon set of SVGs
* .icon('android', 'my/app/android.svg') // Register a specific icon (by name)
* .icon('work:chair', 'my/app/chair.svg'); // Register icon in a specific set
* });
* </hljs>
*
* SVG icons and icon sets can be easily pre-loaded and cached using either (a) a build process or (b) a runtime
* **startup** process (shown below):
*
* <hljs lang="js">
* app.config(function($mdIconProvider) {
*
* // Register a default set of SVG icon definitions
* $mdIconProvider.defaultIconSet('my/app/icons.svg')
*
* })
* .run(function($templateRequest){
*
* // Pre-fetch icons sources by URL and cache in the $templateCache...
* // subsequent $templateRequest calls will look there first.
*
* var urls = [ 'imy/app/icons.svg', 'img/icons/android.svg'];
*
* angular.forEach(urls, function(url) {
* $templateRequest(url);
* });
*
* });
*
* </hljs>
*
* NOTE: the loaded SVG data is subsequently cached internally for future requests.
*
*/
/**
* @ngdoc method
* @name $mdIconProvider#icon
*
* @description
* Register a source URL for a specific icon name; the name may include optional 'icon set' name prefix.
* These icons will later be retrieved from the cache using `$mdIcon( <icon name> )`
*
* @param {string} id Icon name/id used to register the icon
* @param {string} url specifies the external location for the data file. Used internally by
* `$templateRequest` to load the data or as part of the lookup in `$templateCache` if pre-loading
* was configured.
* @param {number=} viewBoxSize Sets the width and height the icon's viewBox.
* It is ignored for icons with an existing viewBox. Default size is 24.
*
* @returns {obj} an `$mdIconProvider` reference; used to support method call chains for the API
*
* @usage
* <hljs lang="js">
* app.config(function($mdIconProvider) {
*
* // Configure URLs for icons specified by [set:]id.
*
* $mdIconProvider
* .icon('android', 'my/app/android.svg') // Register a specific icon (by name)
* .icon('work:chair', 'my/app/chair.svg'); // Register icon in a specific set
* });
* </hljs>
*
*/
/**
* @ngdoc method
* @name $mdIconProvider#iconSet
*
* @description
* Register a source URL for a 'named' set of icons; group of SVG definitions where each definition
* has an icon id. Individual icons can be subsequently retrieved from this cached set using
* `$mdIcon(<icon set name>:<icon name>)`
*
* @param {string} id Icon name/id used to register the iconset
* @param {string} url specifies the external location for the data file. Used internally by
* `$templateRequest` to load the data or as part of the lookup in `$templateCache` if pre-loading
* was configured.
* @param {number=} viewBoxSize Sets the width and height of the viewBox of all icons in the set.
* It is ignored for icons with an existing viewBox. All icons in the icon set should be the same size.
* Default value is 24.
*
* @returns {obj} an `$mdIconProvider` reference; used to support method call chains for the API
*
*
* @usage
* <hljs lang="js">
* app.config(function($mdIconProvider) {
*
* // Configure URLs for icons specified by [set:]id.
*
* $mdIconProvider
* .iconSet('social', 'my/app/social.svg') // Register a named icon set
* });
* </hljs>
*
*/
/**
* @ngdoc method
* @name $mdIconProvider#defaultIconSet
*
* @description
* Register a source URL for the default 'named' set of icons. Unless explicitly registered,
* subsequent lookups of icons will failover to search this 'default' icon set.
* Icon can be retrieved from this cached, default set using `$mdIcon(<name>)`
*
* @param {string} url specifies the external location for the data file. Used internally by
* `$templateRequest` to load the data or as part of the lookup in `$templateCache` if pre-loading
* was configured.
* @param {number=} viewBoxSize Sets the width and height of the viewBox of all icons in the set.
* It is ignored for icons with an existing viewBox. All icons in the icon set should be the same size.
* Default value is 24.
*
* @returns {obj} an `$mdIconProvider` reference; used to support method call chains for the API
*
* @usage
* <hljs lang="js">
* app.config(function($mdIconProvider) {
*
* // Configure URLs for icons specified by [set:]id.
*
* $mdIconProvider
* .defaultIconSet( 'my/app/social.svg' ) // Register a default icon set
* });
* </hljs>
*
*/
/**
* @ngdoc method
* @name $mdIconProvider#defaultFontSet
*
* @description
* When using Font-Icons, Angular Material assumes the the Material Design icons will be used and automatically
* configures the default font-set == 'material-icons'. Note that the font-set references the font-icon library
* class style that should be applied to the `<md-icon>`.
*
* Configuring the default means that the attributes
* `md-font-set="material-icons"` or `class="material-icons"` do not need to be explicitly declared on the
* `<md-icon>` markup. For example:
*
* `<md-icon> face </md-icon>`
* will render as
* `<span class="material-icons"> face </span>`, and
*
* `<md-icon md-font-set="fa"> face </md-icon>`
* will render as
* `<span class="fa"> face </span>`
*
* @param {string} name of the font-library style that should be applied to the md-icon DOM element
*
* @usage
* <hljs lang="js">
* app.config(function($mdIconProvider) {
* $mdIconProvider.defaultFontSet( 'fa' );
* });
* </hljs>
*
*/
/**
* @ngdoc method
* @name $mdIconProvider#fontSet
*
* @description
* When using a font set for `<md-icon>` you must specify the correct font classname in the `md-font-set`
* attribute. If the fonset className is really long, your markup may become cluttered... an easy
* solution is to define an `alias` for your fontset:
*
* @param {string} alias of the specified fontset.
* @param {string} className of the fontset.
*
* @usage
* <hljs lang="js">
* app.config(function($mdIconProvider) {
* // In this case, we set an alias for the `material-icons` fontset.
* $mdIconProvider.fontSet('md', 'material-icons');
* });
* </hljs>
*
*/
/**
* @ngdoc method
* @name $mdIconProvider#defaultViewBoxSize
*
* @description
* While `<md-icon />` markup can also be style with sizing CSS, this method configures
* the default width **and** height used for all icons; unless overridden by specific CSS.
* The default sizing is (24px, 24px).
* @param {number=} viewBoxSize Sets the width and height of the viewBox for an icon or an icon set.
* All icons in a set should be the same size. The default value is 24.
*
* @returns {obj} an `$mdIconProvider` reference; used to support method call chains for the API
*
* @usage
* <hljs lang="js">
* app.config(function($mdIconProvider) {
*
* // Configure URLs for icons specified by [set:]id.
*
* $mdIconProvider
* .defaultViewBoxSize(36) // Register a default icon size (width == height)
* });
* </hljs>
*
*/
var config = {
defaultViewBoxSize: 24,
defaultFontSet: 'material-icons',
fontSets: []
};
function MdIconProvider() {
}
MdIconProvider.prototype = {
icon: function(id, url, viewBoxSize) {
if (id.indexOf(':') == -1) id = '$default:' + id;
config[id] = new ConfigurationItem(url, viewBoxSize);
return this;
},
iconSet: function(id, url, viewBoxSize) {
config[id] = new ConfigurationItem(url, viewBoxSize);
return this;
},
defaultIconSet: function(url, viewBoxSize) {
var setName = '$default';
if (!config[setName]) {
config[setName] = new ConfigurationItem(url, viewBoxSize);
}
config[setName].viewBoxSize = viewBoxSize || config.defaultViewBoxSize;
return this;
},
defaultViewBoxSize: function(viewBoxSize) {
config.defaultViewBoxSize = viewBoxSize;
return this;
},
/**
* Register an alias name associated with a font-icon library style ;
*/
fontSet: function fontSet(alias, className) {
config.fontSets.push({
alias: alias,
fontSet: className || alias
});
return this;
},
/**
* Specify a default style name associated with a font-icon library
* fallback to Material Icons.
*
*/
defaultFontSet: function defaultFontSet(className) {
config.defaultFontSet = !className ? '' : className;
return this;
},
defaultIconSize: function defaultIconSize(iconSize) {
config.defaultIconSize = iconSize;
return this;
},
$get: ['$templateRequest', '$q', '$log', '$mdUtil', '$sce', function($templateRequest, $q, $log, $mdUtil, $sce) {
return MdIconService(config, $templateRequest, $q, $log, $mdUtil, $sce);
}]
};
/**
* Configuration item stored in the Icon registry; used for lookups
* to load if not already cached in the `loaded` cache
*/
function ConfigurationItem(url, viewBoxSize) {
this.url = url;
this.viewBoxSize = viewBoxSize || config.defaultViewBoxSize;
}
/**
* @ngdoc service
* @name $mdIcon
* @module material.components.icon
*
* @description
* The `$mdIcon` service is a function used to lookup SVG icons.
*
* @param {string} id Query value for a unique Id or URL. If the argument is a URL, then the service will retrieve the icon element
* from its internal cache or load the icon and cache it first. If the value is not a URL-type string, then an ID lookup is
* performed. The Id may be a unique icon ID or may include an iconSet ID prefix.
*
* For the **id** query to work properly, this means that all id-to-URL mappings must have been previously configured
* using the `$mdIconProvider`.
*
* @returns {angular.$q.Promise} A promise that gets resolved to a clone of the initial SVG DOM element; which was
* created from the SVG markup in the SVG data file. If an error occurs (e.g. the icon cannot be found) the promise
* will get rejected.
*
* @usage
* <hljs lang="js">
* function SomeDirective($mdIcon) {
*
* // See if the icon has already been loaded, if not
* // then lookup the icon from the registry cache, load and cache
* // it for future requests.
* // NOTE: ID queries require configuration with $mdIconProvider
*
* $mdIcon('android').then(function(iconEl) { element.append(iconEl); });
* $mdIcon('work:chair').then(function(iconEl) { element.append(iconEl); });
*
* // Load and cache the external SVG using a URL
*
* $mdIcon('img/icons/android.svg').then(function(iconEl) {
* element.append(iconEl);
* });
* };
* </hljs>
*
* NOTE: The `<md-icon /> ` directive internally uses the `$mdIcon` service to query, loaded, and instantiate
* SVG DOM elements.
*/
/* ngInject */
function MdIconService(config, $templateRequest, $q, $log, $mdUtil, $sce) {
var iconCache = {};
var svgCache = {};
var urlRegex = /[-\w@:%\+.~#?&//=]{2,}\.[a-z]{2,4}\b(\/[-\w@:%\+.~#?&//=]*)?/i;
var dataUrlRegex = /^data:image\/svg\+xml[\s*;\w\-\=]*?(base64)?,(.*)$/i;
Icon.prototype = {clone: cloneSVG, prepare: prepareAndStyle};
getIcon.fontSet = findRegisteredFontSet;
// Publish service...
return getIcon;
/**
* Actual $mdIcon service is essentially a lookup function
*/
function getIcon(id) {
id = id || '';
// If the "id" provided is not a string, the only other valid value is a $sce trust wrapper
// over a URL string. If the value is not trusted, this will intentionally throw an error
// because the user is attempted to use an unsafe URL, potentially opening themselves up
// to an XSS attack.
if (!angular.isString(id)) {
id = $sce.getTrustedUrl(id);
}
// If already loaded and cached, use a clone of the cached icon.
// Otherwise either load by URL, or lookup in the registry and then load by URL, and cache.
if (iconCache[id]) {
return $q.when(transformClone(iconCache[id]));
}
if (urlRegex.test(id) || dataUrlRegex.test(id)) {
return loadByURL(id).then(cacheIcon(id));
}
if (id.indexOf(':') == -1) {
id = '$default:' + id;
}
var load = config[id] ? loadByID : loadFromIconSet;
return load(id)
.then(cacheIcon(id));
}
/**
* Lookup registered fontSet style using its alias...
* If not found,
*/
function findRegisteredFontSet(alias) {
var useDefault = angular.isUndefined(alias) || !(alias && alias.length);
if (useDefault) return config.defaultFontSet;
var result = alias;
angular.forEach(config.fontSets, function(it) {
if (it.alias == alias) result = it.fontSet || result;
});
return result;
}
function transformClone(cacheElement) {
var clone = cacheElement.clone();
var cacheSuffix = '_cache' + $mdUtil.nextUid();
// We need to modify for each cached icon the id attributes.
// This is needed because SVG id's are treated as normal DOM ids
// and should not have a duplicated id.
if (clone.id) clone.id += cacheSuffix;
angular.forEach(clone.querySelectorAll('[id]'), function(item) {
item.id += cacheSuffix;
});
return clone;
}
/**
* Prepare and cache the loaded icon for the specified `id`
*/
function cacheIcon(id) {
return function updateCache(icon) {
iconCache[id] = isIcon(icon) ? icon : new Icon(icon, config[id]);
return iconCache[id].clone();
};
}
/**
* Lookup the configuration in the registry, if !registered throw an error
* otherwise load the icon [on-demand] using the registered URL.
*
*/
function loadByID(id) {
var iconConfig = config[id];
return loadByURL(iconConfig.url).then(function(icon) {
return new Icon(icon, iconConfig);
});
}
/**
* Loads the file as XML and uses querySelector( <id> ) to find
* the desired node...
*/
function loadFromIconSet(id) {
var setName = id.substring(0, id.lastIndexOf(':')) || '$default';
var iconSetConfig = config[setName];
return !iconSetConfig ? announceIdNotFound(id) : loadByURL(iconSetConfig.url).then(extractFromSet);
function extractFromSet(set) {
var iconName = id.slice(id.lastIndexOf(':') + 1);
var icon = set.querySelector('#' + iconName);
return icon ? new Icon(icon, iconSetConfig) : announceIdNotFound(id);
}
function announceIdNotFound(id) {
var msg = 'icon ' + id + ' not found';
$log.warn(msg);
return $q.reject(msg || id);
}
}
/**
* Load the icon by URL (may use the $templateCache).
* Extract the data for later conversion to Icon
*/
function loadByURL(url) {
/* Load the icon from embedded data URL. */
function loadByDataUrl(url) {
var results = dataUrlRegex.exec(url);
var isBase64 = /base64/i.test(url);
var data = isBase64 ? window.atob(results[2]) : results[2];
return $q.when(angular.element(data)[0]);
}
/* Load the icon by URL using HTTP. */
function loadByHttpUrl(url) {
return $q(function(resolve, reject) {
// Catch HTTP or generic errors not related to incorrect icon IDs.
var announceAndReject = function(err) {
var msg = angular.isString(err) ? err : (err.message || err.data || err.statusText);
$log.warn(msg);
reject(err);
},
extractSvg = function(response) {
if (!svgCache[url]) {
svgCache[url] = angular.element('<div>').append(response)[0].querySelector('svg');
}
resolve(svgCache[url]);
};
$templateRequest(url, true).then(extractSvg, announceAndReject);
});
}
return dataUrlRegex.test(url)
? loadByDataUrl(url)
: loadByHttpUrl(url);
}
/**
* Check target signature to see if it is an Icon instance.
*/
function isIcon(target) {
return angular.isDefined(target.element) && angular.isDefined(target.config);
}
/**
* Define the Icon class
*/
function Icon(el, config) {
if (el && el.tagName != 'svg') {
el = angular.element('<svg xmlns="http://www.w3.org/2000/svg">').append(el.cloneNode(true))[0];
}
// Inject the namespace if not available...
if (!el.getAttribute('xmlns')) {
el.setAttribute('xmlns', "http://www.w3.org/2000/svg");
}
this.element = el;
this.config = config;
this.prepare();
}
/**
* Prepare the DOM element that will be cached in the
* loaded iconCache store.
*/
function prepareAndStyle() {
var viewBoxSize = this.config ? this.config.viewBoxSize : config.defaultViewBoxSize;
angular.forEach({
'fit': '',
'height': '100%',
'width': '100%',
'preserveAspectRatio': 'xMidYMid meet',
'viewBox': this.element.getAttribute('viewBox') || ('0 0 ' + viewBoxSize + ' ' + viewBoxSize),
'focusable': false // Disable IE11s default behavior to make SVGs focusable
}, function(val, attr) {
this.element.setAttribute(attr, val);
}, this);
}
/**
* Clone the Icon DOM element.
*/
function cloneSVG() {
// If the element or any of its children have a style attribute, then a CSP policy without
// 'unsafe-inline' in the style-src directive, will result in a violation.
return this.element.cloneNode(true);
}
}
MdIconService.$inject = ["config", "$templateRequest", "$q", "$log", "$mdUtil", "$sce"];
ngmaterial.components.icon = angular.module("material.components.icon"); | rebeccaForster/ThinkTank | Iteration5_Prototype/v1/node_modules/angular-material/modules/closure/icon/icon.js | JavaScript | mit | 33,632 |
<?php
namespace Omnipay\DocdataPayments\Message;
use Omnipay\Common\Exception\InvalidResponseException;
use Omnipay\Common\Message\NotificationInterface;
use Omnipay\DocdataPayments\Message\SoapAbstractRequest;
use Omnipay\Common\Message\AbstractRequest;
/**
* The url of the notification must be set at the back office.
* returns as a get request
* /?orderId=
*/
class ExtendedStatusRequest extends SoapAbstractRequest implements NotificationInterface
{
public function getData()
{
$data = parent::getData();
$data['paymentOrderKey'] = $this->getTransactionReference();
return $data;
}
/**
* Run the SOAP transaction
*
* @param SoapClient $soapClient
* @param array $data
* @return array
* @throws \Exception
*/
protected function runTransaction($soapClient, $data)
{
$this->responseName = '\Omnipay\DocdataPayments\Message\ExtendedStatusResponse';
return $soapClient->statusExtended($data);
}
/**
* Was the transaction successful?
*
* @return string Transaction status, one of {@see STATUS_COMPLETED}, {@see #STATUS_PENDING},
* or {@see #STATUS_FAILED}.
*/
public function getTransactionStatus(){
if(isset($this->data->statusSuccess)) {
return true;
}
return STATUS_FAILED;
}
/**
* Response Message
*
* @return string A response message from the payment gateway
*/
public function getMessage(){
}
} | Uskur/omnipay-docdata-payments | src/Message/ExtendedStatusRequest.php | PHP | mit | 1,547 |
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD
define(['snd.TimeLineEvent', 'snd.TimeValue'], factory);
} else if (typeof exports === 'object') {
// Node
} else {
// Browser globals (root is window)
root.snd = factory(root.snd);
}
}(this, function(snd) {
snd.Envelope = function(id, target) {
snd.TimeLineEvent.call(this, id, target, 0, Infinity);
this._timeValueChangeEventListeners = [];
this._timeValueAddEventListeners = [];
this._timeValueRemoveEventListeners = [];
Object.defineProperties(this, {
length: {
get: function() {
return this._envelope.length;
}
}
});
// {time: t, value: v}
this._envelope = [];
};
snd.Envelope.prototype = Object.create(snd.TimeLineEvent.prototype);
snd.Envelope.prototype.constructor = snd.Envelope;
snd.Envelope.prototype.start = function(time, currentTime) {
if (this._target && this._status != snd.status.STARTED) {
var _this = this;
var diff = this.startTime - time;
var when = (diff < 0) ? 0 : diff;
var offset = (diff < 0) ? Math.abs(diff) : 0;
var duration = this.endTime - this.startTime - offset;
this.setEnvelope(when, offset, duration, (currentTime == null) ? snd.CURRENT_TIME : currentTime);
this._status = snd.status.STARTED;
if (typeof(this.target.addOnEndedEventListener) == "function") {
this.target.addOnEndedEventListener(this.receiveOnEndedEvent);
} else {
this._timerID = setTimeout((function(thisarg){thisarg.status = snd.status.READY;})(_this), duration);
}
this.fireStartEvent();
}
};
snd.Envelope.prototype.get = function(i) {
return this._envelope[i];
};
snd.Envelope.prototype.push = function(timeValueObj) {
var _this = this;
timeValueObj.addTimeValueChangeEventListener(function(tv,pt,pv){_this.receiveTimeValueChangeEvent(tv,pt,pv);});
this._envelope.push(timeValueObj);
this._envelope.sort(snd.Envelope.compareTimeValueArray);
this.fireTimeValueAddEvent(this, timeValueObj);
};
snd.Envelope.prototype.indexOf = function(timeValueObj) {
return this._envelope.indexOf(timeValueObj);
};
snd.Envelope.prototype.remove = function(timeValueObj) {
var i = this._envelope.indexOf(timeValueObj);
if (i >= 0) {
this.splice(i, 1);
}
};
snd.Envelope.prototype.splice = function(i, n) {
if (i > 0) {
var timeValueObj = this._envelope[i];
timeValueObj.removeTimeValueChangeEventListener(this.receiveTimeValueChangeEvent);
this._envelope.splice(i, n);
this.fireTimeValueRemoveEvent(this, timeValueObj);
}
};
snd.Envelope.prototype.onTimeValueChanged = function(obj, timeValueObj) {};
snd.Envelope.prototype.onTimeValueAdded = function(obj, timeValueObj) {};
snd.Envelope.prototype.onTimeValueRemoved = function(obj, timeValueObj) {};
snd.Envelope.prototype.addTimeValueAddEventListener = function(listener) {
this._timeValueAddEventListeners.push(listener);
};
snd.Envelope.prototype.removeTimeValueAddEventListener = function(listener) {
var i = this._timeValueAddEventListeners.indexOf(listener);
if (i >= 0) {
this._timeValueAddEventListeners.splice(i, 1);
}
};
snd.Envelope.prototype.addTimeValueChangeEventListener = function(listener) {
this._timeValueChangeEventListeners.push(listener);
};
snd.Envelope.prototype.removeTimeValueChangeEventListener = function(listener) {
var i = this._timeValueChangeEventListeners.indexOf(listener);
if (i >= 0) {
this._timeValueChangeEventListeners.splice(i, 1);
}
};
snd.Envelope.prototype.addTimeValueRemoveEventListener = function(listener) {
this._timeValueRemoveEventListeners.push(listener);
};
snd.Envelope.prototype.removeTimeValueRemoveEventListener = function(listener) {
var i = this._timeValueRemoveEventListeners.indexOf(listener);
if (i >= 0) {
this._timeValueRemoveEventListeners.splice(i, 1);
}
};
snd.Envelope.prototype.fireTimeValueChangeEvent = function(obj, timeValueObj, prevTime, prevValue) {
this.onTimeValueChanged(obj, timeValueObj, prevTime, prevValue);
for (var i in this._timeValueChangeEventListeners) {
if (typeof(this._timeValueChangeEventListeners[i]) == 'function') {
this._timeValueChangeEventListeners[i](obj, timeValueObj);
}
}
};
snd.Envelope.prototype.fireTimeValueAddEvent = function(obj, timeValueObj) {
this.onTimeValueAdded(obj, timeValueObj);
for (var i in this._timeValueAddEventListeners) {
if (typeof(this._timeValueAddEventListeners[i]) == 'function') {
this._timeValueAddEventListeners[i](obj, timeValueObj);
}
}
};
snd.Envelope.prototype.fireTimeValueRemoveEvent = function(obj, timeValueObj) {
this.onTimeValueRemoved(obj, timeValueObj);
for (var i in this._timeValueRemoveEventListeners) {
if (typeof(this._timeValueRemoveEventListeners[i]) == 'function') {
this._timeValueRemoveEventListeners[i](obj, timeValueObj);
}
}
};
snd.Envelope.prototype.receiveTimeValueChangeEvent = function(timeValueObj, prevTime, prevValue) {
var idx = this._envelope.indexOf(timeValueObj);
if (idx >= 0) {
if ((idx - 1 > 0) && (this._envelope[idx].time < this._envelope[idx -1])) {
this._envelope.sort(snd.Envelope.compareTimeValueArray);
} else if ((idx + 1 < this._envelope.length) && (this._envelope[idx] > this._envelope[idx + 1])) {
this._envelope.sort(snd.Envelope.compareTimeValueArray);
}
}
this.fireTimeValueChangeEvent(this, timeValueObj, prevTime, prevValue);
};
snd.Envelope.prototype.setEnvelope = function(when, offset, duration, currentTime) {
if (this._envelope.length > 0) {
var tv = this.calcSetTime(offset);
this.setEnvelopeToTarget(currentTime, when, offset, tv.index, tv.left);
}
};
snd.Envelope.prototype.calcSetTime = function(time) {
var i, left;
if (time <= this._envelope[0].time) {
i = 0;
left = {time: time, value: this._envelope[0].value};
} else if (this._envelope[this._envelope.length - 1].time <= time) {
i = this._envelope.length - 1;
left = this._envelope[i];
} else {
var l = null, r = null, nowTimeVal = null;
for (i = 0; i < this._envelope.length; i++) {
if (this._envelope[i].time == time) {
nowTimeVal = this._envelope[i];
break;
} else if (this._envelope[i].time > time) {
l = this._envelope[i - 1];
r = this._envelope[i];
nowTimeVal = {time: time, value: l.value + (r.value - l.value) * (time - l.time) / (r.time - l.time)};
break;
}
}
left = nowTimeVal;
}
return {index: i, left: left};
};
snd.Envelope.prototype.setEnvelopeToTarget = function(currentTime, when, offset, idx, left) {
var startAt = currentTime + when;
this._target.cancelScheduledValues(0);
if (idx >= this._envelope.length) {
// Envelope already finished.
// Set last envelope value to target AudioParam and return this method.
this._target.setValueAtTime(left.value, startAt);
return;
}
// Set first envelope value to target AudioParam.
this._target.setValueAtTime(left.value, startAt);
for (var i = idx; i < this._envelope.length; i++) {
var e = this._envelope[i];
this._target.linearRampToValueAtTime(e.value, startAt + e.time - offset);
}
};
snd.Envelope.compareTimeValueArray = function(a, b) {
if (!a || !a.time) {
return -1;
}
if (!b || !b.time) {
return 1;
}
if (a.time < b.time) {
return -1;
} else if (a.time == b.time) {
return 0;
} else {
return 1;
}
};
return snd;
}));
| h10x64/snd.js | src/class/optional/TimeLine/snd.Envelope.js | JavaScript | mit | 8,752 |
package za.co.chavanga.camel.model;
/**
* File Name : Location.java
* Project Name : SparkTest
*
* @since Apr 4, 2017, 9:50:28 PM
* @author Abel Chavanga <achavanga@fnb.co.za>
*
*/
public class Location
{
private String type;
private String[] coordinates;
public String getType ()
{
return type;
}
public void setType (String type)
{
this.type = type;
}
public String[] getCoordinates ()
{
return coordinates;
}
public void setCoordinates (String[] coordinates)
{
this.coordinates = coordinates;
}
@Override
public String toString()
{
return "Location [type = "+type+", coordinates = "+coordinates+"]";
}
}
| achavanga/FoodTruck_Challenge | src/main/java/za/co/chavanga/camel/model/Location.java | Java | mit | 747 |
import unittest
from os import path
class RepoFiles(unittest.TestCase):
FILES = [
['./Dockerfile', './docker/Dockerfile'],
['./docker-compose.yml', './docker/docker-compose.yml'],
['./.env_sample'],
['./.gitignore'],
['./CHANGELOG.md'],
['./CODE_OF_CONDUCT.md'],
['./CONTRIBUTING.md'],
['./ISSUE_TEMPLATE.md'],
['./LICENSE'],
['./PULL_REQUEST_TEMPLATE.md'],
['./README.rst'],
['./TROUBLESHOOTING.md'],
['./USAGE.md'],
['./VERSION.txt']
]
def _all_file(self, files):
"""
Checks the list of files and sees if they exist. If all of them don't
exist, returns False. Otherwise, return True.
"""
return all(map(lambda f: not path.isfile(f), files))
def test_file_existence(self):
missing = list(filter(self._all_file, self.FILES))
self.assertEqual(len(missing), 0,
"Files {} aren't found".format(missing)
)
| sendgrid/python-http-client | tests/test_repofiles.py | Python | mit | 1,039 |
<?php namespace Omniphx\Forrest\Interfaces;
interface AuthenticationInterface {
/**
* Begin authentication process
* @param String $url
* @return mixed
*/
public function authenticate($url);
/**
* Refresh authentication token
* @return mixed $response
*/
public function refresh();
/**
* Revokes authentication token
* @return mixed $response
*/
public function revoke();
} | my-agent-finder/forrest | src/Omniphx/Forrest/Interfaces/AuthenticationInterface.php | PHP | mit | 434 |
import React from 'react/addons';
import {RouteStore, LinkTo} from 'fl-router';
import MailboxStore from '../stores/MailboxStore.js';
import MailboxRow from '../components/MailboxRow.js';
var PureRenderMixin = React.addons.PureRenderMixin;
function getStateFromStores () {
return {
mailboxId: MailboxStore.getSelectedMailboxId(),
mailboxes: MailboxStore.getMailboxes(), // Immutable.Map
activeURL: RouteStore.getURL()
};
}
export default React.createClass({
displayName: 'MailboxesView',
mixins: [PureRenderMixin],
getInitialState: function () {
return getStateFromStores();
},
componentWillMount: function () {
MailboxStore.addChangeListener(this._onChange);
},
componentWillUnmount: function () {
MailboxStore.removeChangeListener(this._onChange);
},
render: function () {
var mailboxes;
mailboxes = [];
// be careful here, if using .map() you will result in
// an immutable iterable that react does not natively support
this.state.mailboxes.forEach(function (mailbox, mailboxId) {
mailboxes.push(
<li key={mailboxId}>
<LinkTo route='mailbox' params={[mailboxId]} activeURL={this.state.activeURL}>
<MailboxRow mailbox={mailbox} />
</LinkTo>
</li>
);
}.bind(this));
return (
<ul className='mailboxes'>
{mailboxes}
</ul>
);
},
_onChange: function () {
this.setState(getStateFromStores());
}
});
| danjamin/react-fluxlike-mail-demo | app/views/MailboxesView.js | JavaScript | mit | 1,476 |
define([ 'libs/angular' ], function(angular) {
'use strict';
function ctrl($scope) {
}
return ctrl;
}); | erykpiast/appetite | public/controllers/footer.js | JavaScript | mit | 117 |
/*
* Copyright 1997-2017 Optimatika (www.optimatika.se)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.algo.matrix.store;
import static org.algo.function.ComplexFunction.*;
import java.util.List;
import org.algo.ProgrammingError;
import org.algo.access.Access1D;
import org.algo.access.Access2D;
import org.algo.array.Array1D;
import org.algo.array.Array2D;
import org.algo.array.BasicArray;
import org.algo.array.ComplexArray;
import org.algo.concurrent.DivideAndConquer;
import org.algo.function.BinaryFunction;
import org.algo.function.ComplexFunction;
import org.algo.function.FunctionSet;
import org.algo.function.FunctionUtils;
import org.algo.function.NullaryFunction;
import org.algo.function.UnaryFunction;
import org.algo.function.VoidFunction;
import org.algo.function.aggregator.Aggregator;
import org.algo.function.aggregator.AggregatorFunction;
import org.algo.function.aggregator.AggregatorSet;
import org.algo.function.aggregator.ComplexAggregator;
import org.algo.matrix.MatrixUtils;
import org.algo.matrix.decomposition.DecompositionStore;
import org.algo.matrix.store.operation.*;
import org.algo.matrix.transformation.Householder;
import org.algo.matrix.transformation.HouseholderReference;
import org.algo.matrix.transformation.Rotation;
import org.algo.scalar.ComplexNumber;
import org.algo.scalar.Scalar;
import org.algo.type.context.NumberContext;
/**
* A {@linkplain ComplexNumber} implementation of {@linkplain PhysicalStore}.
*
* @author apete
*/
public final class ComplexDenseStore extends ComplexArray implements PhysicalStore<ComplexNumber>, DecompositionStore<ComplexNumber> {
public static interface ComplexMultiplyBoth extends FillByMultiplying<ComplexNumber> {
}
public static interface ComplexMultiplyLeft {
void invoke(ComplexNumber[] product, Access1D<ComplexNumber> left, int complexity, ComplexNumber[] right);
}
public static interface ComplexMultiplyNeither {
void invoke(ComplexNumber[] product, ComplexNumber[] left, int complexity, ComplexNumber[] right);
}
public static interface ComplexMultiplyRight {
void invoke(ComplexNumber[] product, ComplexNumber[] left, int complexity, Access1D<ComplexNumber> right);
}
public static final PhysicalStore.Factory<ComplexNumber, ComplexDenseStore> FACTORY = new PhysicalStore.Factory<ComplexNumber, ComplexDenseStore>() {
public AggregatorSet<ComplexNumber> aggregator() {
return ComplexAggregator.getSet();
}
public MatrixStore.Factory<ComplexNumber> builder() {
return MatrixStore.COMPLEX;
}
public ComplexDenseStore columns(final Access1D<?>... source) {
final int tmpRowDim = (int) source[0].count();
final int tmpColDim = source.length;
final ComplexNumber[] tmpData = new ComplexNumber[tmpRowDim * tmpColDim];
Access1D<?> tmpColumn;
for (int j = 0; j < tmpColDim; j++) {
tmpColumn = source[j];
for (int i = 0; i < tmpRowDim; i++) {
tmpData[i + (tmpRowDim * j)] = ComplexNumber.valueOf(tmpColumn.get(i));
}
}
return new ComplexDenseStore(tmpRowDim, tmpColDim, tmpData);
}
public ComplexDenseStore columns(final double[]... source) {
final int tmpRowDim = source[0].length;
final int tmpColDim = source.length;
final ComplexNumber[] tmpData = new ComplexNumber[tmpRowDim * tmpColDim];
double[] tmpColumn;
for (int j = 0; j < tmpColDim; j++) {
tmpColumn = source[j];
for (int i = 0; i < tmpRowDim; i++) {
tmpData[i + (tmpRowDim * j)] = ComplexNumber.valueOf((Number) tmpColumn[i]);
}
}
return new ComplexDenseStore(tmpRowDim, tmpColDim, tmpData);
}
public ComplexDenseStore columns(final List<? extends Number>... source) {
final int tmpRowDim = source[0].size();
final int tmpColDim = source.length;
final ComplexNumber[] tmpData = new ComplexNumber[tmpRowDim * tmpColDim];
List<? extends Number> tmpColumn;
for (int j = 0; j < tmpColDim; j++) {
tmpColumn = source[j];
for (int i = 0; i < tmpRowDim; i++) {
tmpData[i + (tmpRowDim * j)] = ComplexNumber.valueOf(tmpColumn.get(i));
}
}
return new ComplexDenseStore(tmpRowDim, tmpColDim, tmpData);
}
public ComplexDenseStore columns(final Number[]... source) {
final int tmpRowDim = source[0].length;
final int tmpColDim = source.length;
final ComplexNumber[] tmpData = new ComplexNumber[tmpRowDim * tmpColDim];
Number[] tmpColumn;
for (int j = 0; j < tmpColDim; j++) {
tmpColumn = source[j];
for (int i = 0; i < tmpRowDim; i++) {
tmpData[i + (tmpRowDim * j)] = ComplexNumber.valueOf(tmpColumn[i]);
}
}
return new ComplexDenseStore(tmpRowDim, tmpColDim, tmpData);
}
public ComplexDenseStore conjugate(final Access2D<?> source) {
final ComplexDenseStore retVal = new ComplexDenseStore((int) source.countColumns(), (int) source.countRows());
final int tmpRowDim = retVal.getRowDim();
final int tmpColDim = retVal.getColDim();
if (tmpColDim > FillConjugated.THRESHOLD) {
final DivideAndConquer tmpConquerer = new DivideAndConquer() {
@Override
public void conquer(final int aFirst, final int aLimit) {
FillConjugated.invoke(retVal.data, tmpRowDim, aFirst, aLimit, source);
}
};
tmpConquerer.invoke(0, tmpColDim, FillConjugated.THRESHOLD);
} else {
FillConjugated.invoke(retVal.data, tmpRowDim, 0, tmpColDim, source);
}
return retVal;
}
public ComplexDenseStore copy(final Access2D<?> source) {
final int tmpRowDim = (int) source.countRows();
final int tmpColDim = (int) source.countColumns();
final ComplexDenseStore retVal = new ComplexDenseStore(tmpRowDim, tmpColDim);
if (tmpColDim > FillMatchingSingle.THRESHOLD) {
final DivideAndConquer tmpConquerer = new DivideAndConquer() {
@Override
public void conquer(final int aFirst, final int aLimit) {
FillMatchingSingle.invoke(retVal.data, tmpRowDim, aFirst, aLimit, source);
}
};
tmpConquerer.invoke(0, tmpColDim, FillMatchingSingle.THRESHOLD);
} else {
FillMatchingSingle.invoke(retVal.data, tmpRowDim, 0, tmpColDim, source);
}
return retVal;
}
public FunctionSet<ComplexNumber> function() {
return ComplexFunction.getSet();
}
public ComplexArray makeArray(final int length) {
return ComplexArray.make(length);
}
public ComplexDenseStore makeEye(final long rows, final long columns) {
final ComplexDenseStore retVal = this.makeZero(rows, columns);
retVal.myUtility.fillDiagonal(0, 0, ComplexNumber.ONE);
return retVal;
}
public ComplexDenseStore makeFilled(final long rows, final long columns, final NullaryFunction<?> supplier) {
final int tmpRowDim = (int) rows;
final int tmpColDim = (int) columns;
final int tmpLength = tmpRowDim * tmpColDim;
final ComplexNumber[] tmpData = new ComplexNumber[tmpLength];
for (int i = 0; i < tmpLength; i++) {
tmpData[i] = ComplexNumber.valueOf(supplier.get());
}
return new ComplexDenseStore(tmpRowDim, tmpColDim, tmpData);
}
public Householder.Complex makeHouseholder(final int length) {
return new Householder.Complex(length);
}
public Rotation.Complex makeRotation(final int low, final int high, final ComplexNumber cos, final ComplexNumber sin) {
return new Rotation.Complex(low, high, cos, sin);
}
public Rotation.Complex makeRotation(final int low, final int high, final double cos, final double sin) {
return this.makeRotation(low, high, ComplexNumber.valueOf(cos), ComplexNumber.valueOf(sin));
}
public ComplexDenseStore makeZero(final long rows, final long columns) {
return new ComplexDenseStore((int) rows, (int) columns);
}
public ComplexDenseStore rows(final Access1D<?>... source) {
final int tmpRowDim = source.length;
final int tmpColDim = (int) source[0].count();
final ComplexNumber[] tmpData = new ComplexNumber[tmpRowDim * tmpColDim];
Access1D<?> tmpRow;
for (int i = 0; i < tmpRowDim; i++) {
tmpRow = source[i];
for (int j = 0; j < tmpColDim; j++) {
tmpData[i + (tmpRowDim * j)] = ComplexNumber.valueOf(tmpRow.get(j));
}
}
return new ComplexDenseStore(tmpRowDim, tmpColDim, tmpData);
}
public ComplexDenseStore rows(final double[]... source) {
final int tmpRowDim = source.length;
final int tmpColDim = source[0].length;
final ComplexNumber[] tmpData = new ComplexNumber[tmpRowDim * tmpColDim];
double[] tmpRow;
for (int i = 0; i < tmpRowDim; i++) {
tmpRow = source[i];
for (int j = 0; j < tmpColDim; j++) {
tmpData[i + (tmpRowDim * j)] = ComplexNumber.valueOf((Number) tmpRow[j]);
}
}
return new ComplexDenseStore(tmpRowDim, tmpColDim, tmpData);
}
public ComplexDenseStore rows(final List<? extends Number>... source) {
final int tmpRowDim = source.length;
final int tmpColDim = source[0].size();
final ComplexNumber[] tmpData = new ComplexNumber[tmpRowDim * tmpColDim];
List<? extends Number> tmpRow;
for (int i = 0; i < tmpRowDim; i++) {
tmpRow = source[i];
for (int j = 0; j < tmpColDim; j++) {
tmpData[i + (tmpRowDim * j)] = ComplexNumber.valueOf(tmpRow.get(j));
}
}
return new ComplexDenseStore(tmpRowDim, tmpColDim, tmpData);
}
public ComplexDenseStore rows(final Number[]... source) {
final int tmpRowDim = source.length;
final int tmpColDim = source[0].length;
final ComplexNumber[] tmpData = new ComplexNumber[tmpRowDim * tmpColDim];
Number[] tmpRow;
for (int i = 0; i < tmpRowDim; i++) {
tmpRow = source[i];
for (int j = 0; j < tmpColDim; j++) {
tmpData[i + (tmpRowDim * j)] = ComplexNumber.valueOf(tmpRow[j]);
}
}
return new ComplexDenseStore(tmpRowDim, tmpColDim, tmpData);
}
public Scalar.Factory<ComplexNumber> scalar() {
return ComplexNumber.FACTORY;
}
public ComplexDenseStore transpose(final Access2D<?> source) {
final ComplexDenseStore retVal = new ComplexDenseStore((int) source.countColumns(), (int) source.countRows());
final int tmpRowDim = retVal.getRowDim();
final int tmpColDim = retVal.getColDim();
if (tmpColDim > FillTransposed.THRESHOLD) {
final DivideAndConquer tmpConquerer = new DivideAndConquer() {
@Override
public void conquer(final int aFirst, final int aLimit) {
FillTransposed.invoke(retVal.data, tmpRowDim, aFirst, aLimit, source);
}
};
tmpConquerer.invoke(0, tmpColDim, FillTransposed.THRESHOLD);
} else {
FillTransposed.invoke(retVal.data, tmpRowDim, 0, tmpColDim, source);
}
return retVal;
}
};
static ComplexDenseStore cast(final Access1D<ComplexNumber> matrix) {
if (matrix instanceof ComplexDenseStore) {
return (ComplexDenseStore) matrix;
} else if (matrix instanceof Access2D<?>) {
return FACTORY.copy((Access2D<?>) matrix);
} else {
return FACTORY.columns(matrix);
}
}
static Householder.Complex cast(final Householder<ComplexNumber> transformation) {
if (transformation instanceof Householder.Complex) {
return (Householder.Complex) transformation;
} else if (transformation instanceof HouseholderReference<?>) {
return ((Householder.Complex) ((HouseholderReference<ComplexNumber>) transformation).getWorker(FACTORY)).copy(transformation);
} else {
return new Householder.Complex(transformation);
}
}
static Rotation.Complex cast(final Rotation<ComplexNumber> transformation) {
if (transformation instanceof Rotation.Complex) {
return (Rotation.Complex) transformation;
} else {
return new Rotation.Complex(transformation);
}
}
private final ComplexMultiplyBoth multiplyBoth;
private final ComplexMultiplyLeft multiplyLeft;
private final ComplexMultiplyNeither multiplyNeither;
private final ComplexMultiplyRight multiplyRight;
private final int myColDim;
private final int myRowDim;
private final Array2D<ComplexNumber> myUtility;
ComplexDenseStore(final ComplexNumber[] anArray) {
super(anArray);
myRowDim = anArray.length;
myColDim = 1;
myUtility = this.asArray2D(myRowDim);
multiplyBoth = MultiplyBoth.getComplex(myRowDim, myColDim);
multiplyLeft = MultiplyLeft.getComplex(myRowDim, myColDim);
multiplyRight = MultiplyRight.getComplex(myRowDim, myColDim);
multiplyNeither = MultiplyNeither.getComplex(myRowDim, myColDim);
}
ComplexDenseStore(final int aLength) {
super(aLength);
myRowDim = aLength;
myColDim = 1;
myUtility = this.asArray2D(myRowDim);
multiplyBoth = MultiplyBoth.getComplex(myRowDim, myColDim);
multiplyLeft = MultiplyLeft.getComplex(myRowDim, myColDim);
multiplyRight = MultiplyRight.getComplex(myRowDim, myColDim);
multiplyNeither = MultiplyNeither.getComplex(myRowDim, myColDim);
}
ComplexDenseStore(final int aRowDim, final int aColDim) {
super(aRowDim * aColDim);
myRowDim = aRowDim;
myColDim = aColDim;
myUtility = this.asArray2D(myRowDim);
multiplyBoth = MultiplyBoth.getComplex(myRowDim, myColDim);
multiplyLeft = MultiplyLeft.getComplex(myRowDim, myColDim);
multiplyRight = MultiplyRight.getComplex(myRowDim, myColDim);
multiplyNeither = MultiplyNeither.getComplex(myRowDim, myColDim);
}
ComplexDenseStore(final int aRowDim, final int aColDim, final ComplexNumber[] anArray) {
super(anArray);
myRowDim = aRowDim;
myColDim = aColDim;
myUtility = this.asArray2D(myRowDim);
multiplyBoth = MultiplyBoth.getComplex(myRowDim, myColDim);
multiplyLeft = MultiplyLeft.getComplex(myRowDim, myColDim);
multiplyRight = MultiplyRight.getComplex(myRowDim, myColDim);
multiplyNeither = MultiplyNeither.getComplex(myRowDim, myColDim);
}
public void accept(final Access2D<?> supplied) {
for (long j = 0L; j < supplied.countColumns(); j++) {
for (long i = 0L; i < supplied.countRows(); i++) {
this.set(i, j, supplied.get(i, j));
}
}
}
public void add(final long row, final long col, final double addend) {
myUtility.add(row, col, addend);
}
public void add(final long row, final long col, final Number addend) {
myUtility.add(row, col, addend);
}
public ComplexNumber aggregateAll(final Aggregator aggregator) {
final int tmpRowDim = myRowDim;
final int tmpColDim = myColDim;
final AggregatorFunction<ComplexNumber> tmpMainAggr = aggregator.getFunction(ComplexAggregator.getSet());
if (tmpColDim > AggregateAll.THRESHOLD) {
final DivideAndConquer tmpConquerer = new DivideAndConquer() {
@Override
public void conquer(final int aFirst, final int aLimit) {
final AggregatorFunction<ComplexNumber> tmpPartAggr = aggregator.getFunction(ComplexAggregator.getSet());
ComplexDenseStore.this.visit(tmpRowDim * aFirst, tmpRowDim * aLimit, 1, tmpPartAggr);
synchronized (tmpMainAggr) {
tmpMainAggr.merge(tmpPartAggr.getNumber());
}
}
};
tmpConquerer.invoke(0, tmpColDim, AggregateAll.THRESHOLD);
} else {
ComplexDenseStore.this.visit(0, this.size(), 1, tmpMainAggr);
}
return tmpMainAggr.getNumber();
}
public void applyCholesky(final int iterationPoint, final BasicArray<ComplexNumber> multipliers) {
final ComplexNumber[] tmpData = data;
final ComplexNumber[] tmpColumn = ((ComplexArray) multipliers).data;
if ((myColDim - iterationPoint - 1) > ApplyCholesky.THRESHOLD) {
final DivideAndConquer tmpConquerer = new DivideAndConquer() {
@Override
protected void conquer(final int aFirst, final int aLimit) {
ApplyCholesky.invoke(tmpData, myRowDim, aFirst, aLimit, tmpColumn);
}
};
tmpConquerer.invoke(iterationPoint + 1, myColDim, ApplyCholesky.THRESHOLD);
} else {
ApplyCholesky.invoke(tmpData, myRowDim, iterationPoint + 1, myColDim, tmpColumn);
}
}
public void applyLDL(final int iterationPoint, final BasicArray<ComplexNumber> multipliers) {
final ComplexNumber[] tmpData = data;
final ComplexNumber[] tmpColumn = ((ComplexArray) multipliers).data;
if ((myColDim - iterationPoint - 1) > ApplyLDL.THRESHOLD) {
final DivideAndConquer tmpConquerer = new DivideAndConquer() {
@Override
protected void conquer(final int first, final int limit) {
ApplyLDL.invoke(tmpData, myRowDim, first, limit, tmpColumn, iterationPoint);
}
};
tmpConquerer.invoke(iterationPoint + 1, myColDim, ApplyLDL.THRESHOLD);
} else {
ApplyLDL.invoke(tmpData, myRowDim, iterationPoint + 1, myColDim, tmpColumn, iterationPoint);
}
}
public void applyLU(final int iterationPoint, final BasicArray<ComplexNumber> multipliers) {
final ComplexNumber[] tmpData = data;
final ComplexNumber[] tmpColumn = ((ComplexArray) multipliers).data;
if ((myColDim - iterationPoint - 1) > ApplyLU.THRESHOLD) {
final DivideAndConquer tmpConquerer = new DivideAndConquer() {
@Override
protected void conquer(final int aFirst, final int aLimit) {
ApplyLU.invoke(tmpData, myRowDim, aFirst, aLimit, tmpColumn, iterationPoint);
}
};
tmpConquerer.invoke(iterationPoint + 1, myColDim, ApplyLU.THRESHOLD);
} else {
ApplyLU.invoke(tmpData, myRowDim, iterationPoint + 1, myColDim, tmpColumn, iterationPoint);
}
}
public Array1D<ComplexNumber> asList() {
return myUtility.asArray1D();
}
public Array1D<ComplexNumber> computeInPlaceSchur(final PhysicalStore<ComplexNumber> transformationCollector, final boolean eigenvalue) {
ProgrammingError.throwForUnsupportedOptionalOperation();
return null;
}
public MatrixStore<ComplexNumber> conjugate() {
return new ConjugatedStore<>(this);
}
public ComplexDenseStore copy() {
return new ComplexDenseStore(myRowDim, myColDim, this.copyOfData());
}
public long countColumns() {
return myColDim;
}
public long countRows() {
return myRowDim;
}
public void divideAndCopyColumn(final int row, final int column, final BasicArray<ComplexNumber> destination) {
final ComplexNumber[] tmpData = data;
final int tmpRowDim = myRowDim;
final ComplexNumber[] tmpDestination = ((ComplexArray) destination).data;
int tmpIndex = row + (column * tmpRowDim);
final ComplexNumber tmpDenominator = tmpData[tmpIndex];
for (int i = row + 1; i < tmpRowDim; i++) {
tmpIndex++;
tmpDestination[i] = tmpData[tmpIndex] = tmpData[tmpIndex].divide(tmpDenominator);
}
}
public double doubleValue(final long aRow, final long aCol) {
return this.doubleValue(aRow + (aCol * myRowDim));
}
public boolean equals(final MatrixStore<ComplexNumber> other, final NumberContext context) {
return Access2D.equals(this, other, context);
}
@SuppressWarnings("unchecked")
@Override
public boolean equals(final Object anObj) {
if (anObj instanceof MatrixStore) {
return this.equals((MatrixStore<ComplexNumber>) anObj, NumberContext.getGeneral(6));
} else {
return super.equals(anObj);
}
}
public void exchangeColumns(final long colA, final long colB) {
myUtility.exchangeColumns(colA, colB);
}
public void exchangeHermitian(final int indexA, final int indexB) {
final int tmpMin = Math.min(indexA, indexB);
final int tmpMax = Math.max(indexA, indexB);
ComplexNumber tmpVal;
for (int j = 0; j < tmpMin; j++) {
tmpVal = this.get(tmpMin, j);
this.set(tmpMin, j, this.get(tmpMax, j));
this.set(tmpMax, j, tmpVal);
}
tmpVal = this.get(tmpMin, tmpMin);
this.set(tmpMin, tmpMin, this.get(tmpMax, tmpMax));
this.set(tmpMax, tmpMax, tmpVal);
for (int ij = tmpMin + 1; ij < tmpMax; ij++) {
tmpVal = this.get(ij, tmpMin);
this.set(ij, tmpMin, this.get(tmpMax, ij).conjugate());
this.set(tmpMax, ij, tmpVal.conjugate());
}
for (int i = tmpMax + 1; i < myRowDim; i++) {
tmpVal = this.get(i, tmpMin);
this.set(i, tmpMin, this.get(i, tmpMax));
this.set(i, tmpMax, tmpVal);
}
}
public void exchangeRows(final long rowA, final long rowB) {
myUtility.exchangeRows(rowA, rowB);
}
public void fillByMultiplying(final Access1D<ComplexNumber> left, final Access1D<ComplexNumber> right) {
final int tmpComplexity = ((int) left.count()) / myRowDim;
if (left instanceof ComplexDenseStore) {
if (right instanceof ComplexDenseStore) {
multiplyNeither.invoke(data, ComplexDenseStore.cast(left).data, tmpComplexity, ComplexDenseStore.cast(right).data);
} else {
multiplyRight.invoke(data, ComplexDenseStore.cast(left).data, tmpComplexity, right);
}
} else {
if (right instanceof ComplexDenseStore) {
multiplyLeft.invoke(data, left, tmpComplexity, ComplexDenseStore.cast(right).data);
} else {
multiplyBoth.invoke(this, left, tmpComplexity, right);
}
}
}
public void fillColumn(final long row, final long col, final ComplexNumber value) {
myUtility.fillColumn(row, col, value);
}
public void fillColumn(final long row, final long col, final NullaryFunction<ComplexNumber> supplier) {
myUtility.fillColumn(row, col, supplier);
}
public void fillDiagonal(final long row, final long col, final ComplexNumber value) {
myUtility.fillDiagonal(row, col, value);
}
public void fillDiagonal(final long row, final long col, final NullaryFunction<ComplexNumber> supplier) {
myUtility.fillDiagonal(row, col, supplier);
}
public void fillMatching(final Access1D<ComplexNumber> aLeftArg, final BinaryFunction<ComplexNumber> aFunc, final ComplexNumber aRightArg) {
final int tmpRowDim = myRowDim;
final int tmpColDim = myColDim;
if (tmpColDim > FillMatchingLeft.THRESHOLD) {
final DivideAndConquer tmpConquerer = new DivideAndConquer() {
@Override
protected void conquer(final int aFirst, final int aLimit) {
ComplexDenseStore.this.fill(tmpRowDim * aFirst, tmpRowDim * aLimit, aLeftArg, aFunc, aRightArg);
}
};
tmpConquerer.invoke(0, tmpColDim, FillMatchingLeft.THRESHOLD);
} else {
this.fill(0, tmpRowDim * tmpColDim, aLeftArg, aFunc, aRightArg);
}
}
public void fillMatching(final ComplexNumber aLeftArg, final BinaryFunction<ComplexNumber> aFunc, final Access1D<ComplexNumber> aRightArg) {
final int tmpRowDim = myRowDim;
final int tmpColDim = myColDim;
if (tmpColDim > FillMatchingRight.THRESHOLD) {
final DivideAndConquer tmpConquerer = new DivideAndConquer() {
@Override
protected void conquer(final int aFirst, final int aLimit) {
ComplexDenseStore.this.fill(tmpRowDim * aFirst, tmpRowDim * aLimit, aLeftArg, aFunc, aRightArg);
}
};
tmpConquerer.invoke(0, tmpColDim, FillMatchingRight.THRESHOLD);
} else {
this.fill(0, tmpRowDim * tmpColDim, aLeftArg, aFunc, aRightArg);
}
}
public void fillOne(final long row, final long col, final Access1D<?> values, final long valueIndex) {
this.set(row, col, values.get(valueIndex));
}
public void fillOne(final long row, final long col, final ComplexNumber value) {
myUtility.fillOne(row, col, value);
}
public void fillOne(final long row, final long col, final NullaryFunction<ComplexNumber> supplier) {
myUtility.fillOne(row, col, supplier);
}
public void fillRow(final long row, final long col, final ComplexNumber value) {
myUtility.fillRow(row, col, value);
}
public void fillRow(final long row, final long col, final NullaryFunction<ComplexNumber> supplier) {
myUtility.fillRow(row, col, supplier);
}
public boolean generateApplyAndCopyHouseholderColumn(final int row, final int column, final Householder<ComplexNumber> destination) {
return GenerateApplyAndCopyHouseholderColumn.invoke(data, myRowDim, row, column, (Householder.Complex) destination);
}
public boolean generateApplyAndCopyHouseholderRow(final int row, final int column, final Householder<ComplexNumber> destination) {
return GenerateApplyAndCopyHouseholderRow.invoke(data, myRowDim, row, column, (Householder.Complex) destination);
}
public final MatrixStore<ComplexNumber> get() {
return this;
}
public ComplexNumber get(final long aRow, final long aCol) {
return myUtility.get(aRow, aCol);
}
@Override
public int hashCode() {
return MatrixUtils.hashCode(this);
}
public long indexOfLargestInColumn(final long row, final long col) {
return myUtility.indexOfLargestInColumn(row, col);
}
public long indexOfLargestInRow(final long row, final long col) {
return myUtility.indexOfLargestInRow(row, col);
}
public long indexOfLargestOnDiagonal(final long first) {
return myUtility.indexOfLargestOnDiagonal(first);
}
public boolean isAbsolute(final long row, final long col) {
return myUtility.isAbsolute(row, col);
}
public boolean isColumnSmall(final long row, final long col, final double comparedTo) {
return myUtility.isColumnSmall(row, col, comparedTo);
}
public boolean isRowSmall(final long row, final long col, final double comparedTo) {
return myUtility.isRowSmall(row, col, comparedTo);
}
public boolean isSmall(final long row, final long col, final double comparedTo) {
return myUtility.isSmall(row, col, comparedTo);
}
@Override
public void modifyAll(final UnaryFunction<ComplexNumber> aFunc) {
final int tmpRowDim = myRowDim;
final int tmpColDim = myColDim;
if (tmpColDim > ModifyAll.THRESHOLD) {
final DivideAndConquer tmpConquerer = new DivideAndConquer() {
@Override
public void conquer(final int aFirst, final int aLimit) {
ComplexDenseStore.this.modify(tmpRowDim * aFirst, tmpRowDim * aLimit, 1, aFunc);
}
};
tmpConquerer.invoke(0, tmpColDim, ModifyAll.THRESHOLD);
} else {
this.modify(tmpRowDim * 0, tmpRowDim * tmpColDim, 1, aFunc);
}
}
public void modifyColumn(final long row, final long col, final UnaryFunction<ComplexNumber> modifier) {
myUtility.modifyColumn(row, col, modifier);
}
public void modifyDiagonal(final long row, final long col, final UnaryFunction<ComplexNumber> modifier) {
myUtility.modifyDiagonal(row, col, modifier);
}
public void modifyMatching(final Access1D<ComplexNumber> left, final BinaryFunction<ComplexNumber> function) {
final long tmpLimit = FunctionUtils.min(left.count(), this.count(), this.count());
for (long i = 0L; i < tmpLimit; i++) {
this.fillOne(i, function.invoke(left.get(i), this.get(i)));
}
}
public void modifyMatching(final BinaryFunction<ComplexNumber> function, final Access1D<ComplexNumber> right) {
final long tmpLimit = FunctionUtils.min(this.count(), right.count(), this.count());
for (long i = 0L; i < tmpLimit; i++) {
this.fillOne(i, function.invoke(this.get(i), right.get(i)));
}
}
public void modifyOne(final long row, final long col, final UnaryFunction<ComplexNumber> modifier) {
ComplexNumber tmpValue = this.get(row, col);
tmpValue = modifier.invoke(tmpValue);
this.set(row, col, tmpValue);
}
public void modifyRow(final long row, final long col, final UnaryFunction<ComplexNumber> modifier) {
myUtility.modifyRow(row, col, modifier);
}
public MatrixStore<ComplexNumber> multiply(final MatrixStore<ComplexNumber> right) {
final ComplexDenseStore retVal = FACTORY.makeZero(myRowDim, right.count() / myColDim);
if (right instanceof ComplexDenseStore) {
retVal.multiplyNeither.invoke(retVal.data, data, myColDim, ComplexDenseStore.cast(right).data);
} else {
retVal.multiplyRight.invoke(retVal.data, data, myColDim, right);
}
return retVal;
}
public ComplexNumber multiplyBoth(final Access1D<ComplexNumber> leftAndRight) {
final PhysicalStore<ComplexNumber> tmpStep1 = FACTORY.makeZero(1L, leftAndRight.count());
final PhysicalStore<ComplexNumber> tmpStep2 = FACTORY.makeZero(1L, 1L);
final PhysicalStore<ComplexNumber> tmpLeft = FACTORY.rows(leftAndRight);
tmpLeft.modifyAll(FACTORY.function().conjugate());
tmpStep1.fillByMultiplying(tmpLeft, this);
tmpStep2.fillByMultiplying(tmpStep1, leftAndRight);
return tmpStep2.get(0L);
}
public void negateColumn(final int column) {
myUtility.modifyColumn(0, column, ComplexFunction.NEGATE);
}
public PhysicalStore.Factory<ComplexNumber, ComplexDenseStore> physical() {
return FACTORY;
}
public final ElementsConsumer<ComplexNumber> regionByColumns(final int... columns) {
return new ColumnsRegion<>(this, multiplyBoth, columns);
}
public final ElementsConsumer<ComplexNumber> regionByLimits(final int rowLimit, final int columnLimit) {
return new LimitRegion<>(this, multiplyBoth, rowLimit, columnLimit);
}
public final ElementsConsumer<ComplexNumber> regionByOffsets(final int rowOffset, final int columnOffset) {
return new OffsetRegion<>(this, multiplyBoth, rowOffset, columnOffset);
}
public final ElementsConsumer<ComplexNumber> regionByRows(final int... rows) {
return new RowsRegion<>(this, multiplyBoth, rows);
}
public final ElementsConsumer<ComplexNumber> regionByTransposing() {
return new TransposedRegion<>(this, multiplyBoth);
}
public void rotateRight(final int aLow, final int aHigh, final double aCos, final double aSin) {
RotateRight.invoke(data, myRowDim, aLow, aHigh, FACTORY.scalar().cast(aCos), FACTORY.scalar().cast(aSin));
}
public void set(final long aRow, final long aCol, final double aNmbr) {
myUtility.set(aRow, aCol, aNmbr);
}
public void set(final long aRow, final long aCol, final Number aNmbr) {
myUtility.set(aRow, aCol, aNmbr);
}
public void setToIdentity(final int aCol) {
myUtility.set(aCol, aCol, ComplexNumber.ONE);
myUtility.fillColumn(aCol + 1, aCol, ComplexNumber.ZERO);
}
public Array1D<ComplexNumber> sliceColumn(final long row, final long col) {
return myUtility.sliceColumn(row, col);
}
public Array1D<ComplexNumber> sliceDiagonal(final long row, final long col) {
return myUtility.sliceDiagonal(row, col);
}
public Array1D<ComplexNumber> sliceRange(final long first, final long limit) {
return myUtility.sliceRange(first, limit);
}
public Array1D<ComplexNumber> sliceRow(final long row, final long col) {
return myUtility.sliceRow(row, col);
}
public void substituteBackwards(final Access2D<ComplexNumber> body, final boolean unitDiagonal, final boolean conjugated, final boolean hermitian) {
final int tmpRowDim = myRowDim;
final int tmpColDim = myColDim;
if (tmpColDim > SubstituteBackwards.THRESHOLD) {
final DivideAndConquer tmpConquerer = new DivideAndConquer() {
@Override
public void conquer(final int aFirst, final int aLimit) {
SubstituteBackwards.invoke(ComplexDenseStore.this.data, tmpRowDim, aFirst, aLimit, body, unitDiagonal, conjugated, hermitian);
}
};
tmpConquerer.invoke(0, tmpColDim, SubstituteBackwards.THRESHOLD);
} else {
SubstituteBackwards.invoke(data, tmpRowDim, 0, tmpColDim, body, unitDiagonal, conjugated, hermitian);
}
}
public void substituteForwards(final Access2D<ComplexNumber> body, final boolean unitDiagonal, final boolean conjugated, final boolean identity) {
final int tmpRowDim = myRowDim;
final int tmpColDim = myColDim;
if (tmpColDim > SubstituteForwards.THRESHOLD) {
final DivideAndConquer tmpConquerer = new DivideAndConquer() {
@Override
public void conquer(final int aFirst, final int aLimit) {
SubstituteForwards.invoke(ComplexDenseStore.this.data, tmpRowDim, aFirst, aLimit, body, unitDiagonal, conjugated, identity);
}
};
tmpConquerer.invoke(0, tmpColDim, SubstituteForwards.THRESHOLD);
} else {
SubstituteForwards.invoke(data, tmpRowDim, 0, tmpColDim, body, unitDiagonal, conjugated, identity);
}
}
public void supplyTo(final ElementsConsumer<ComplexNumber> receiver) {
receiver.fillMatching(this);
}
public Scalar<ComplexNumber> toScalar(final long row, final long column) {
return myUtility.get(row, column);
}
@Override
public final String toString() {
return MatrixUtils.toString(this);
}
public void transformLeft(final Householder<ComplexNumber> transformation, final int firstColumn) {
final Householder.Complex tmpTransf = ComplexDenseStore.cast(transformation);
final ComplexNumber[] tmpData = data;
final int tmpRowDim = myRowDim;
final int tmpColDim = myColDim;
if ((tmpColDim - firstColumn) > HouseholderLeft.THRESHOLD) {
final DivideAndConquer tmpConquerer = new DivideAndConquer() {
@Override
public void conquer(final int aFirst, final int aLimit) {
HouseholderLeft.invoke(tmpData, tmpRowDim, aFirst, aLimit, tmpTransf);
}
};
tmpConquerer.invoke(firstColumn, tmpColDim, HouseholderLeft.THRESHOLD);
} else {
HouseholderLeft.invoke(tmpData, tmpRowDim, firstColumn, tmpColDim, tmpTransf);
}
}
public void transformLeft(final Rotation<ComplexNumber> transformation) {
final Rotation.Complex tmpTransf = ComplexDenseStore.cast(transformation);
final int tmpLow = tmpTransf.low;
final int tmpHigh = tmpTransf.high;
if (tmpLow != tmpHigh) {
if ((tmpTransf.cos != null) && (tmpTransf.sin != null)) {
RotateLeft.invoke(data, myColDim, tmpLow, tmpHigh, tmpTransf.cos, tmpTransf.sin);
} else {
myUtility.exchangeRows(tmpLow, tmpHigh);
}
} else {
if (tmpTransf.cos != null) {
myUtility.modifyRow(tmpLow, 0, MULTIPLY.second(tmpTransf.cos));
} else if (tmpTransf.sin != null) {
myUtility.modifyRow(tmpLow, 0, DIVIDE.second(tmpTransf.sin));
} else {
myUtility.modifyRow(tmpLow, 0, NEGATE);
}
}
}
public void transformRight(final Householder<ComplexNumber> transformation, final int firstRow) {
final Householder.Complex tmpTransf = ComplexDenseStore.cast(transformation);
final ComplexNumber[] tmpData = data;
final int tmpRowDim = myRowDim;
final int tmpColDim = myColDim;
if ((tmpRowDim - firstRow) > HouseholderRight.THRESHOLD) {
final DivideAndConquer tmpConquerer = new DivideAndConquer() {
@Override
public void conquer(final int aFirst, final int aLimit) {
HouseholderRight.invoke(tmpData, aFirst, aLimit, tmpColDim, tmpTransf);
}
};
tmpConquerer.invoke(firstRow, tmpRowDim, HouseholderRight.THRESHOLD);
} else {
HouseholderRight.invoke(tmpData, firstRow, tmpRowDim, tmpColDim, tmpTransf);
}
}
public void transformRight(final Rotation<ComplexNumber> transformation) {
final Rotation.Complex tmpTransf = ComplexDenseStore.cast(transformation);
final int tmpLow = tmpTransf.low;
final int tmpHigh = tmpTransf.high;
if (tmpLow != tmpHigh) {
if ((tmpTransf.cos != null) && (tmpTransf.sin != null)) {
RotateRight.invoke(data, myRowDim, tmpLow, tmpHigh, tmpTransf.cos, tmpTransf.sin);
} else {
myUtility.exchangeColumns(tmpLow, tmpHigh);
}
} else {
if (tmpTransf.cos != null) {
myUtility.modifyColumn(0, tmpHigh, MULTIPLY.second(tmpTransf.cos));
} else if (tmpTransf.sin != null) {
myUtility.modifyColumn(0, tmpHigh, DIVIDE.second(tmpTransf.sin));
} else {
myUtility.modifyColumn(0, tmpHigh, NEGATE);
}
}
}
public void transformSymmetric(final Householder<ComplexNumber> transformation) {
HouseholderHermitian.invoke(data, ComplexDenseStore.cast(transformation), new ComplexNumber[(int) transformation.count()]);
}
public MatrixStore<ComplexNumber> transpose() {
return new TransposedStore<>(this);
}
public void tred2(final BasicArray<ComplexNumber> mainDiagonal, final BasicArray<ComplexNumber> offDiagonal, final boolean yesvecs) {
ProgrammingError.throwForUnsupportedOptionalOperation();
}
public void visitColumn(final long row, final long col, final VoidFunction<ComplexNumber> visitor) {
myUtility.visitColumn(row, col, visitor);
}
public void visitDiagonal(final long row, final long col, final VoidFunction<ComplexNumber> visitor) {
myUtility.visitDiagonal(row, col, visitor);
}
public void visitRow(final long row, final long col, final VoidFunction<ComplexNumber> visitor) {
myUtility.visitRow(row, col, visitor);
}
int getColDim() {
return myColDim;
}
int getMaxDim() {
return Math.max(myRowDim, myColDim);
}
int getMinDim() {
return Math.min(myRowDim, myColDim);
}
int getRowDim() {
return myRowDim;
}
}
| saurabhse/hybo | src/main/java/org/algo/matrix/store/ComplexDenseStore.java | Java | mit | 42,209 |
package gorm_test
import (
"fmt"
"testing"
)
func TestHasOneAndHasManyAssociation(t *testing.T) {
DB.DropTable(Category{})
DB.DropTable(Post{})
DB.DropTable(Comment{})
DB.CreateTable(Category{})
DB.CreateTable(Post{})
DB.CreateTable(Comment{})
post := Post{
Title: "post 1",
Body: "body 1",
Comments: []*Comment{{Content: "Comment 1"}, {Content: "Comment 2"}},
Category: Category{Name: "Category 1"},
MainCategory: Category{Name: "Main Category 1"},
}
if err := DB.Save(&post).Error; err != nil {
t.Errorf("Got errors when save post")
}
if DB.First(&Category{}, "name = ?", "Category 1").Error != nil {
t.Errorf("Category should be saved")
}
var p Post
DB.First(&p, post.Id)
if post.CategoryId.Int64 == 0 || p.CategoryId.Int64 == 0 || post.MainCategoryId == 0 || p.MainCategoryId == 0 {
t.Errorf("Category Id should exist")
}
if DB.First(&Comment{}, "content = ?", "Comment 1").Error != nil {
t.Errorf("Comment 1 should be saved")
}
if post.Comments[0].PostId == 0 {
t.Errorf("Comment Should have post id")
}
var comment Comment
if DB.First(&comment, "content = ?", "Comment 2").Error != nil {
t.Errorf("Comment 2 should be saved")
}
if comment.PostId == 0 {
t.Errorf("Comment 2 Should have post id")
}
comment3 := Comment{Content: "Comment 3", Post: Post{Title: "Title 3", Body: "Body 3"}}
DB.Save(&comment3)
}
func TestRelated(t *testing.T) {
user := User{
Name: "embroker",
BillingAddress: Address{Address1: "Billing Address - Address 1"},
ShippingAddress: Address{Address1: "Shipping Address - Address 1"},
Emails: []Email{{Email: "embroker@example.com"}, {Email: "embroker-2@example@example.com"}},
CreditCard: CreditCard{Number: "1234567890"},
Company: Company{Name: "company1"},
}
DB.Save(&user)
if user.CreditCard.ID == 0 {
t.Errorf("After user save, credit card should have id")
}
if user.BillingAddress.ID == 0 {
t.Errorf("After user save, billing address should have id")
}
if user.Emails[0].Id == 0 {
t.Errorf("After user save, billing address should have id")
}
var emails []Email
DB.Model(&user).Related(&emails)
if len(emails) != 2 {
t.Errorf("Should have two emails")
}
var emails2 []Email
DB.Model(&user).Where("email = ?", "embroker@example.com").Related(&emails2)
if len(emails2) != 1 {
t.Errorf("Should have two emails")
}
var user1 User
DB.Model(&user).Related(&user1.Emails)
if len(user1.Emails) != 2 {
t.Errorf("Should have only one email match related condition")
}
var address1 Address
DB.Model(&user).Related(&address1, "BillingAddressId")
if address1.Address1 != "Billing Address - Address 1" {
t.Errorf("Should get billing address from user correctly")
}
user1 = User{}
DB.Model(&address1).Related(&user1, "BillingAddressId")
if DB.NewRecord(user1) {
t.Errorf("Should get user from address correctly")
}
var user2 User
DB.Model(&emails[0]).Related(&user2)
if user2.Id != user.Id || user2.Name != user.Name {
t.Errorf("Should get user from email correctly")
}
var creditcard CreditCard
var user3 User
DB.First(&creditcard, "number = ?", "1234567890")
DB.Model(&creditcard).Related(&user3)
if user3.Id != user.Id || user3.Name != user.Name {
t.Errorf("Should get user from credit card correctly")
}
if !DB.Model(&CreditCard{}).Related(&User{}).RecordNotFound() {
t.Errorf("RecordNotFound for Related")
}
var company Company
if DB.Model(&user).Related(&company, "Company").RecordNotFound() || company.Name != "company1" {
t.Errorf("RecordNotFound for Related")
}
}
func TestManyToMany(t *testing.T) {
DB.Raw("delete from languages")
var languages = []Language{{Name: "ZH"}, {Name: "EN"}}
user := User{Name: "Many2Many", Languages: languages}
DB.Save(&user)
// Query
var newLanguages []Language
DB.Model(&user).Related(&newLanguages, "Languages")
if len(newLanguages) != len([]string{"ZH", "EN"}) {
t.Errorf("Query many to many relations")
}
newLanguages = []Language{}
DB.Model(&user).Association("Languages").Find(&newLanguages)
if len(newLanguages) != len([]string{"ZH", "EN"}) {
t.Errorf("Should be able to find many to many relations")
}
if DB.Model(&user).Association("Languages").Count() != len([]string{"ZH", "EN"}) {
t.Errorf("Count should return correct result")
}
// Append
DB.Model(&user).Association("Languages").Append(&Language{Name: "DE"})
if DB.Where("name = ?", "DE").First(&Language{}).RecordNotFound() {
t.Errorf("New record should be saved when append")
}
languageA := Language{Name: "AA"}
DB.Save(&languageA)
DB.Model(&User{Id: user.Id}).Association("Languages").Append(languageA)
languageC := Language{Name: "CC"}
DB.Save(&languageC)
DB.Model(&user).Association("Languages").Append(&[]Language{{Name: "BB"}, languageC})
DB.Model(&User{Id: user.Id}).Association("Languages").Append(&[]Language{{Name: "DD"}, {Name: "EE"}})
totalLanguages := []string{"ZH", "EN", "DE", "AA", "BB", "CC", "DD", "EE"}
if DB.Model(&user).Association("Languages").Count() != len(totalLanguages) {
t.Errorf("All appended languages should be saved")
}
// Delete
user.Languages = []Language{}
DB.Model(&user).Association("Languages").Find(&user.Languages)
var language Language
DB.Where("name = ?", "EE").First(&language)
DB.Model(&user).Association("Languages").Delete(language, &language)
if DB.Model(&user).Association("Languages").Count() != len(totalLanguages)-1 || len(user.Languages) != len(totalLanguages)-1 {
t.Errorf("Relations should be deleted with Delete")
}
if DB.Where("name = ?", "EE").First(&Language{}).RecordNotFound() {
t.Errorf("Language EE should not be deleted")
}
languages = []Language{}
DB.Where("name IN (?)", []string{"CC", "DD"}).Find(&languages)
user2 := User{Name: "Many2Many_User2", Languages: languages}
DB.Save(&user2)
DB.Model(&user).Association("Languages").Delete(languages, &languages)
if DB.Model(&user).Association("Languages").Count() != len(totalLanguages)-3 || len(user.Languages) != len(totalLanguages)-3 {
t.Errorf("Relations should be deleted with Delete")
}
if DB.Model(&user2).Association("Languages").Count() == 0 {
t.Errorf("Other user's relations should not be deleted")
}
// Replace
var languageB Language
DB.Where("name = ?", "BB").First(&languageB)
DB.Model(&user).Association("Languages").Replace(languageB)
if len(user.Languages) != 1 || DB.Model(&user).Association("Languages").Count() != 1 {
t.Errorf("Relations should be replaced")
}
DB.Model(&user).Association("Languages").Replace(&[]Language{{Name: "FF"}, {Name: "JJ"}})
if len(user.Languages) != 2 || DB.Model(&user).Association("Languages").Count() != len([]string{"FF", "JJ"}) {
t.Errorf("Relations should be replaced")
}
// Clear
DB.Model(&user).Association("Languages").Clear()
if len(user.Languages) != 0 || DB.Model(&user).Association("Languages").Count() != 0 {
t.Errorf("Relations should be cleared")
}
}
func TestForeignKey(t *testing.T) {
for _, structField := range DB.NewScope(&User{}).GetStructFields() {
for _, foreignKey := range []string{"BillingAddressID", "ShippingAddressId", "CompanyID"} {
if structField.Name == foreignKey && !structField.IsForeignKey {
t.Errorf(fmt.Sprintf("%v should be foreign key", foreignKey))
}
}
}
for _, structField := range DB.NewScope(&Email{}).GetStructFields() {
for _, foreignKey := range []string{"UserId"} {
if structField.Name == foreignKey && !structField.IsForeignKey {
t.Errorf(fmt.Sprintf("%v should be foreign key", foreignKey))
}
}
}
for _, structField := range DB.NewScope(&Post{}).GetStructFields() {
for _, foreignKey := range []string{"CategoryId", "MainCategoryId"} {
if structField.Name == foreignKey && !structField.IsForeignKey {
t.Errorf(fmt.Sprintf("%v should be foreign key", foreignKey))
}
}
}
for _, structField := range DB.NewScope(&Comment{}).GetStructFields() {
for _, foreignKey := range []string{"PostId"} {
if structField.Name == foreignKey && !structField.IsForeignKey {
t.Errorf(fmt.Sprintf("%v should be foreign key", foreignKey))
}
}
}
}
| embroker/gorm | association_test.go | GO | mit | 8,143 |
def get_service(context):
return context.services["emulator"]
def get_data(context):
return get_service(context).data
def get_search(context):
return get_service(context).data.search
def get_system(key, context):
return get_service(context).data.systems[key]
def get_systems(context):
return [d for (k, d) in get_system_items(context)]
def get_system_items(context):
return sorted(get_service(context).data.systems.items())
def get_bookmarks(context):
return get_service(context).data.bookmarks
def get_mru(context):
return get_service(context).data.mru
| dstenb/pylaunchr-emulator | emulator/utils.py | Python | mit | 600 |
@extends('app')
@section('content')
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<span class="pull-right"><a class="btn btn-primary" href="{{url('transaksi/pinjaman/baru')}}">Tambah Baru</a></span>
<h1>
Transaksi
<small>Pinjaman</small>
</h1>
</section>
<!-- Main content -->
<section class="content">
<div class="box">
<!-- /.box-header -->
<div class="box-body no-padding">
<div class="box-header with-border">
<h3 class="box-title">Data Transaksi Pinjaman</h3>
</div>
<div class="box-header with-border">
<table class="table">
<thead>
<tr>
<th>Nama</th>
<th>Jenis Pinjaman</th>
<th>Jumlah</th>
<th>Janga Waktu</th>
<th>Bunga</th>
<th>Status</th>
<!-- <th>Tindakan</th> -->
</tr>
</thead>
<tbody>
@foreach($data as $key)
<tr>
<td>{{\App\Anggota::find($key->id_anggota)['nama']}}</td>
<td>{{\App\Pinjaman::find($key->id_jenis)['nama']}}</td>
<td>Rp. {{$key->jumlah_total}}</td>
<td>{{$key->info_ke}} bulan</td>
<td>{{$key->bunga}}%</td>
<td>{{$key->status}}</td>
<!-- <td><a onclick="return confirm('Apakah Anda yakin akan menghapus transaksi pinjaman ini?')" href="{{url('transaksi/pinjaman/destroy/'.$key->id)}}">Hapus</a></td> -->
</tr>
@endforeach
</tbody>
</table>
{!!$data->render()!!}
</div>
</div>
</div>
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
@endsection | ariefsetya/kopsimpin | resources/views/transaksi/pinjaman/all.blade.php | PHP | mit | 2,143 |
import "ember";
import isEnabled from "ember-metal/features";
import { objectControllerDeprecation } from "ember-runtime/controllers/object_controller";
import EmberHandlebars from "ember-htmlbars/compat";
import EmberView from "ember-views/views/view";
var compile = EmberHandlebars.compile;
var Router, App, AppView, router, registry, container;
var set = Ember.set;
function bootApplication() {
router = container.lookup('router:main');
Ember.run(App, 'advanceReadiness');
}
// IE includes the host name
function normalizeUrl(url) {
return url.replace(/https?:\/\/[^\/]+/, '');
}
function shouldNotBeActive(selector) {
checkActive(selector, false);
}
function shouldBeActive(selector) {
checkActive(selector, true);
}
function checkActive(selector, active) {
var classList = Ember.$(selector, '#qunit-fixture')[0].className;
equal(classList.indexOf('active') > -1, active, selector + " active should be " + active.toString());
}
var updateCount, replaceCount;
function sharedSetup() {
App = Ember.Application.create({
name: "App",
rootElement: '#qunit-fixture'
});
App.deferReadiness();
updateCount = replaceCount = 0;
App.Router.reopen({
location: Ember.NoneLocation.createWithMixins({
setURL(path) {
updateCount++;
set(this, 'path', path);
},
replaceURL(path) {
replaceCount++;
set(this, 'path', path);
}
})
});
Router = App.Router;
registry = App.registry;
container = App.__container__;
}
function sharedTeardown() {
Ember.run(function() { App.destroy(); });
Ember.TEMPLATES = {};
}
QUnit.module("The {{link-to}} helper", {
setup() {
Ember.run(function() {
sharedSetup();
Ember.TEMPLATES.app = compile("{{outlet}}");
Ember.TEMPLATES.index = compile("<h3>Home</h3>{{#link-to 'about' id='about-link'}}About{{/link-to}}{{#link-to 'index' id='self-link'}}Self{{/link-to}}");
Ember.TEMPLATES.about = compile("<h3>About</h3>{{#link-to 'index' id='home-link'}}Home{{/link-to}}{{#link-to 'about' id='self-link'}}Self{{/link-to}}");
Ember.TEMPLATES.item = compile("<h3>Item</h3><p>{{model.name}}</p>{{#link-to 'index' id='home-link'}}Home{{/link-to}}");
AppView = EmberView.extend({
templateName: 'app'
});
registry.register('view:app', AppView);
registry.unregister('router:main');
registry.register('router:main', Router);
});
},
teardown: sharedTeardown
});
QUnit.test("The {{link-to}} helper moves into the named route", function() {
Router.map(function(match) {
this.route("about");
});
bootApplication();
Ember.run(function() {
router.handleURL("/");
});
equal(Ember.$('h3:contains(Home)', '#qunit-fixture').length, 1, "The home template was rendered");
equal(Ember.$('#self-link.active', '#qunit-fixture').length, 1, "The self-link was rendered with active class");
equal(Ember.$('#about-link:not(.active)', '#qunit-fixture').length, 1, "The other link was rendered without active class");
Ember.run(function() {
Ember.$('#about-link', '#qunit-fixture').click();
});
equal(Ember.$('h3:contains(About)', '#qunit-fixture').length, 1, "The about template was rendered");
equal(Ember.$('#self-link.active', '#qunit-fixture').length, 1, "The self-link was rendered with active class");
equal(Ember.$('#home-link:not(.active)', '#qunit-fixture').length, 1, "The other link was rendered without active class");
});
QUnit.test("The {{link-to}} helper supports URL replacement", function() {
Ember.TEMPLATES.index = compile("<h3>Home</h3>{{#link-to 'about' id='about-link' replace=true}}About{{/link-to}}");
Router.map(function() {
this.route("about");
});
bootApplication();
Ember.run(function() {
router.handleURL("/");
});
equal(updateCount, 0, 'precond: setURL has not been called');
equal(replaceCount, 0, 'precond: replaceURL has not been called');
Ember.run(function() {
Ember.$('#about-link', '#qunit-fixture').click();
});
equal(updateCount, 0, 'setURL should not be called');
equal(replaceCount, 1, 'replaceURL should be called once');
});
QUnit.test("the {{link-to}} helper doesn't add an href when the tagName isn't 'a'", function() {
Ember.TEMPLATES.index = compile("{{#link-to 'about' id='about-link' tagName='div'}}About{{/link-to}}");
Router.map(function() {
this.route("about");
});
bootApplication();
Ember.run(function() {
router.handleURL("/");
});
equal(Ember.$('#about-link').attr('href'), undefined, "there is no href attribute");
});
QUnit.test("the {{link-to}} applies a 'disabled' class when disabled", function () {
Ember.TEMPLATES.index = compile('{{#link-to "about" id="about-link" disabledWhen="shouldDisable"}}About{{/link-to}}');
App.IndexController = Ember.Controller.extend({
shouldDisable: true
});
Router.map(function() {
this.route("about");
});
bootApplication();
Ember.run(function() {
router.handleURL("/");
});
equal(Ember.$('#about-link.disabled', '#qunit-fixture').length, 1, "The link is disabled when its disabledWhen is true");
});
QUnit.test("the {{link-to}} doesn't apply a 'disabled' class if disabledWhen is not provided", function () {
Ember.TEMPLATES.index = compile('{{#link-to "about" id="about-link"}}About{{/link-to}}');
Router.map(function() {
this.route("about");
});
bootApplication();
Ember.run(function() {
router.handleURL("/");
});
ok(!Ember.$('#about-link', '#qunit-fixture').hasClass("disabled"), "The link is not disabled if disabledWhen not provided");
});
QUnit.test("the {{link-to}} helper supports a custom disabledClass", function () {
Ember.TEMPLATES.index = compile('{{#link-to "about" id="about-link" disabledWhen=true disabledClass="do-not-want"}}About{{/link-to}}');
Router.map(function() {
this.route("about");
});
bootApplication();
Ember.run(function() {
router.handleURL("/");
});
equal(Ember.$('#about-link.do-not-want', '#qunit-fixture').length, 1, "The link can apply a custom disabled class");
});
QUnit.test("the {{link-to}} helper does not respond to clicks when disabled", function () {
Ember.TEMPLATES.index = compile('{{#link-to "about" id="about-link" disabledWhen=true}}About{{/link-to}}');
Router.map(function() {
this.route("about");
});
bootApplication();
Ember.run(function() {
router.handleURL("/");
});
Ember.run(function() {
Ember.$('#about-link', '#qunit-fixture').click();
});
equal(Ember.$('h3:contains(About)', '#qunit-fixture').length, 0, "Transitioning did not occur");
});
QUnit.test("The {{link-to}} helper supports a custom activeClass", function() {
Ember.TEMPLATES.index = compile("<h3>Home</h3>{{#link-to 'about' id='about-link'}}About{{/link-to}}{{#link-to 'index' id='self-link' activeClass='zomg-active'}}Self{{/link-to}}");
Router.map(function() {
this.route("about");
});
bootApplication();
Ember.run(function() {
router.handleURL("/");
});
equal(Ember.$('h3:contains(Home)', '#qunit-fixture').length, 1, "The home template was rendered");
equal(Ember.$('#self-link.zomg-active', '#qunit-fixture').length, 1, "The self-link was rendered with active class");
equal(Ember.$('#about-link:not(.active)', '#qunit-fixture').length, 1, "The other link was rendered without active class");
});
QUnit.test("The {{link-to}} helper supports leaving off .index for nested routes", function() {
Router.map(function() {
this.resource("about", function() {
this.route("item");
});
});
Ember.TEMPLATES.about = compile("<h1>About</h1>{{outlet}}");
Ember.TEMPLATES['about/index'] = compile("<div id='index'>Index</div>");
Ember.TEMPLATES['about/item'] = compile("<div id='item'>{{#link-to 'about'}}About{{/link-to}}</div>");
bootApplication();
Ember.run(router, 'handleURL', '/about/item');
equal(normalizeUrl(Ember.$('#item a', '#qunit-fixture').attr('href')), '/about');
});
QUnit.test("The {{link-to}} helper supports currentWhen (DEPRECATED)", function() {
expectDeprecation('Using currentWhen with {{link-to}} is deprecated in favor of `current-when`.');
Router.map(function(match) {
this.resource("index", { path: "/" }, function() {
this.route("about");
});
this.route("item");
});
Ember.TEMPLATES.index = compile("<h3>Home</h3>{{outlet}}");
Ember.TEMPLATES['index/about'] = compile("{{#link-to 'item' id='other-link' currentWhen='index'}}ITEM{{/link-to}}");
bootApplication();
Ember.run(function() {
router.handleURL("/about");
});
equal(Ember.$('#other-link.active', '#qunit-fixture').length, 1, "The link is active since current-when is a parent route");
});
QUnit.test("The {{link-to}} helper supports custom, nested, current-when", function() {
Router.map(function(match) {
this.resource("index", { path: "/" }, function() {
this.route("about");
});
this.route("item");
});
Ember.TEMPLATES.index = compile("<h3>Home</h3>{{outlet}}");
Ember.TEMPLATES['index/about'] = compile("{{#link-to 'item' id='other-link' current-when='index'}}ITEM{{/link-to}}");
bootApplication();
Ember.run(function() {
router.handleURL("/about");
});
equal(Ember.$('#other-link.active', '#qunit-fixture').length, 1, "The link is active since current-when is a parent route");
});
QUnit.test("The {{link-to}} helper does not disregard current-when when it is given explicitly for a resource", function() {
Router.map(function(match) {
this.resource("index", { path: "/" }, function() {
this.route("about");
});
this.resource("items", function() {
this.route('item');
});
});
Ember.TEMPLATES.index = compile("<h3>Home</h3>{{outlet}}");
Ember.TEMPLATES['index/about'] = compile("{{#link-to 'items' id='other-link' current-when='index'}}ITEM{{/link-to}}");
bootApplication();
Ember.run(function() {
router.handleURL("/about");
});
equal(Ember.$('#other-link.active', '#qunit-fixture').length, 1, "The link is active when current-when is given for explicitly for a resource");
});
QUnit.test("The {{link-to}} helper supports multiple current-when routes", function() {
Router.map(function(match) {
this.resource("index", { path: "/" }, function() {
this.route("about");
});
this.route("item");
this.route("foo");
});
Ember.TEMPLATES.index = compile("<h3>Home</h3>{{outlet}}");
Ember.TEMPLATES['index/about'] = compile("{{#link-to 'item' id='link1' current-when='item index'}}ITEM{{/link-to}}");
Ember.TEMPLATES['item'] = compile("{{#link-to 'item' id='link2' current-when='item index'}}ITEM{{/link-to}}");
Ember.TEMPLATES['foo'] = compile("{{#link-to 'item' id='link3' current-when='item index'}}ITEM{{/link-to}}");
bootApplication();
Ember.run(function() {
router.handleURL("/about");
});
equal(Ember.$('#link1.active', '#qunit-fixture').length, 1, "The link is active since current-when contains the parent route");
Ember.run(function() {
router.handleURL("/item");
});
equal(Ember.$('#link2.active', '#qunit-fixture').length, 1, "The link is active since you are on the active route");
Ember.run(function() {
router.handleURL("/foo");
});
equal(Ember.$('#link3.active', '#qunit-fixture').length, 0, "The link is not active since current-when does not contain the active route");
});
QUnit.test("The {{link-to}} helper defaults to bubbling", function() {
Ember.TEMPLATES.about = compile("<div {{action 'hide'}}>{{#link-to 'about.contact' id='about-contact'}}About{{/link-to}}</div>{{outlet}}");
Ember.TEMPLATES['about/contact'] = compile("<h1 id='contact'>Contact</h1>");
Router.map(function() {
this.resource("about", function() {
this.route("contact");
});
});
var hidden = 0;
App.AboutRoute = Ember.Route.extend({
actions: {
hide() {
hidden++;
}
}
});
bootApplication();
Ember.run(function() {
router.handleURL("/about");
});
Ember.run(function() {
Ember.$('#about-contact', '#qunit-fixture').click();
});
equal(Ember.$("#contact", "#qunit-fixture").text(), "Contact", "precond - the link worked");
equal(hidden, 1, "The link bubbles");
});
QUnit.test("The {{link-to}} helper supports bubbles=false", function() {
Ember.TEMPLATES.about = compile("<div {{action 'hide'}}>{{#link-to 'about.contact' id='about-contact' bubbles=false}}About{{/link-to}}</div>{{outlet}}");
Ember.TEMPLATES['about/contact'] = compile("<h1 id='contact'>Contact</h1>");
Router.map(function() {
this.resource("about", function() {
this.route("contact");
});
});
var hidden = 0;
App.AboutRoute = Ember.Route.extend({
actions: {
hide() {
hidden++;
}
}
});
bootApplication();
Ember.run(function() {
router.handleURL("/about");
});
Ember.run(function() {
Ember.$('#about-contact', '#qunit-fixture').click();
});
equal(Ember.$("#contact", "#qunit-fixture").text(), "Contact", "precond - the link worked");
equal(hidden, 0, "The link didn't bubble");
});
QUnit.test("The {{link-to}} helper moves into the named route with context", function() {
Router.map(function(match) {
this.route("about");
this.resource("item", { path: "/item/:id" });
});
Ember.TEMPLATES.about = compile("<h3>List</h3><ul>{{#each model as |person|}}<li>{{#link-to 'item' person}}{{person.name}}{{/link-to}}</li>{{/each}}</ul>{{#link-to 'index' id='home-link'}}Home{{/link-to}}");
App.AboutRoute = Ember.Route.extend({
model() {
return Ember.A([
{ id: "yehuda", name: "Yehuda Katz" },
{ id: "tom", name: "Tom Dale" },
{ id: "erik", name: "Erik Brynroflsson" }
]);
}
});
App.ItemRoute = Ember.Route.extend({
serialize(object) {
return { id: object.id };
}
});
bootApplication();
Ember.run(function() {
router.handleURL("/about");
});
equal(Ember.$('h3:contains(List)', '#qunit-fixture').length, 1, "The home template was rendered");
equal(normalizeUrl(Ember.$('#home-link').attr('href')), '/', "The home link points back at /");
Ember.run(function() {
Ember.$('li a:contains(Yehuda)', '#qunit-fixture').click();
});
equal(Ember.$('h3:contains(Item)', '#qunit-fixture').length, 1, "The item template was rendered");
equal(Ember.$('p', '#qunit-fixture').text(), "Yehuda Katz", "The name is correct");
Ember.run(function() { Ember.$('#home-link').click(); });
Ember.run(function() { Ember.$('#about-link').click(); });
equal(normalizeUrl(Ember.$('li a:contains(Yehuda)').attr('href')), "/item/yehuda");
equal(normalizeUrl(Ember.$('li a:contains(Tom)').attr('href')), "/item/tom");
equal(normalizeUrl(Ember.$('li a:contains(Erik)').attr('href')), "/item/erik");
Ember.run(function() {
Ember.$('li a:contains(Erik)', '#qunit-fixture').click();
});
equal(Ember.$('h3:contains(Item)', '#qunit-fixture').length, 1, "The item template was rendered");
equal(Ember.$('p', '#qunit-fixture').text(), "Erik Brynroflsson", "The name is correct");
});
QUnit.test("The {{link-to}} helper binds some anchor html tag common attributes", function() {
Ember.TEMPLATES.index = compile("<h3>Home</h3>{{#link-to 'index' id='self-link' title='title-attr' rel='rel-attr' tabindex='-1'}}Self{{/link-to}}");
bootApplication();
Ember.run(function() {
router.handleURL("/");
});
var link = Ember.$('#self-link', '#qunit-fixture');
equal(link.attr('title'), 'title-attr', "The self-link contains title attribute");
equal(link.attr('rel'), 'rel-attr', "The self-link contains rel attribute");
equal(link.attr('tabindex'), '-1', "The self-link contains tabindex attribute");
});
QUnit.test("The {{link-to}} helper supports `target` attribute", function() {
Ember.TEMPLATES.index = compile("<h3>Home</h3>{{#link-to 'index' id='self-link' target='_blank'}}Self{{/link-to}}");
bootApplication();
Ember.run(function() {
router.handleURL("/");
});
var link = Ember.$('#self-link', '#qunit-fixture');
equal(link.attr('target'), '_blank', "The self-link contains `target` attribute");
});
QUnit.test("The {{link-to}} helper does not call preventDefault if `target` attribute is provided", function() {
Ember.TEMPLATES.index = compile("<h3>Home</h3>{{#link-to 'index' id='self-link' target='_blank'}}Self{{/link-to}}");
bootApplication();
Ember.run(function() {
router.handleURL("/");
});
var event = Ember.$.Event("click");
Ember.$('#self-link', '#qunit-fixture').trigger(event);
equal(event.isDefaultPrevented(), false, "should not preventDefault when target attribute is specified");
});
QUnit.test("The {{link-to}} helper should preventDefault when `target = _self`", function() {
Ember.TEMPLATES.index = compile("<h3>Home</h3>{{#link-to 'index' id='self-link' target='_self'}}Self{{/link-to}}");
bootApplication();
Ember.run(function() {
router.handleURL("/");
});
var event = Ember.$.Event("click");
Ember.$('#self-link', '#qunit-fixture').trigger(event);
equal(event.isDefaultPrevented(), true, "should preventDefault when target attribute is `_self`");
});
QUnit.test("The {{link-to}} helper should not transition if target is not equal to _self or empty", function() {
Ember.TEMPLATES.index = compile("{{#link-to 'about' id='about-link' replace=true target='_blank'}}About{{/link-to}}");
Router.map(function() {
this.route("about");
});
bootApplication();
Ember.run(function() {
router.handleURL("/");
});
Ember.run(function() {
Ember.$('#about-link', '#qunit-fixture').click();
});
notEqual(container.lookup('controller:application').get('currentRouteName'), 'about', 'link-to should not transition if target is not equal to _self or empty');
});
QUnit.test("The {{link-to}} helper accepts string/numeric arguments", function() {
Router.map(function() {
this.route('filter', { path: '/filters/:filter' });
this.route('post', { path: '/post/:post_id' });
this.route('repo', { path: '/repo/:owner/:name' });
});
App.FilterController = Ember.Controller.extend({
filter: "unpopular",
repo: Ember.Object.create({ owner: 'ember', name: 'ember.js' }),
post_id: 123
});
Ember.TEMPLATES.filter = compile('<p>{{filter}}</p>{{#link-to "filter" "unpopular" id="link"}}Unpopular{{/link-to}}{{#link-to "filter" filter id="path-link"}}Unpopular{{/link-to}}{{#link-to "post" post_id id="post-path-link"}}Post{{/link-to}}{{#link-to "post" 123 id="post-number-link"}}Post{{/link-to}}{{#link-to "repo" repo id="repo-object-link"}}Repo{{/link-to}}');
Ember.TEMPLATES.index = compile(' ');
bootApplication();
Ember.run(function() { router.handleURL("/filters/popular"); });
equal(normalizeUrl(Ember.$('#link', '#qunit-fixture').attr('href')), "/filters/unpopular");
equal(normalizeUrl(Ember.$('#path-link', '#qunit-fixture').attr('href')), "/filters/unpopular");
equal(normalizeUrl(Ember.$('#post-path-link', '#qunit-fixture').attr('href')), "/post/123");
equal(normalizeUrl(Ember.$('#post-number-link', '#qunit-fixture').attr('href')), "/post/123");
equal(normalizeUrl(Ember.$('#repo-object-link', '#qunit-fixture').attr('href')), "/repo/ember/ember.js");
});
QUnit.test("Issue 4201 - Shorthand for route.index shouldn't throw errors about context arguments", function() {
expect(2);
Router.map(function() {
this.resource('lobby', function() {
this.route('index', { path: ':lobby_id' });
this.route('list');
});
});
App.LobbyIndexRoute = Ember.Route.extend({
model(params) {
equal(params.lobby_id, 'foobar');
return params.lobby_id;
}
});
Ember.TEMPLATES['lobby/index'] = compile("{{#link-to 'lobby' 'foobar' id='lobby-link'}}Lobby{{/link-to}}");
Ember.TEMPLATES.index = compile("");
Ember.TEMPLATES['lobby/list'] = compile("{{#link-to 'lobby' 'foobar' id='lobby-link'}}Lobby{{/link-to}}");
bootApplication();
Ember.run(router, 'handleURL', '/lobby/list');
Ember.run(Ember.$('#lobby-link'), 'click');
shouldBeActive('#lobby-link');
});
QUnit.test("The {{link-to}} helper unwraps controllers", function() {
if (isEnabled('ember-routing-transitioning-classes')) {
expect(5);
} else {
expect(6);
}
Router.map(function() {
this.route('filter', { path: '/filters/:filter' });
});
var indexObject = { filter: 'popular' };
App.FilterRoute = Ember.Route.extend({
model(params) {
return indexObject;
},
serialize(passedObject) {
equal(passedObject, indexObject, "The unwrapped object is passed");
return { filter: 'popular' };
}
});
App.IndexRoute = Ember.Route.extend({
model() {
return indexObject;
}
});
Ember.TEMPLATES.filter = compile('<p>{{model.filter}}</p>');
Ember.TEMPLATES.index = compile('{{#link-to "filter" this id="link"}}Filter{{/link-to}}');
expectDeprecation(function() {
bootApplication();
}, /Providing `{{link-to}}` with a param that is wrapped in a controller is deprecated./);
Ember.run(function() { router.handleURL("/"); });
Ember.$('#link', '#qunit-fixture').trigger('click');
});
QUnit.test("The {{link-to}} helper doesn't change view context", function() {
App.IndexView = EmberView.extend({
elementId: 'index',
name: 'test',
isTrue: true
});
Ember.TEMPLATES.index = compile("{{view.name}}-{{#link-to 'index' id='self-link'}}Link: {{view.name}}-{{#if view.isTrue}}{{view.name}}{{/if}}{{/link-to}}");
bootApplication();
Ember.run(function() {
router.handleURL("/");
});
equal(Ember.$('#index', '#qunit-fixture').text(), 'test-Link: test-test', "accesses correct view");
});
QUnit.test("Quoteless route param performs property lookup", function() {
Ember.TEMPLATES.index = compile("{{#link-to 'index' id='string-link'}}string{{/link-to}}{{#link-to foo id='path-link'}}path{{/link-to}}{{#link-to view.foo id='view-link'}}{{view.foo}}{{/link-to}}");
function assertEquality(href) {
equal(normalizeUrl(Ember.$('#string-link', '#qunit-fixture').attr('href')), '/');
equal(normalizeUrl(Ember.$('#path-link', '#qunit-fixture').attr('href')), href);
equal(normalizeUrl(Ember.$('#view-link', '#qunit-fixture').attr('href')), href);
}
App.IndexView = EmberView.extend({
foo: 'index',
elementId: 'index-view'
});
App.IndexController = Ember.Controller.extend({
foo: 'index'
});
App.Router.map(function() {
this.route('about');
});
bootApplication();
Ember.run(router, 'handleURL', '/');
assertEquality('/');
var controller = container.lookup('controller:index');
var view = EmberView.views['index-view'];
Ember.run(function() {
controller.set('foo', 'about');
view.set('foo', 'about');
});
assertEquality('/about');
});
QUnit.test("link-to with null/undefined dynamic parameters are put in a loading state", function() {
expect(19);
var oldWarn = Ember.Logger.warn;
var warnCalled = false;
Ember.Logger.warn = function() { warnCalled = true; };
Ember.TEMPLATES.index = compile("{{#link-to destinationRoute routeContext loadingClass='i-am-loading' id='context-link'}}string{{/link-to}}{{#link-to secondRoute loadingClass='i-am-loading' id='static-link'}}string{{/link-to}}");
var thing = Ember.Object.create({ id: 123 });
App.IndexController = Ember.Controller.extend({
destinationRoute: null,
routeContext: null
});
App.AboutRoute = Ember.Route.extend({
activate() {
ok(true, "About was entered");
}
});
App.Router.map(function() {
this.route('thing', { path: '/thing/:thing_id' });
this.route('about');
});
bootApplication();
Ember.run(router, 'handleURL', '/');
function assertLinkStatus($link, url) {
if (url) {
equal(normalizeUrl($link.attr('href')), url, "loaded link-to has expected href");
ok(!$link.hasClass('i-am-loading'), "loaded linkComponent has no loadingClass");
} else {
equal(normalizeUrl($link.attr('href')), '#', "unloaded link-to has href='#'");
ok($link.hasClass('i-am-loading'), "loading linkComponent has loadingClass");
}
}
var $contextLink = Ember.$('#context-link', '#qunit-fixture');
var $staticLink = Ember.$('#static-link', '#qunit-fixture');
var controller = container.lookup('controller:index');
assertLinkStatus($contextLink);
assertLinkStatus($staticLink);
Ember.run(function() {
warnCalled = false;
$contextLink.click();
ok(warnCalled, "Logger.warn was called from clicking loading link");
});
// Set the destinationRoute (context is still null).
Ember.run(controller, 'set', 'destinationRoute', 'thing');
assertLinkStatus($contextLink);
// Set the routeContext to an id
Ember.run(controller, 'set', 'routeContext', '456');
assertLinkStatus($contextLink, '/thing/456');
// Test that 0 isn't interpreted as falsy.
Ember.run(controller, 'set', 'routeContext', 0);
assertLinkStatus($contextLink, '/thing/0');
// Set the routeContext to an object
Ember.run(controller, 'set', 'routeContext', thing);
assertLinkStatus($contextLink, '/thing/123');
// Set the destinationRoute back to null.
Ember.run(controller, 'set', 'destinationRoute', null);
assertLinkStatus($contextLink);
Ember.run(function() {
warnCalled = false;
$staticLink.click();
ok(warnCalled, "Logger.warn was called from clicking loading link");
});
Ember.run(controller, 'set', 'secondRoute', 'about');
assertLinkStatus($staticLink, '/about');
// Click the now-active link
Ember.run($staticLink, 'click');
Ember.Logger.warn = oldWarn;
});
QUnit.test("The {{link-to}} helper refreshes href element when one of params changes", function() {
Router.map(function() {
this.route('post', { path: '/posts/:post_id' });
});
var post = Ember.Object.create({ id: '1' });
var secondPost = Ember.Object.create({ id: '2' });
Ember.TEMPLATES.index = compile('{{#link-to "post" post id="post"}}post{{/link-to}}');
App.IndexController = Ember.Controller.extend();
var indexController = container.lookup('controller:index');
Ember.run(function() { indexController.set('post', post); });
bootApplication();
Ember.run(function() { router.handleURL("/"); });
equal(normalizeUrl(Ember.$('#post', '#qunit-fixture').attr('href')), '/posts/1', 'precond - Link has rendered href attr properly');
Ember.run(function() { indexController.set('post', secondPost); });
equal(Ember.$('#post', '#qunit-fixture').attr('href'), '/posts/2', 'href attr was updated after one of the params had been changed');
Ember.run(function() { indexController.set('post', null); });
equal(Ember.$('#post', '#qunit-fixture').attr('href'), '#', 'href attr becomes # when one of the arguments in nullified');
});
QUnit.test("The {{link-to}} helper's bound parameter functionality works as expected in conjunction with an ObjectProxy/Controller", function() {
expectDeprecation(objectControllerDeprecation);
Router.map(function() {
this.route('post', { path: '/posts/:post_id' });
});
var post = Ember.Object.create({ id: '1' });
var secondPost = Ember.Object.create({ id: '2' });
Ember.TEMPLATES = {
index: compile(' '),
post: compile('{{#link-to "post" this id="self-link"}}selflink{{/link-to}}')
};
App.PostController = Ember.ObjectController.extend();
var postController = container.lookup('controller:post');
bootApplication();
Ember.run(router, 'transitionTo', 'post', post);
var $link = Ember.$('#self-link', '#qunit-fixture');
equal(normalizeUrl($link.attr('href')), '/posts/1', 'self link renders post 1');
Ember.run(postController, 'set', 'model', secondPost);
equal(normalizeUrl($link.attr('href')), '/posts/2', 'self link updated to post 2');
});
QUnit.test("{{linkTo}} is aliased", function() {
Ember.TEMPLATES.index = compile("<h3>Home</h3>{{#linkTo 'about' id='about-link' replace=true}}About{{/linkTo}}");
Router.map(function() {
this.route("about");
});
expectDeprecation(function() {
bootApplication();
}, "The 'linkTo' view helper is deprecated in favor of 'link-to'");
Ember.run(function() {
router.handleURL("/");
});
Ember.run(function() {
Ember.$('#about-link', '#qunit-fixture').click();
});
equal(container.lookup('controller:application').get('currentRouteName'), 'about', 'linkTo worked properly');
});
QUnit.test("The {{link-to}} helper is active when a resource is active", function() {
Router.map(function() {
this.resource("about", function() {
this.route("item");
});
});
Ember.TEMPLATES.about = compile("<div id='about'>{{#link-to 'about' id='about-link'}}About{{/link-to}} {{#link-to 'about.item' id='item-link'}}Item{{/link-to}} {{outlet}}</div>");
Ember.TEMPLATES['about/item'] = compile(" ");
Ember.TEMPLATES['about/index'] = compile(" ");
bootApplication();
Ember.run(router, 'handleURL', '/about');
equal(Ember.$('#about-link.active', '#qunit-fixture').length, 1, "The about resource link is active");
equal(Ember.$('#item-link.active', '#qunit-fixture').length, 0, "The item route link is inactive");
Ember.run(router, 'handleURL', '/about/item');
equal(Ember.$('#about-link.active', '#qunit-fixture').length, 1, "The about resource link is active");
equal(Ember.$('#item-link.active', '#qunit-fixture').length, 1, "The item route link is active");
});
QUnit.test("The {{link-to}} helper works in an #each'd array of string route names", function() {
Router.map(function() {
this.route('foo');
this.route('bar');
this.route('rar');
});
App.IndexController = Ember.Controller.extend({
routeNames: Ember.A(['foo', 'bar', 'rar']),
route1: 'bar',
route2: 'foo'
});
Ember.TEMPLATES = {
index: compile('{{#each routeNames as |routeName|}}{{#link-to routeName}}{{routeName}}{{/link-to}}{{/each}}{{#each routeNames as |r|}}{{#link-to r}}{{r}}{{/link-to}}{{/each}}{{#link-to route1}}a{{/link-to}}{{#link-to route2}}b{{/link-to}}')
};
bootApplication();
function linksEqual($links, expected) {
equal($links.length, expected.length, "Has correct number of links");
var idx;
for (idx = 0; idx < $links.length; idx++) {
var href = Ember.$($links[idx]).attr('href');
// Old IE includes the whole hostname as well
equal(href.slice(-expected[idx].length), expected[idx], "Expected link to be '"+expected[idx]+"', but was '"+href+"'");
}
}
linksEqual(Ember.$('a', '#qunit-fixture'), ["/foo", "/bar", "/rar", "/foo", "/bar", "/rar", "/bar", "/foo"]);
var indexController = container.lookup('controller:index');
Ember.run(indexController, 'set', 'route1', 'rar');
linksEqual(Ember.$('a', '#qunit-fixture'), ["/foo", "/bar", "/rar", "/foo", "/bar", "/rar", "/rar", "/foo"]);
Ember.run(indexController.routeNames, 'shiftObject');
linksEqual(Ember.$('a', '#qunit-fixture'), ["/bar", "/rar", "/bar", "/rar", "/rar", "/foo"]);
});
QUnit.test("The non-block form {{link-to}} helper moves into the named route", function() {
expect(3);
Router.map(function(match) {
this.route("contact");
});
Ember.TEMPLATES.index = compile("<h3>Home</h3>{{link-to 'Contact us' 'contact' id='contact-link'}}{{#link-to 'index' id='self-link'}}Self{{/link-to}}");
Ember.TEMPLATES.contact = compile("<h3>Contact</h3>{{link-to 'Home' 'index' id='home-link'}}{{link-to 'Self' 'contact' id='self-link'}}");
bootApplication();
Ember.run(function() {
Ember.$('#contact-link', '#qunit-fixture').click();
});
equal(Ember.$('h3:contains(Contact)', '#qunit-fixture').length, 1, "The contact template was rendered");
equal(Ember.$('#self-link.active', '#qunit-fixture').length, 1, "The self-link was rendered with active class");
equal(Ember.$('#home-link:not(.active)', '#qunit-fixture').length, 1, "The other link was rendered without active class");
});
QUnit.test("The non-block form {{link-to}} helper updates the link text when it is a binding", function() {
expect(8);
Router.map(function(match) {
this.route("contact");
});
App.IndexController = Ember.Controller.extend({
contactName: 'Jane'
});
Ember.TEMPLATES.index = compile("<h3>Home</h3>{{link-to contactName 'contact' id='contact-link'}}{{#link-to 'index' id='self-link'}}Self{{/link-to}}");
Ember.TEMPLATES.contact = compile("<h3>Contact</h3>{{link-to 'Home' 'index' id='home-link'}}{{link-to 'Self' 'contact' id='self-link'}}");
bootApplication();
Ember.run(function() {
router.handleURL("/");
});
var controller = container.lookup('controller:index');
equal(Ember.$('#contact-link:contains(Jane)', '#qunit-fixture').length, 1, "The link title is correctly resolved");
Ember.run(function() {
controller.set('contactName', 'Joe');
});
equal(Ember.$('#contact-link:contains(Joe)', '#qunit-fixture').length, 1, "The link title is correctly updated when the bound property changes");
Ember.run(function() {
controller.set('contactName', 'Robert');
});
equal(Ember.$('#contact-link:contains(Robert)', '#qunit-fixture').length, 1, "The link title is correctly updated when the bound property changes a second time");
Ember.run(function() {
Ember.$('#contact-link', '#qunit-fixture').click();
});
equal(Ember.$('h3:contains(Contact)', '#qunit-fixture').length, 1, "The contact template was rendered");
equal(Ember.$('#self-link.active', '#qunit-fixture').length, 1, "The self-link was rendered with active class");
equal(Ember.$('#home-link:not(.active)', '#qunit-fixture').length, 1, "The other link was rendered without active class");
Ember.run(function() {
Ember.$('#home-link', '#qunit-fixture').click();
});
equal(Ember.$('h3:contains(Home)', '#qunit-fixture').length, 1, "The index template was rendered");
equal(Ember.$('#contact-link:contains(Robert)', '#qunit-fixture').length, 1, "The link title is correctly updated when the route changes");
});
QUnit.test("The non-block form {{link-to}} helper moves into the named route with context", function() {
expect(5);
Router.map(function(match) {
this.route("item", { path: "/item/:id" });
});
App.IndexRoute = Ember.Route.extend({
model() {
return Ember.A([
{ id: "yehuda", name: "Yehuda Katz" },
{ id: "tom", name: "Tom Dale" },
{ id: "erik", name: "Erik Brynroflsson" }
]);
}
});
App.ItemRoute = Ember.Route.extend({
serialize(object) {
return { id: object.id };
}
});
Ember.TEMPLATES.index = compile("<h3>Home</h3><ul>{{#each controller as |person|}}<li>{{link-to person.name 'item' person}}</li>{{/each}}</ul>");
Ember.TEMPLATES.item = compile("<h3>Item</h3><p>{{model.name}}</p>{{#link-to 'index' id='home-link'}}Home{{/link-to}}");
bootApplication();
Ember.run(function() {
Ember.$('li a:contains(Yehuda)', '#qunit-fixture').click();
});
equal(Ember.$('h3:contains(Item)', '#qunit-fixture').length, 1, "The item template was rendered");
equal(Ember.$('p', '#qunit-fixture').text(), "Yehuda Katz", "The name is correct");
Ember.run(function() { Ember.$('#home-link').click(); });
equal(normalizeUrl(Ember.$('li a:contains(Yehuda)').attr('href')), "/item/yehuda");
equal(normalizeUrl(Ember.$('li a:contains(Tom)').attr('href')), "/item/tom");
equal(normalizeUrl(Ember.$('li a:contains(Erik)').attr('href')), "/item/erik");
});
QUnit.test("The non-block form {{link-to}} performs property lookup", function() {
Ember.TEMPLATES.index = compile("{{link-to 'string' 'index' id='string-link'}}{{link-to path foo id='path-link'}}{{link-to view.foo view.foo id='view-link'}}");
function assertEquality(href) {
equal(normalizeUrl(Ember.$('#string-link', '#qunit-fixture').attr('href')), '/');
equal(normalizeUrl(Ember.$('#path-link', '#qunit-fixture').attr('href')), href);
equal(normalizeUrl(Ember.$('#view-link', '#qunit-fixture').attr('href')), href);
}
App.IndexView = EmberView.extend({
foo: 'index',
elementId: 'index-view'
});
App.IndexController = Ember.Controller.extend({
foo: 'index'
});
App.Router.map(function() {
this.route('about');
});
bootApplication();
Ember.run(router, 'handleURL', '/');
assertEquality('/');
var controller = container.lookup('controller:index');
var view = EmberView.views['index-view'];
Ember.run(function() {
controller.set('foo', 'about');
view.set('foo', 'about');
});
assertEquality('/about');
});
QUnit.test("The non-block form {{link-to}} protects against XSS", function() {
Ember.TEMPLATES.application = compile("{{link-to display 'index' id='link'}}");
App.ApplicationController = Ember.Controller.extend({
display: 'blahzorz'
});
bootApplication();
Ember.run(router, 'handleURL', '/');
var controller = container.lookup('controller:application');
equal(Ember.$('#link', '#qunit-fixture').text(), 'blahzorz');
Ember.run(function() {
controller.set('display', '<b>BLAMMO</b>');
});
equal(Ember.$('#link', '#qunit-fixture').text(), '<b>BLAMMO</b>');
equal(Ember.$('b', '#qunit-fixture').length, 0);
});
QUnit.test("the {{link-to}} helper calls preventDefault", function() {
Router.map(function() {
this.route("about");
});
bootApplication();
Ember.run(router, 'handleURL', '/');
var event = Ember.$.Event("click");
Ember.$('#about-link', '#qunit-fixture').trigger(event);
equal(event.isDefaultPrevented(), true, "should preventDefault");
});
QUnit.test("the {{link-to}} helper does not call preventDefault if `preventDefault=false` is passed as an option", function() {
Ember.TEMPLATES.index = compile("{{#link-to 'about' id='about-link' preventDefault=false}}About{{/link-to}}");
Router.map(function() {
this.route("about");
});
bootApplication();
Ember.run(router, 'handleURL', '/');
var event = Ember.$.Event("click");
Ember.$('#about-link', '#qunit-fixture').trigger(event);
equal(event.isDefaultPrevented(), false, "should not preventDefault");
});
QUnit.test("the {{link-to}} helper does not throw an error if its route has exited", function() {
expect(0);
Ember.TEMPLATES.application = compile("{{#link-to 'index' id='home-link'}}Home{{/link-to}}{{#link-to 'post' defaultPost id='default-post-link'}}Default Post{{/link-to}}{{#if currentPost}}{{#link-to 'post' id='post-link'}}Post{{/link-to}}{{/if}}");
App.ApplicationController = Ember.Controller.extend({
needs: ['post'],
currentPost: Ember.computed.alias('controllers.post.model')
});
App.PostController = Ember.Controller.extend({
model: { id: 1 }
});
Router.map(function() {
this.route("post", { path: 'post/:post_id' });
});
bootApplication();
Ember.run(router, 'handleURL', '/');
Ember.run(function() {
Ember.$('#default-post-link', '#qunit-fixture').click();
});
Ember.run(function() {
Ember.$('#home-link', '#qunit-fixture').click();
});
});
QUnit.test("{{link-to}} active property respects changing parent route context", function() {
Ember.TEMPLATES.application = compile(
"{{link-to 'OMG' 'things' 'omg' id='omg-link'}} " +
"{{link-to 'LOL' 'things' 'lol' id='lol-link'}} ");
Router.map(function() {
this.resource('things', { path: '/things/:name' }, function() {
this.route('other');
});
});
bootApplication();
Ember.run(router, 'handleURL', '/things/omg');
shouldBeActive('#omg-link');
shouldNotBeActive('#lol-link');
Ember.run(router, 'handleURL', '/things/omg/other');
shouldBeActive('#omg-link');
shouldNotBeActive('#lol-link');
});
QUnit.test("{{link-to}} populates href with default query param values even without query-params object", function() {
if (isEnabled('ember-routing-route-configured-query-params')) {
App.IndexRoute = Ember.Route.extend({
queryParams: {
foo: {
defaultValue: '123'
}
}
});
} else {
App.IndexController = Ember.Controller.extend({
queryParams: ['foo'],
foo: '123'
});
}
Ember.TEMPLATES.index = compile("{{#link-to 'index' id='the-link'}}Index{{/link-to}}");
bootApplication();
equal(Ember.$('#the-link').attr('href'), "/", "link has right href");
});
QUnit.test("{{link-to}} populates href with default query param values with empty query-params object", function() {
if (isEnabled('ember-routing-route-configured-query-params')) {
App.IndexRoute = Ember.Route.extend({
queryParams: {
foo: {
defaultValue: '123'
}
}
});
} else {
App.IndexController = Ember.Controller.extend({
queryParams: ['foo'],
foo: '123'
});
}
Ember.TEMPLATES.index = compile("{{#link-to 'index' (query-params) id='the-link'}}Index{{/link-to}}");
bootApplication();
equal(Ember.$('#the-link').attr('href'), "/", "link has right href");
});
QUnit.test("{{link-to}} populates href with supplied query param values", function() {
if (isEnabled('ember-routing-route-configured-query-params')) {
App.IndexRoute = Ember.Route.extend({
queryParams: {
foo: {
defaultValue: '123'
}
}
});
} else {
App.IndexController = Ember.Controller.extend({
queryParams: ['foo'],
foo: '123'
});
}
Ember.TEMPLATES.index = compile("{{#link-to 'index' (query-params foo='456') id='the-link'}}Index{{/link-to}}");
bootApplication();
equal(Ember.$('#the-link').attr('href'), "/?foo=456", "link has right href");
});
QUnit.test("{{link-to}} populates href with partially supplied query param values", function() {
if (isEnabled('ember-routing-route-configured-query-params')) {
App.IndexRoute = Ember.Route.extend({
queryParams: {
foo: {
defaultValue: '123'
},
bar: {
defaultValue: 'yes'
}
}
});
} else {
App.IndexController = Ember.Controller.extend({
queryParams: ['foo'],
foo: '123',
bar: 'yes'
});
}
Ember.TEMPLATES.index = compile("{{#link-to 'index' (query-params foo='456') id='the-link'}}Index{{/link-to}}");
bootApplication();
equal(Ember.$('#the-link').attr('href'), "/?foo=456", "link has right href");
});
QUnit.test("{{link-to}} populates href with partially supplied query param values, but omits if value is default value", function() {
if (isEnabled('ember-routing-route-configured-query-params')) {
App.IndexRoute = Ember.Route.extend({
queryParams: {
foo: {
defaultValue: '123'
}
}
});
} else {
App.IndexController = Ember.Controller.extend({
queryParams: ['foo'],
foo: '123'
});
}
Ember.TEMPLATES.index = compile("{{#link-to 'index' (query-params foo='123') id='the-link'}}Index{{/link-to}}");
bootApplication();
equal(Ember.$('#the-link').attr('href'), "/", "link has right href");
});
QUnit.test("{{link-to}} populates href with fully supplied query param values", function() {
if (isEnabled('ember-routing-route-configured-query-params')) {
App.IndexRoute = Ember.Route.extend({
queryParams: {
foo: {
defaultValue: '123'
},
bar: {
defaultValue: 'yes'
}
}
});
} else {
App.IndexController = Ember.Controller.extend({
queryParams: ['foo', 'bar'],
foo: '123',
bar: 'yes'
});
}
Ember.TEMPLATES.index = compile("{{#link-to 'index' (query-params foo='456' bar='NAW') id='the-link'}}Index{{/link-to}}");
bootApplication();
equal(Ember.$('#the-link').attr('href'), "/?bar=NAW&foo=456", "link has right href");
});
| thejameskyle/ember.js | packages/ember/tests/helpers/link_to_test.js | JavaScript | mit | 43,612 |