text:
#include <aws/evidently/model/ExperimentResultsData.h>
#include <aws/core/utils/json/JsonSerializer.h>

#include <utility>

using namespace Aws::Utils::Json;
using namespace Aws::Utils;

namespace Aws
{
namespace CloudWatchEvidently
{
namespace Model
{

ExperimentResultsData::ExperimentResultsData() :
    m_metricNameHasBeenSet(false),
    m_resultStat(ExperimentResultResponseType::NOT_SET),
    m_resultStatHasBeenSet(false),
    m_treatmentNameHasBeenSet(false),
    m_valuesHasBeenSet(false)
{
}

ExperimentResultsData::ExperimentResultsData(JsonView jsonValue) :
    m_metricNameHasBeenSet(false),
    m_resultStat(ExperimentResultResponseType::NOT_SET),
    m_resultStatHasBeenSet(false),
    m_treatmentNameHasBeenSet(false),
    m_valuesHasBeenSet(false)
{
  *this = jsonValue;
}

ExperimentResultsData& ExperimentResultsData::operator =(JsonView jsonValue)
{
  if(jsonValue.ValueExists("metricName"))
  {
    m_metricName = jsonValue.GetString("metricName");

    m_metricNameHasBeenSet = true;
  }

  if(jsonValue.ValueExists("resultStat"))
  {
    m_resultStat = ExperimentResultResponseTypeMapper::GetExperimentResultResponseTypeForName(jsonValue.GetString("resultStat"));

    m_resultStatHasBeenSet = true;
  }

  if(jsonValue.ValueExists("treatmentName"))
  {
    m_treatmentName = jsonValue.GetString("treatmentName");

    m_treatmentNameHasBeenSet = true;
  }

  if(jsonValue.ValueExists("values"))
  {
    Aws::Utils::Array<JsonView> valuesJsonList = jsonValue.GetArray("values");
    for(unsigned valuesIndex = 0; valuesIndex < valuesJsonList.GetLength(); ++valuesIndex)
    {
      m_values.push_back(valuesJsonList[valuesIndex].AsDouble());
    }
    m_valuesHasBeenSet = true;
  }

  return *this;
}

JsonValue ExperimentResultsData::Jsonize() const
{
  JsonValue payload;

  if(m_metricNameHasBeenSet)
  {
   payload.WithString("metricName", m_metricName);

  }

  if(m_resultStatHasBeenSet)
  {
   payload.WithString("resultStat", ExperimentResultResponseTypeMapper::GetNameForExperimentResultResponseType(m_resultStat));
  }

  if(m_treatmentNameHasBeenSet)
  {
   payload.WithString("treatmentName", m_treatmentName);

  }

  if(m_valuesHasBeenSet)
  {
   Aws::Utils::Array<JsonValue> valuesJsonList(m_values.size());
   for(unsigned valuesIndex = 0; valuesIndex < valuesJsonList.GetLength(); ++valuesIndex)
   {
     valuesJsonList[valuesIndex].AsDouble(m_values[valuesIndex]);
   }
   payload.WithArray("values", std::move(valuesJsonList));

  }

  return payload;
}

} // namespace Model
} // namespace CloudWatchEvidently
} // namespace Aws


text:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
    android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin"
    tools:context="com.example.rajanjassal.flickrbrowser.SearchActivity">

    <include android:id="@+id/app_bar"
        layout="@layout/toolbar" />

</RelativeLayout>

redpajama_set_name: RedPajamaGithub


text:
The **Grav Pages as Data** for [Grav](http://github.com/getgrav/grav) provides a very basic way for APIs to return data from grav as json xml or yml.

# Installation

Download and unpack a zip (or clone this repository) into the user/plugins directory of your project

# Usage

Try to load any page in Grav then add one of the following:
`?return-as=json`
`?return-as=xml`
`?return-as=yml`


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>Multiplication</title>
<meta name="date" content="2016-01-04">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

com.alejandrorm.util.matrix

Class Multiplication

java.lang.Object

com.alejandrorm.util.matrix.Multiplication

public class Multiplication
extends java.lang.Object

Implementation of different algorithms for matrix multiplication
 using the wrapper class: Matrix. Works with all classes
 derived from Number specified in the class Wrapper Matrix and
 NumberArithmetic,
 if Java adds new numeric type, only is needed to update the classes: Matrix and NumericArithmetic.

Author:

Alejandro Ramírez Muñoz [alejandror45@gmail.com]

Constructor Summary

Constructors

Constructor and Description

Multiplication()

Method Summary

All Methods Static Methods Concrete Methods

Modifier and Type
Method and Description

static boolean
checkMultiplicability(Matrix a,
                     Matrix b)

Tests if the matrixes can multiply.

static Matrix
multiply(Matrix a,
        Matrix b)

Complexity: O(n^3)

static Matrix
multiplyUsingStrassen(Matrix a,
                     Matrix b)

Complexity: O(n^2.8074)

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

Multiplication

public Multiplication()

Method Detail

multiply

public static Matrix multiply(Matrix a,
                              Matrix b)

Complexity: O(n^3)

Parameters:

a - Matrix a

b - Matrix b

Returns:

result of multiply A with B

Throws:

java.lang.IllegalArgumentException - if the type of data of the matrixes is not equal

java.lang.IllegalArgumentException - if the matrixes cannot multiply, checkMultiplicability() fails

checkMultiplicability

public static boolean checkMultiplicability(Matrix a,
                                            Matrix b)

Tests if the matrixes can multiply.

Parameters:

a - Matrix a

b - Matrix b

Returns:

true if a.getColumns() == b.getRows(), false otherwise

multiplyUsingStrassen

public static Matrix multiplyUsingStrassen(Matrix a,
                                           Matrix b)

Complexity: O(n^2.8074)

Parameters:

a - Matrix a

b - Matrix b

Returns:

result of multiply A with B

Throws:

java.lang.IllegalArgumentException - if the type of data of the matrixes is not equal

java.lang.IllegalArgumentException - if the matrixes cannot multiply, checkMultiplicability() fails

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
import {extname} from "path";

export default function css(file) {
	if (extname(file.path) !== ".css") return;
	file.setType("style");
}


text:
                                {{vm.date}} Camp Nou, Barcelona, Spain

                                {{vm.messageCount}} Trophies

                    <container title="Barcelona players" color="violet">
                        <people people="vm.people"></people>
                    </container>

                    <container title="News" color="green">
                        <news news="vm.news"></news>
                    </container>


text:
package main

import (
	"flag"
	"fmt"
	"log"
	"net/http"
	"os"

	"google.golang.org/grpc"
	"google.golang.org/grpc/codes"
	"google.golang.org/grpc/grpclog"
	"google.golang.org/grpc/metadata"

	"strings"

	library "github.com/improbable-eng/grpc-web/client/grpc-web-react-example/go/_proto/examplecom/library"
	"github.com/improbable-eng/grpc-web/go/grpcweb"
	"golang.org/x/net/context"
)

var (
	enableTls       = flag.Bool("enable_tls", false, "Use TLS - required for HTTP2.")
	tlsCertFilePath = flag.String("tls_cert_file", "../../misc/localhost.crt", "Path to the CRT/PEM file.")
	tlsKeyFilePath  = flag.String("tls_key_file", "../../misc/localhost.key", "Path to the private key file.")
)

func main() {
	flag.Parse()

	port := 9090
	if *enableTls {
		port = 9091
	}

	grpcServer := grpc.NewServer()
	library.RegisterBookServiceServer(grpcServer, &bookService{})
	grpclog.SetLogger(log.New(os.Stdout, "exampleserver: ", log.LstdFlags))

	wrappedServer := grpcweb.WrapServer(grpcServer)
	handler := func(resp http.ResponseWriter, req *http.Request) {
		wrappedServer.ServeHTTP(resp, req)
	}

	httpServer := http.Server{
		Addr:    fmt.Sprintf(":%d", port),
		Handler: http.HandlerFunc(handler),
	}

	grpclog.Printf("Starting server. http port: %d, with TLS: %v", port, *enableTls)

	if *enableTls {
		if err := httpServer.ListenAndServeTLS(*tlsCertFilePath, *tlsKeyFilePath); err != nil {
			grpclog.Fatalf("failed starting http2 server: %v", err)
		}
	} else {
		if err := httpServer.ListenAndServe(); err != nil {
			grpclog.Fatalf("failed starting http server: %v", err)
		}
	}
}

type bookService struct{}

var books = []*library.Book{
	{
		Isbn:   60929871,
		Title:  "Brave New World",
		Author: "Aldous Huxley",
	},
	{
		Isbn:   140009728,
		Title:  "Nineteen Eighty-Four",
		Author: "George Orwell",
	},
	{
		Isbn:   9780140301694,
		Title:  "Alice's Adventures in Wonderland",
		Author: "Lewis Carroll",
	},
	{
		Isbn:   140008381,
		Title:  "Animal Farm",
		Author: "George Orwell",
	},
}

func (s *bookService) GetBook(ctx context.Context, bookQuery *library.GetBookRequest) (*library.Book, error) {
	grpc.SendHeader(ctx, metadata.Pairs("Pre-Response-Metadata", "Is-sent-as-headers-unary"))
	grpc.SetTrailer(ctx, metadata.Pairs("Post-Response-Metadata", "Is-sent-as-trailers-unary"))

	for _, book := range books {
		if book.Isbn == bookQuery.Isbn {
			return book, nil
		}
	}

	return nil, grpc.Errorf(codes.NotFound, "Book could not be found")
}

func (s *bookService) QueryBooks(bookQuery *library.QueryBooksRequest, stream library.BookService_QueryBooksServer) error {
	stream.SendHeader(metadata.Pairs("Pre-Response-Metadata", "Is-sent-as-headers-stream"))
	for _, book := range books {
		if strings.HasPrefix(book.Author, bookQuery.AuthorPrefix) {
			stream.Send(book)
		}
	}
	stream.SetTrailer(metadata.Pairs("Post-Response-Metadata", "Is-sent-as-trailers-stream"))
	return nil
}


text:
@interface BPScrollViewController : UIViewController

@end


text:
function locCallClass() {
	//define the regular expressions used in the normalization
	this.lc = /([A-Z]{1,3})\s*(\d{1,4})(\.\d+)*(.+)*/ig;
	this.punctuation  = /[.,\/#!$%\^&\*;:{}=\-_`~()]/ig;
	this.lett_num_group = /([A-Z]{1,}\d{1,})/ig;
	this.num_letter_groupings = /(\d{1,})([A-Z]{1,})/ig;
	this.v_dot = /(v\s)(\d{1,})/ig;
	this.no_dot = /(no\s)(\d{1,})/ig;

	//define and cache the padding lengths (max pad length is 9)
	this.cache = ['', ' ', '  ', '   ', '    ', '     ', '      ', '       ', '        ', '         '];

	// alias the function name for returnNormLcCall
	this.normalize = this.returnNormLcCall;
}

// locCallClass.returnNormLcCall(call_number)
// returns a "normalized" call number
locCallClass.prototype.returnNormLcCall = function(callnumber_string) {
	// this is our eventual return value
	var local_norm = '',
		test = [];

	//~ TODO
	//~ get cataloging to fix issues with non-normalizing call numbers
	//~ so we don't have to use this hack.
	//~ Call numbers like this "KBG .A1" should normalize to "kbg   0 a2"
	try{
		const exception = /(KBG)(\s*\.)(.+)*/i;
		test = exception.exec(callnumber_string);
		if (test != null) {
			//debugger;
			var new_callnumber_string = "";
			if( typeof test[1] !== "undefined" ) new_callnumber_string += test[1] + "0";
			if( typeof test[2] !== "undefined" ) new_callnumber_string += test[2];
			if( typeof test[3] !== "undefined" ) new_callnumber_string += test[3];
			test = [];
			return this.returnNormLcCall(new_callnumber_string);
		}

	}
	catch (e){
		// console.log('undefined call number ' + e);
	}
	//~ /TODO

	try{
		test = this.lc.exec(callnumber_string.toLowerCase());
	}
	catch (e){
		console.log('undefined call number ' + e);
	}

	// if input is not LC, return lower case, trimmed input string,
	// with certain characters removed
	if (test === null){
		console.log("\"" + callnumber_string + "\"" + " not lc");
		return callnumber_string
			.toLowerCase()
			.trim()
			.replace(/\/{1,}|-{1,}/gi, " "); //replaces "/" and "-" with spaces
	}

	// TODO :
	// remove try block?
	try {
		if(typeof test[1] !== "undefined"){
			local_norm = test[1];
		}

		local_norm += this.leftPad(test[2],7-test[1].length);

		// append the decimal, if there is one
		if(typeof test[3] !== "undefined"){
			local_norm += test[3];
		}

		// remove any leading or trailing whitespace
		local_norm = local_norm.trim();

		// normalize the rest of the call number
		var call_number_remainder = "";
		if (typeof test[4] !== 'undefined'){
			// step 4. i. convert any punctuation to spaces
			// append letter+number groups with spaces
			// step 4. remove instances of multiple spaces, leaving only one
			// remove any trailing (or starting) whitespace
			call_number_remainder += test[4]
				.replace(this.punctuation, " ")	//repalce punctuation with spaces
				.replace(this.lett_num_group, "$1 ") //append spaces to letter+number groups
				.replace(this.num_letter_groupings, "$1 $2") //place space between numbers and letters occuring next to eachother
				.replace(/\s{2,}/g," "); //instances of 2 or more consecutive spaces are replaced by one

			// TODO :
			// consider removing the lastIndex for the following?

			// pad out numbers occuring after "v." and "no."
			// note: this calls the helper function for replace "vol_pad()"
			call_number_remainder = call_number_remainder.replace(this.v_dot, this.vol_pad.bind(this));
			this.v_dot.lastIndex = 0;

			call_number_remainder = call_number_remainder.replace(this.no_dot, this.vol_pad.bind(this));
			this.no_dot.lastIndex = 0;

			// reset the lastIndex so the next regex exec doesn't fail on next try
			this.punctuation.lastIndex = 0;

		}

		// add a single space to the front of the call_number_remainder
		call_number_remainder = call_number_remainder.trim();
		call_number_remainder = " " + call_number_remainder;

		//append the begining of the callnumber to the remainder of the call number
		local_norm += call_number_remainder;

		//trim spaces from the end, or the begining of the string
		local_norm = local_norm.trim();

	} //end try

	catch (e){
		console.log(' no test ');
	}

	// reset the lastIndex so the next regex exec doesn't fail on next try
	this.lc.lastIndex = 0;

	return local_norm;

} //end returnNormLcCall

// locCallClass.localeCompare(b,a)
// replicates functionality of the normal compare function
// so that it may be used in external sorting operations:
//
// A negative number if the reference string (a) occurs before the
// given string (b);
// positive if the reference string (a) occurs after
// the compare string (b);
// 0 if they are equivalent.
locCallClass.prototype.localeCompare = function (a, b) {
	try {
		var a_norm = this.returnNormLcCall(a),
			b_norm = this.returnNormLcCall(b);

			return ( a_norm < b_norm ? -1 : (a_norm > b_norm ? 1 : 0) );
	}
	catch (err) {
		// console.log("error")
	}
}

// locCallClass.sortCallNumbers()
// takes an array of call numbers and returns a sorted array of call
// numbers in their original format.
// Using something like the following works to sort as well:
// var loc = new locCallClass();
// var sorted_array = loc.unsorted_callnumber_array.sort(function(a,b) {return loc.localeCompare(a,b)});
locCallClass.prototype.sortCallNumbers = function (callnumbers) {
	// also bind the scope of this to the sort function to be able to call
	// this.localeCompare
	var sorted = callnumbers.sort(function (a,b) {
		return this.localeCompare(a,b);
	}.bind(this));

	return sorted;
}

// locCallClass.isBetween(a,b,c)
// returns true if a <= c <= b
locCallClass.prototype.isBetween = function (a,b,c) {
	//this.localeCompare(a, b) <= 0 if in sort order
	return ( (this.localeCompare(a,c) <= 0 && this.localeCompare(c,b) <=0) ? true : false );
}

// pad the string
locCallClass.prototype.leftPad = function (string, pad_length) {
	// make sure that we're treating the string like a string
	string = string + '';
	pad_length = pad_length - string.length;
	// nothing to pad
	if (pad_length <= 0) {
		return string;
	}

	return this.cache[pad_length] + string;
} // end leftPad

//helper function for volume padding
locCallClass.prototype.vol_pad = function (match, vol_string, num_string, offset, string) {
	// padding out number portion to 5 places
	return vol_string.trim() + this.leftPad(num_string, 5);
}


text:
class Quote {
public:
#if DEBUG_LEVEL == 2
  Quote() {
    std::cout << "Quote" << std::endl;
  }

  Quote(const std::string &book, double pri) : bookNo(book), price(pri) {
    std::cout << "Quote(const std::string &book, double pri)" << std::endl;
  }

  virtual ~Quote() {
    std::cout << "~Quote" << std::endl;
  }
  Quote(const Quote &rhs) : price(rhs.price), bookNo(rhs.bookNo) {
    std::cout << "Quote(const Quote &rhs)" << std::endl;
  }
  Quote(Quote &&rhs) : price(std::move(rhs.price)),
                       bookNo(std::move(rhs.bookNo)) {
    std::cout << "Quote(Quote &&rhs)" << std::endl;
  }
  Quote &operator=(const Quote &rhs) {
    std::cout << "operator=(const Quote &rhs)" << std::endl;
    price = rhs.price;
    bookNo = rhs.bookNo;
    return *this;
  }
  Quote &operator=(Quote &&rhs) {
    std::cout << "operator=(Quote &&rhs)" << std::endl;
    price = std::move(rhs.price);
    bookNo = std::move(rhs.bookNo);
    return *this;
  }
#else
  Quote() = default;
  Quote(const std::string &book, double pri) : bookNo(book), price(pri) { }

  virtual ~Quote() = default;
  Quote(const Quote &) = default;
  Quote(Quote &&) = default;
  Quote &operator=(const Quote &) = default;
  Quote &operator=(Quote &&) = default;
#endif

  std::string isbn() const { return bookNo; }
  virtual double net_price(std::size_t n) const { return n * price; }
  virtual Quote *clone() const & { return new Quote(*this); }
  virtual Quote *clone() && { return new Quote(std::move(*this)); }

#if DEBUG_LEVEL > 0
  virtual std::ostream &debug(std::ostream &os) const {
    os << "Quote::bookNo " << bookNo << " Quote::price " << price;
    return os;
  }
#endif

protected:
  double price = 0.0;

private:
  std::string bookNo;
};

class Disc_quote : public Quote {
public:
#if DEBUG_LEVEL == 2
  Disc_quote() {
    std::cout << "Disc_quote" << std::endl;
  }
  Disc_quote(const std::string &book, double pri,
             std::size_t qty, double disc)
      : Quote(book, pri), quantity(qty), discount(disc) {
    std::cout << "Disc_quote(const std::string &book, ... )" << std::endl;
  }

  ~Disc_quote() {
    std::cout << "~Disc_quote" << std::endl;
  }
  Disc_quote(const Disc_quote &rhs)
      : Quote(rhs), quantity(rhs.quantity), discount(rhs.discount) {
    std::cout << "Disc_quote(const Disc_quote &rhs)" << std::endl;
  }
  Disc_quote(Disc_quote &&rhs) : Quote(std::move(rhs)),
                                 quantity(std::move(rhs.quantity)),
                                 discount(std::move(rhs.discount)) {
    std::cout << "Disc_quote(Disc_quote &&rhs)" << std::endl;
  }
  Disc_quote &operator=(const Disc_quote &rhs) {
    Quote::operator=(rhs);
    std::cout << "operator=(const Disc_quote &rhs)" << std::endl;
    quantity = rhs.quantity;
    discount = rhs.discount;
    return *this;
  }
  Disc_quote &operator=(Disc_quote &&rhs) {
    Quote::operator=(std::move(rhs));
    std::cout << "operator=(Disc_quote &&rhs)" << std::endl;
    quantity = std::move(rhs.quantity);
    discount = std::move(rhs.discount);
    return *this;
  }
#else
  Disc_quote() = default;
  Disc_quote(const std::string &book, double pri,
             std::size_t qty, double disc)
      : Quote(book, pri), quantity(qty), discount(disc) { }

  virtual ~Disc_quote() = default;
  Disc_quote(const Disc_quote &) = default;
  Disc_quote(Disc_quote &&) = default;
  Disc_quote &operator=(const Disc_quote &) = default;
  Disc_quote &operator=(Disc_quote &&) = default;
#endif

  double net_price(std::size_t n) const = 0;

#if DEBUG_LEVEL > 0
  std::ostream &debug(std::ostream &os) const override {
    Quote::debug(os) << " Disc_quote::quantity " << quantity
        << " Disc_quote::discount " << discount;
    return os;
  }
#endif

protected:
  std::size_t quantity = 0;
  double discount = 0.0;
};

class Bulk_quote : public Disc_quote {
public:
  using Disc_quote::Disc_quote;

  double net_price(std::size_t n) const override {
    if (n >= quantity)
      return n * price * (1 - discount);
    else
      return n * price;
  }
  Bulk_quote *clone() const & override { return new Bulk_quote(*this); }
  Bulk_quote *clone() && override { return new Bulk_quote(std::move(*this)); }
};

class Limit_quote : public Disc_quote {
public:
  using Disc_quote::Disc_quote;

  double net_price(std::size_t n) const override {
    if (n <= quantity)
      return n * price * (1 - discount);
    else
      return (n - quantity) * price + quantity * price * (1 - discount);
  }
  Limit_quote *clone() const & override { return new Limit_quote(*this); }
  Limit_quote *clone() && override { return new Limit_quote(std::move(*this)); }
};

double print_total(std::ostream &os, const Quote &item, size_t n) {
  double ret = item.net_price(n);
  os << "ISBN: " << item.isbn() << " # sold: " << n << " total due: " << ret
     << std::endl;
  return ret;
}

class Basket {
public:
  void add_item(const std::shared_ptr<Quote> &sale) { items.insert(sale); }
  void add_item(const Quote &sale) {
    items.insert(std::shared_ptr<Quote>(sale.clone()));
  }
  void add_item(Quote &&sale) {
    items.insert(std::shared_ptr<Quote>(std::move(sale).clone()));
  }

  double total_receipt(std::ostream &) const;

private:
  static bool compare(const std::shared_ptr<Quote> &lhs,
                      const std::shared_ptr<Quote> &rhs) {
    return lhs->isbn() < rhs->isbn();
  }

  std::multiset<std::shared_ptr<Quote>, decltype(compare) *> items{compare};
};

double Basket::total_receipt(std::ostream &os) const {
  double sum = 0;
  for (auto it = items.cbegin(); it != items.cend();
       it = items.upper_bound(*it))
    sum += print_total(os, **it, items.count(*it));
  os << "Total sale: " << sum << std::endl;
  return sum;
}

void test_copy_control_members() {
  Quote basic0;
  basic0.debug(std::cout) << '\n' << std::endl;

  Quote basic1("abc", 5.5);
  basic1.debug(std::cout) << '\n' << std::endl;

  Quote basic2(basic1);
  basic2.debug(std::cout) << '\n' << std::endl;

  Quote basic3(std::move(basic2));
  basic3.debug(std::cout) << std::endl;
  basic2.debug(std::cout) << '\n' << std::endl;

  basic2 = basic3;
  basic2.debug(std::cout) << '\n' << std::endl;

  basic3 = std::move(basic1);
  basic3.debug(std::cout) << std::endl;
  basic1.debug(std::cout) << '\n' << std::endl;

  std::cout << "============================" << std::endl;

  Bulk_quote bulk0;
  bulk0.debug(std::cout) << '\n' << std::endl;

  Bulk_quote bulk1("abc", 5.5, 10, 0.2);
  bulk1.debug(std::cout) << '\n' << std::endl;

  Bulk_quote bulk2(bulk1);
  bulk2.debug(std::cout) << '\n' << std::endl;

  Bulk_quote bulk3(std::move(bulk2));
  bulk3.debug(std::cout) << std::endl;
  bulk2.debug(std::cout) << '\n' << std::endl;

  bulk2 = bulk3;
  bulk2.debug(std::cout) << '\n' << std::endl;

  bulk3 = std::move(bulk1);
  bulk3.debug(std::cout) << std::endl;
  bulk1.debug(std::cout) << '\n' << std::endl;

  std::cout << "============================" << std::endl;

  Limit_quote limit0;
  limit0.debug(std::cout) << '\n' << std::endl;

  Limit_quote limit1("abc", 5.5, 5, 0.1);
  limit1.debug(std::cout) << '\n' << std::endl;

  Limit_quote limit2(limit1);
  limit2.debug(std::cout) << '\n' << std::endl;

  Limit_quote limit3(std::move(limit2));
  limit3.debug(std::cout) << std::endl;
  limit2.debug(std::cout) << '\n' << std::endl;

  limit2 = limit3;
  limit2.debug(std::cout) << '\n' << std::endl;

  limit3 = std::move(limit1);
  limit3.debug(std::cout) << std::endl;
  limit1.debug(std::cout) << '\n' << std::endl;
}

int main() {
  //test_copy_control_members();

  std::vector<std::shared_ptr<Quote>> v;
  v.push_back(std::make_shared<Quote>("abc", 5.5));
  v.push_back(std::make_shared<Bulk_quote>("abc", 5.5, 10, 0.2));
  v.push_back(std::make_shared<Limit_quote>("abc", 5.5, 10, 0.2));

  for (const auto &q : v)
    print_total(std::cout, *q, 20);

  return 0;
}


text:
package zipkin2.internal;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.junit.jupiter.api.Test;
import zipkin2.DependencyLink;
import zipkin2.Endpoint;
import zipkin2.Span;
import zipkin2.Span.Kind;

import static java.util.Arrays.asList;
import static java.util.stream.Collectors.toList;
import static org.assertj.core.api.Assertions.assertThat;

public class DependencyLinkerTest {
  // in reverse order as reporting is more likely to occur this way
  static final List<Span> TRACE = asList(
    span("a", "b", "c", Kind.CLIENT, "app", "db", true),
    span("a", "a", "b", Kind.SERVER, "app", "web", false)
      .toBuilder().shared(true).build(),
    span("a", "a", "b", Kind.CLIENT, "web", "app", false),
    span("a", null, "a", Kind.SERVER, "web", null, false)
  );

  List<String> messages = new ArrayList<>();

  Logger logger = new Logger("", null) {
    {
      setLevel(Level.ALL);
    }

    @Override public void log(Level level, String msg) {
      assertThat(level).isEqualTo(Level.FINE);
      messages.add(msg);
    }
  };

  @Test void baseCase() {
    assertThat(new DependencyLinker().link()).isEmpty();
  }

  @Test void linksSpans() {
    assertThat(new DependencyLinker().putTrace(TRACE).link()).containsExactly(
      DependencyLink.newBuilder().parent("web").child("app").callCount(1L).build(),
      DependencyLink.newBuilder().parent("app").child("db").callCount(1L).errorCount(1L).build()
    );
  }

  /**
   * Trace id is not required to be a span id. For example, some instrumentation may create separate
   * trace ids to help with collisions, or to encode information about the origin. This test makes
   * sure we don't rely on the trace id = root span id convention.
   */
  @Test void traceIdIsOpaque() {
    List<DependencyLink> links = new DependencyLinker().putTrace(TRACE).link();

    List<Span> differentTraceId = TRACE.stream()
      .map(s -> s.toBuilder().traceId("123").build())
      .collect(toList());

    assertThat(new DependencyLinker().putTrace(differentTraceId).link())
      .containsExactlyElementsOf(links);
  }

  /**
   * Some don't propagate the server's parent ID which creates a race condition. Try to unwind it.
   *
   * <p>See https://github.com/openzipkin/zipkin/pull/1745
   */
  @Test void linksSpans_serverMissingParentId() {
    List<Span> trace = asList(
      span("a", null, "a", Kind.SERVER, "arn", null, false),
      span("a", "a", "b", Kind.CLIENT, "arn", "link", false),
      // below the parent ID is null as it wasn't propagated
      span("a", null, "b", Kind.SERVER, "link", "arn", false)
        .toBuilder().shared(true).build()
    );

    // trace is actually reported in reverse order
    Collections.reverse(trace);

    assertThat(new DependencyLinker().putTrace(trace).link()).containsExactly(
      DependencyLink.newBuilder().parent("arn").child("link").callCount(1L).build()
    );
  }

  /** In case of a late error, we should know which trace ID is being processed */
  @Test void logsTraceId() {
    new DependencyLinker(logger).putTrace(TRACE);

    assertThat(messages)
      .contains("building trace tree: traceId=000000000000000a");
  }

  /**
   * This test shows that if a parent ID is stored late (ex because it wasn't propagated), the span
   * can resolve once it is.
   */
  @Test void lateParentIdInSharedSpan() {
    List<Span> withLateParent = new ArrayList<>(TRACE);
    withLateParent.set(2, TRACE.get(2).toBuilder().parentId(null).build());

    assertThat(new DependencyLinker().putTrace(withLateParent).link()).containsExactly(
      DependencyLink.newBuilder().parent("web").child("app").callCount(1L).build(),
      DependencyLink.newBuilder().parent("app").child("db").callCount(1L).errorCount(1L).build()
    );
  }

  /**
   * This test shows that if a parent ID is stored late (ex because it wasn't propagated), the span
   * can resolve even if the client side is never sent
   */
  @Test void lostChildAndNoParentIdInSharedSpan() {
    List<Span> lostClientOrphan = new ArrayList<>(TRACE);
    lostClientOrphan.set(2, TRACE.get(2).toBuilder().parentId(null).build());
    lostClientOrphan.remove(1); // client span never sent

    assertThat(new DependencyLinker().putTrace(lostClientOrphan).link()).containsExactly(
      DependencyLink.newBuilder().parent("web").child("app").callCount(1L).build(),
      DependencyLink.newBuilder().parent("app").child("db").callCount(1L).errorCount(1L).build()
    );
  }

  @Test void messagingSpansDontLinkWithoutBroker_consumer() {
    List<Span> trace = asList(
      span("a", null, "a", Kind.PRODUCER, "producer", null, false),
      span("a", "a", "b", Kind.CONSUMER, "consumer", "kafka", false)
    );

    assertThat(new DependencyLinker().putTrace(trace).link()).containsOnly(
      DependencyLink.newBuilder().parent("kafka").child("consumer").callCount(1L).build()
    );
  }

  @Test void messagingSpansDontLinkWithoutBroker_producer() {
    List<Span> trace = asList(
      span("a", null, "a", Kind.PRODUCER, "producer", "kafka", false),
      span("a", "a", "b", Kind.CONSUMER, "consumer", null, false)
    );

    assertThat(new DependencyLinker().putTrace(trace).link()).containsOnly(
      DependencyLink.newBuilder().parent("producer").child("kafka").callCount(1L).build()
    );
  }

  @Test void messagingWithBroker_both_sides_same() {
    List<Span> trace = asList(
      span("a", null, "a", Kind.PRODUCER, "producer", "kafka", false),
      span("a", "a", "b", Kind.CONSUMER, "consumer", "kafka", false)
    );

    assertThat(new DependencyLinker().putTrace(trace).link()).containsOnly(
      DependencyLink.newBuilder().parent("producer").child("kafka").callCount(1L).build(),
      DependencyLink.newBuilder().parent("kafka").child("consumer").callCount(1L).build()
    );
  }

  @Test void messagingWithBroker_different() {
    List<Span> trace = asList(
      span("a", null, "a", Kind.PRODUCER, "producer", "kafka1", false),
      span("a", "a", "b", Kind.CONSUMER, "consumer", "kafka2", false)
    );

    assertThat(new DependencyLinker().putTrace(trace).link()).containsOnly(
      DependencyLink.newBuilder().parent("producer").child("kafka1").callCount(1L).build(),
      DependencyLink.newBuilder().parent("kafka2").child("consumer").callCount(1L).build()
    );
  }

  /** Shows we don't assume there's a direct link between producer and consumer. */
  @Test void messagingWithoutBroker_noLinks() {
    List<Span> trace = asList(
      span("a", null, "a", Kind.PRODUCER, "producer", null, false),
      span("a", "a", "b", Kind.CONSUMER, "consumer", null, false)
    );

    assertThat(new DependencyLinker().putTrace(trace).link())
      .isEmpty();
  }

  /** When a server is the child of a producer span, make a link as it is really an RPC */
  @Test void producerLinksToServer_childSpan() {
    List<Span> trace = asList(
      span("a", null, "a", Kind.PRODUCER, "producer", null, false),
      span("a", "a", "b", Kind.SERVER, "server", null, false)
    );

    assertThat(new DependencyLinker().putTrace(trace).link()).containsOnly(
      DependencyLink.newBuilder().parent("producer").child("server").callCount(1L).build()
    );
  }

  /**
   * Servers most often join a span vs create a child. Make sure this works when a producer is used
   * instead of a client.
   */
  @Test void producerLinksToServer_sameSpan() {
    List<Span> trace = asList(
      span("a", null, "a", Kind.PRODUCER, "producer", null, false),
      span("a", null, "a", Kind.SERVER, "server", null, false)
        .toBuilder().shared(true).build()
    );

    assertThat(new DependencyLinker().putTrace(trace).link()).containsOnly(
      DependencyLink.newBuilder().parent("producer").child("server").callCount(1L).build()
    );
  }

  /**
   * Client might be used for historical reasons instead of PRODUCER. Don't link as the server-side
   * is authoritative.
   */
  @Test void clientDoesntLinkToConsumer_child() {
    List<Span> trace = asList(
      span("a", null, "a", Kind.CLIENT, "client", null, false),
      span("a", "a", "b", Kind.CONSUMER, "consumer", null, false)
    );

    assertThat(new DependencyLinker().putTrace(trace).link())
      .isEmpty();
  }

  /**
   * A root span can be a client-originated trace or a server receipt which knows its peer. In these
   * cases, the peer is known and kind establishes the direction.
   */
  @Test void linksSpansDirectedByKind() {
    List<Span> validRootSpans = asList(
      span("a", null, "a", Kind.SERVER, "server", "client", false),
      span("a", null, "a", Kind.CLIENT, "client", "server", false)
        .toBuilder().shared(true).build()
    );

    for (Span span : validRootSpans) {
      assertThat(new DependencyLinker().putTrace(asList(span)).link()).containsOnly(
        DependencyLink.newBuilder().parent("client").child("server").callCount(1L).build()
      );
    }
  }

  @Test void callsAgainstTheSameLinkIncreasesCallCount_span() {
    List<Span> trace = asList(
      span("a", null, "a", Kind.SERVER, "client", null, false),
      span("a", "a", "b", Kind.CLIENT, null, "server", false),
      span("a", "a", "c", Kind.CLIENT, null, "server", false)
    );

    assertThat(new DependencyLinker().putTrace(trace).link()).containsOnly(
      DependencyLink.newBuilder().parent("client").child("server").callCount(2L).build()
    );
  }

  @Test void callsAgainstTheSameLinkIncreasesCallCount_trace() {
    List<Span> trace = asList(
      span("a", null, "a", Kind.SERVER, "client", null, false),
      span("a", "a", "b", Kind.CLIENT, null, "server", false)
    );

    assertThat(new DependencyLinker()
      .putTrace(trace)
      .putTrace(trace).link()).containsOnly(
      DependencyLink.newBuilder().parent("client").child("server").callCount(2L).build()
    );
  }

  /**
   * Spans don't always include both the client and server service. When you know the kind, you can
   * link these without duplicating call count.
   */
  @Test void singleHostSpansResultInASingleCallCount() {
    List<Span> trace = asList(
      span("a", null, "a", Kind.CLIENT, "client", null, false),
      span("a", "a", "b", Kind.SERVER, "server", null, false)
    );

    assertThat(new DependencyLinker().putTrace(trace).link()).containsOnly(
      DependencyLink.newBuilder().parent("client").child("server").callCount(1L).build()
    );
  }

  @Test void singleHostSpansResultInASingleErrorCount() {
    List<Span> trace = asList(
      span("a", null, "a", Kind.CLIENT, "client", null, true),
      span("a", "a", "b", Kind.SERVER, "server", null, true)
    );

    assertThat(new DependencyLinker().putTrace(trace).link()).containsOnly(
      DependencyLink.newBuilder()
        .parent("client")
        .child("server")
        .callCount(1L)
        .errorCount(1L)
        .build()
    );
  }

  @Test void singleHostSpansResultInASingleErrorCount_sameId() {
    List<Span> trace = asList(
      span("a", null, "a", Kind.CLIENT, "client", null, true),
      span("a", null, "a", Kind.SERVER, "server", null, true)
        .toBuilder().shared(true).build()
    );

    assertThat(new DependencyLinker().putTrace(trace).link()).containsOnly(
      DependencyLink.newBuilder()
        .parent("client")
        .child("server")
        .callCount(1L)
        .errorCount(1L)
        .build()
    );
  }

  @Test void singleHostSpansResultInASingleCallCount_defersNameToServer() {
    List<Span> trace = asList(
      span("a", null, "a", Kind.CLIENT, "client", "server", false),
      span("a", "a", "b", Kind.SERVER, "server", null, false)
    );

    assertThat(new DependencyLinker(logger).putTrace(trace).link()).containsOnly(
      DependencyLink.newBuilder().parent("client").child("server").callCount(1L).build()
    );
  }

  @Test void singleHostSpans_multipleChildren() {
    List<Span> trace = asList(
      span("a", null, "a", Kind.CLIENT, "client", null, false),
      span("a", "a", "b", Kind.SERVER, "server", "client", true),
      span("a", "a", "c", Kind.SERVER, "server", "client", false)
    );

    assertThat(new DependencyLinker().putTrace(trace).link()).containsOnly(
      DependencyLink.newBuilder()
        .parent("client")
        .child("server")
        .callCount(2L)
        .errorCount(1L)
        .build()
    );
  }

  @Test void singleHostSpans_multipleChildren_defersNameToServer() {
    List<Span> trace = asList(
      span("a", null, "a", Kind.CLIENT, "client", "server", false),
      span("a", "a", "b", Kind.SERVER, "server", null, false),
      span("a", "a", "c", Kind.SERVER, "server", null, false)
    );

    assertThat(new DependencyLinker(logger).putTrace(trace).link()).containsOnly(
      DependencyLink.newBuilder().parent("client").child("server").callCount(2L).build()
    );
  }

  /**
   * Spans are sometimes intermediated by an unknown type of span. Prefer the nearest server when
   * accounting for them.
   */
  @Test void intermediatedClientSpansMissingLocalServiceNameLinkToNearestServer() {
    List<Span> trace = asList(
      span("a", null, "a", Kind.SERVER, "client", null, false),
      span("a", "a", "b", null, null, null, false),
      // possibly a local fan-out span
      span("a", "b", "c", Kind.CLIENT, "server", null, false),
      span("a", "b", "d", Kind.CLIENT, "server", null, false)
    );

    assertThat(new DependencyLinker().putTrace(trace).link()).containsOnly(
      DependencyLink.newBuilder().parent("client").child("server").callCount(2L).build()
    );
  }

  @Test void errorsOnUninstrumentedLinks() {
    List<Span> trace = asList(
      span("a", null, "a", Kind.SERVER, "client", null, false),
      span("a", "a", "b", null, null, null, false),
      // there's no remote here, so we shouldn't see any error count
      span("a", "b", "c", Kind.CLIENT, "server", null, true),
      span("a", "b", "d", Kind.CLIENT, "server", null, true)
    );

    assertThat(new DependencyLinker().putTrace(trace).link()).containsOnly(
      DependencyLink.newBuilder().parent("client").child("server").callCount(2L).build()
    );
  }

  @Test void errorsOnInstrumentedLinks() {
    List<Span> trace = asList(
      span("a", null, "a", Kind.SERVER, "foo", null, false),
      span("a", "a", "b", null, null, null, false),
      span("a", "b", "c", Kind.CLIENT, "bar", "baz", true),
      span("a", "b", "d", Kind.CLIENT, "bar", "baz", false)
    );

    assertThat(new DependencyLinker().putTrace(trace).link()).containsOnly(
      DependencyLink.newBuilder().parent("foo").child("bar").callCount(2L).build(),
      DependencyLink.newBuilder().parent("bar").child("baz").callCount(2L).errorCount(1L).build()
    );
  }

  @Test void linkWithErrorIsLogged() {
    List<Span> trace = asList(
      span("a", "b", "c", Kind.CLIENT, "foo", "bar", true)
    );
    new DependencyLinker(logger).putTrace(trace).link();

    assertThat(messages).contains(
      "incrementing error link foo -> bar"
    );
  }

  /** Tag indicates a failed span, not an annotation */
  @Test void annotationNamedErrorDoesntIncrementErrorCount() {
    List<Span> trace = asList(
      span("a", "b", "c", Kind.CLIENT, "foo", "bar", false)
        .toBuilder().addAnnotation(1L, "error").build()
    );

    assertThat(new DependencyLinker().putTrace(trace).link()).containsOnly(
      DependencyLink.newBuilder().parent("foo").child("bar").callCount(1L).build()
    );
  }

  /** A loopback span is direction-agnostic, so can be linked properly regardless of kind. */
  @Test void linksLoopbackSpans() {
    List<Span> validRootSpans = asList(
      span("a", null, "a", Kind.SERVER, "service", "service", false),
      span("b", null, "b", Kind.CLIENT, "service", "service", false)
    );

    for (Span span : validRootSpans) {
      assertThat(new DependencyLinker().putTrace(asList(span)).link()).containsOnly(
        DependencyLink.newBuilder().parent("service").child("service").callCount(1L).build()
      );
    }
  }

  @Test void noSpanKindTreatedSameAsClient() {
    List<Span> trace = asList(
      span("a", null, "a", null, "some-client", "web", false),
      span("a", "a", "b", null, "web", "app", false),
      span("a", "b", "c", null, "app", "db", false)
    );

    assertThat(new DependencyLinker().putTrace(trace).link()).containsOnly(
      DependencyLink.newBuilder().parent("some-client").child("web").callCount(1L).build(),
      DependencyLink.newBuilder().parent("web").child("app").callCount(1L).build(),
      DependencyLink.newBuilder().parent("app").child("db").callCount(1L).build()
    );
  }

  @Test void noSpanKindWithError() {
    List<Span> trace = asList(
      span("a", null, "a", null, "some-client", "web", false),
      span("a", "a", "b", null, "web", "app", true),
      span("a", "b", "c", null, "app", "db", false)
    );

    assertThat(new DependencyLinker().putTrace(trace).link()).containsOnly(
      DependencyLink.newBuilder().parent("some-client").child("web").callCount(1L).build(),
      DependencyLink.newBuilder().parent("web").child("app").callCount(1L).errorCount(1L).build(),
      DependencyLink.newBuilder().parent("app").child("db").callCount(1L).build()
    );
  }

  /** A dependency link is between two services. We cannot link if we don't know both service names. */
  @Test void cannotLinkSingleSpanWithoutBothServiceNames() {
    List<Span> incompleteRootSpans = asList(
      span("a", null, "a", Kind.SERVER, null, null, false),
      span("a", null, "a", Kind.SERVER, "server", null, false),
      span("a", null, "a", Kind.SERVER, null, "client", false),
      span("a", null, "a", Kind.CLIENT, null, null, false),
      span("a", null, "a", Kind.CLIENT, "client", null, false),
      span("a", null, "a", Kind.CLIENT, null, "server", false)
    );

    for (Span span : incompleteRootSpans) {
      assertThat(new DependencyLinker(logger)
        .putTrace(asList(span)).link())
        .isEmpty();
    }
  }

  @Test void doesntLinkUnrelatedSpansWhenMissingRootSpan() {
    String missingParentId = "a";
    List<Span> trace = asList(
      span("a", missingParentId, "b", Kind.SERVER, "service1", null, false),
      span("a", missingParentId, "c", Kind.SERVER, "service2", null, false)
    );

    assertThat(new DependencyLinker(logger)
      .putTrace(trace).link())
      .isEmpty();
  }

  @Test void linksRelatedSpansWhenMissingRootSpan() {
    String missingParentId = "a";
    List<Span> trace = asList(
      span("a", missingParentId, "b", Kind.SERVER, "service1", null, false),
      span("a", "b", "c", Kind.SERVER, "service2", null, false)
    );

    assertThat(new DependencyLinker(logger).putTrace(trace).link()).containsOnly(
      DependencyLink.newBuilder().parent("service1").child("service2").callCount(1L).build()
    );
  }

  /** Client+Server spans that don't share IDs are treated as server spans missing their peer */
  @Test void linksSingleHostSpans() {
    List<Span> singleHostSpans = asList(
      span("a", null, "a", Kind.CLIENT, "web", null, false),
      span("a", "a", "b", Kind.SERVER, "app", null, false)
    );

    assertThat(new DependencyLinker().putTrace(singleHostSpans).link()).containsOnly(
      DependencyLink.newBuilder().parent("web").child("app").callCount(1L).build()
    );
  }

  @Test void linksSingleHostSpans_errorOnClient() {
    List<Span> trace = asList(
      span("a", null, "a", Kind.CLIENT, "web", null, true),
      span("a", "a", "b", Kind.SERVER, "app", null, false)
    );

    assertThat(new DependencyLinker().putTrace(trace).link()).containsOnly(
      DependencyLink.newBuilder().parent("web").child("app").callCount(1L).errorCount(1L).build()
    );
  }

  /** Creates a link when there's a span missing, in this case 2L which is an RPC from web to app */
  @Test void missingSpan() {
    List<Span> singleHostSpans = asList(
      span("a", null, "a", Kind.SERVER, "web", null, false),
      span("a", "a", "b", Kind.CLIENT, "app", null, false)
    );

    assertThat(new DependencyLinker(logger).putTrace(singleHostSpans).link())
      .containsOnly(DependencyLink.newBuilder().parent("web").child("app").callCount(1L).build());

    assertThat(messages).contains(
      "detected missing link to client span"
    );
  }

  @Test void merge() {
    List<DependencyLink> links = asList(
      DependencyLink.newBuilder().parent("foo").child("bar").callCount(2L).errorCount(1L).build(),
      DependencyLink.newBuilder().parent("foo").child("bar").callCount(2L).errorCount(2L).build(),
      DependencyLink.newBuilder().parent("foo").child("foo").callCount(1L).build()
    );

    assertThat(DependencyLinker.merge(links)).containsExactly(
      DependencyLink.newBuilder().parent("foo").child("bar").callCount(4L).errorCount(3L).build(),
      DependencyLink.newBuilder().parent("foo").child("foo").callCount(1L).build()
    );
  }

  @Test void merge_error() {
    List<DependencyLink> links = asList(
      DependencyLink.newBuilder().parent("client").child("server").callCount(2L).build(),
      DependencyLink.newBuilder().parent("client").child("server").callCount(2L).build(),
      DependencyLink.newBuilder().parent("client").child("client").callCount(1L).build()
    );

    assertThat(DependencyLinker.merge(links)).containsExactly(
      DependencyLink.newBuilder().parent("client").child("server").callCount(4L).build(),
      DependencyLink.newBuilder().parent("client").child("client").callCount(1L).build()
    );
  }

  static Span span(String traceId, @Nullable String parentId, String id, @Nullable Kind kind,
    @Nullable String local, @Nullable String remote, boolean isError) {
    Span.Builder result = Span.newBuilder().traceId(traceId).parentId(parentId).id(id).kind(kind);
    if (local != null) result.localEndpoint(Endpoint.newBuilder().serviceName(local).build());
    if (remote != null) result.remoteEndpoint(Endpoint.newBuilder().serviceName(remote).build());
    if (isError) result.putTag("error", "");
    return result.build();
  }
}


text:
import React, { PropTypes } from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import * as dietConsultationActions from '../../actions/dietConsultationActions';
import DietConsultationForm from './DietConsultationForm';
import Admin from '../common/Admin';
import { CompositeDecorator, EditorState, convertFromRaw, convertToRaw } from 'draft-js';

class ManageDietConsultationPage extends React.Component {
  constructor(props, context) {
    super(props, context);
    const decorator = new CompositeDecorator([
      {
        strategy: getEntityStrategy('MUTABLE'),
        component: TokenSpan,
      },
    ]);

    let blocks = convertFromRaw(blocks = { blocks: [{ text: '', type: 'unstyled', },], entityMap: { first: { type: 'TOKEN', mutability: 'MUTABLE', }, } });
    if (props.dietConsultation.description != "")
      blocks = convertFromRaw(JSON.parse(props.dietConsultation.description));

    this.state = {
      dietConsultation: Object.assign({}, props.dietConsultation),
      editorState: EditorState.createWithContent(
        blocks,
        decorator,
      ),
      errors: {},
      saving: false
    };
    this.updateDietConsultationState = this.updateDietConsultationState.bind(this);
    this.updateTitleState = this.updateTitleState.bind(this);
    this.updateCostState = this.updateCostState.bind(this);
    this.updateSessionTimeState = this.updateSessionTimeState.bind(this);
    this.updateShortState = this.updateShortState.bind(this);
    this.updateConsultationDescState = this.updateConsultationDescState.bind(this);
    this.saveDietConsultation = this.saveDietConsultation.bind(this);
    this.removeRow = this.removeRow.bind(this);
    this.addRow = this.addRow.bind(this);
    this.onChange = this.onChange.bind(this);
    this.focus = this.focus.bind(this);
    this.getTextFromEntity = this.getTextFromEntity.bind(this);
  }

  componentWillReceiveProps(nextProps) {
    if (this.props.dietConsultation.id != nextProps.dietConsultation.id) {
      this.setState({ dietConsultation: Object.assign({}, nextProps.dietConsultation) });
      const blocks = convertFromRaw(JSON.parse(nextProps.dietConsultation.description));
      const editorState = EditorState.push(this.state.editorState, blocks);
      this.setState({ editorState });
    }
  }

  onChange(editorState) {
    this.setState({ editorState });
  }

  focus() {
    this.refs.editor.focus();
  }

  getTextFromEntity(editorObj) {
    let descriptionBlocks = [];
    for (let prop in editorObj.blocks) {
      if (editorObj.blocks.hasOwnProperty(prop)) {
        descriptionBlocks.push(editorObj.blocks[prop].text)
      }
    }
    return descriptionBlocks.join("\\n ");
  }

  updateTitleState(event) {
    const field = event.target.name;
    let dietConsultation = this.state.dietConsultation;
    dietConsultation.consultationDetails[parseInt(field)].title = event.target.value;
    return this.setState({ dietConsultation });
  }

  updateCostState(event) {
    const field = event.target.name;
    let dietConsultation = this.state.dietConsultation;
    dietConsultation.consultationDetails[parseInt(field)].cost = event.target.value;
    return this.setState({ dietConsultation });
  }

  updateSessionTimeState(event) {
    const field = event.target.name;
    let dietConsultation = this.state.dietConsultation;
    dietConsultation.consultationDetails[parseInt(field)].session_time = event.target.value;
    return this.setState({ dietConsultation });
  }

  updateShortState(event) {
    const field = event.target.name;
    let dietConsultation = this.state.dietConsultation;
    dietConsultation.consultationDetails[parseInt(field)].consultation = event.target.value;
    return this.setState({ dietConsultation });
  }

  updateConsultationDescState(event) {
    const field = event.target.name;
    let dietConsultation = this.state.dietConsultation;
    dietConsultation.consultationDetails[parseInt(field)].consultation_desc = event.target.value;
    return this.setState({ dietConsultation });
  }

  updateDietConsultationState(event) {
    const field = event.target.name;
    let dietConsultation = this.state.dietConsultation;
    dietConsultation[field] = event.target.value;
    return this.setState({ dietConsultation });
  }

  saveDietConsultation(event) {
    event.preventDefault();
    let dietConsultation = this.state.dietConsultation;
    if (!dietConsultation.icon) {
      dietConsultation.icon = 'whitehop.png';
      dietConsultation.iconHeight = '3em';
      dietConsultation.iconWidth = '3em';
    }
    dietConsultation.description = JSON.stringify(convertToRaw(this.state.editorState.getCurrentContent()));
    this.setState({ dietConsultation });
    this.props.actions.saveDietConsultation(this.state.dietConsultation);
    this.context.router.push('/Ayurveda/DietConsultation');
  }

  addRow(e) {
    e.preventDefault();
    let dietConsultation = this.state.dietConsultation;
    dietConsultation.consultationDetails.push({
      id: '',
      type: 'diet',
      title: '',
      consultation: '',
      consultation_desc: '',
      session_time: '',
      cost: '',
      icon: 'whitehop.png',
      iconHeight: '3em',
      iconWidth: '3em',
    })
    this.setState({ dietConsultation });
  }

  removeRow(event) {
    const rowNumber = event.currentTarget.name;
    let dietConsultation = this.state.dietConsultation;
    dietConsultation.consultationDetails.splice(parseInt(rowNumber), 1)
    this.setState({ dietConsultation });
  }

  render() {
    const {authorized} = this.props;
    return (

                <Admin saveAction={this.saveDietConsultation} authorized={authorized} />

                <DietConsultationForm
                  updateTitleState={this.updateTitleState}
                  updateCostState={this.updateCostState}
                  updateSessionTimeState={this.updateSessionTimeState}
                  updateShortState={this.updateShortState}
                  updateConsultationDescState={this.updateConsultationDescState}
                  updateDietConsultationState={this.updateDietConsultationState}
                  removeRow={this.removeRow}
                  addRow={this.addRow}
                  dietConsultation={this.state.dietConsultation}
                  errors={this.state.errors}
                  saving={this.state.saving}
                  onChange={this.onChange}
                  editorState={this.state.editorState}
                  ref="editor"
                  focus={focus}
                />

    );
  }
}

ManageDietConsultationPage.propTypes = {
  dietConsultation: PropTypes.object.isRequired,
  actions: PropTypes.object.isRequired,
};

ManageDietConsultationPage.contextTypes = {
  router: PropTypes.object
};

function getEntityStrategy(mutability) {
  return function (contentBlock, callback, contentState) {
    contentBlock.findEntityRanges(
      (character) => {
        const entityKey = character.getEntity();
        if (entityKey === null) {
          return false;
        }
        return contentState.getEntity(entityKey).getMutability() === mutability;
      },
      callback
    );
  };
}

const TokenSpan = (props) => {
  return (

      {props.children}

  );
};

function mapStateToProps(state) {

  let dietConsultation = {
    id: '',
    type: '',
    header: '',
    short: '',
    description: '',
    venue: '',
    consultationDetails: [{
      id: '',
      type: '',
      title: '',
      consultation: '',
      consultation_desc: '',
      session_time: '',
      cost: '',
      icon: 'whitearomaoil.png',
      iconHeight: '3em',
      iconWidth: '1.8em',
    }]
  };

  if (state.dietConsultations.header) {
    dietConsultation = state.dietConsultations;
  }

  return {
    dietConsultation: dietConsultation,
    authorized: state.authToken
  };
}

function mapDispatchToProps(dispatch) {
  return {
    actions: bindActionCreators(dietConsultationActions, dispatch),
  };
}

export default connect(mapStateToProps, mapDispatchToProps)(ManageDietConsultationPage);


text:
using System;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Imgur.API.Authentication.Impl;
using Imgur.API.Endpoints.Impl;
using Imgur.API.Enums;
using Imgur.API.Tests.FakeResponses;
using Imgur.API.Tests.Fakes;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Imgur.API.Tests.Endpoints
{
    public partial class AccountEndpointTests
    {
        [TestMethod]
        public async Task DeleteCommentAsync_IsNotNull()
        {
            var fakeHttpMessageHandler = new FakeHttpMessageHandler();
            var fakeResponse = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(AccountEndpointResponses.DeleteCommentResponse)
            };

            fakeHttpMessageHandler.AddFakeResponse(new Uri("https://api.imgur.com/3/account/sarah/comment/yMgB7"),
                fakeResponse);

            var fakeOAuth2TokenHandler = new FakeOAuth2TokenHandler();
            var client = new ImgurClient("123", "1234", fakeOAuth2TokenHandler.GetOAuth2TokenCodeResponse());
            var endpoint = new AccountEndpoint(client, new HttpClient(fakeHttpMessageHandler));
            var deleted = await endpoint.DeleteCommentAsync("yMgB7", "sarah");

            Assert.IsTrue(deleted);
        }

        [ExpectedException(typeof (ArgumentNullException))]
        public async Task DeleteCommentAsync_WithDefaultUsernameAndOAuth2Null_ThrowsArgumentNullException()
        {
            var fakeOAuth2TokenHandler = new FakeOAuth2TokenHandler();
            var client = new ImgurClient("123", "1234", fakeOAuth2TokenHandler.GetOAuth2TokenCodeResponse());
            var endpoint = new AccountEndpoint(client);
            await endpoint.DeleteCommentAsync("yMgB7", null);
        }

        [TestMethod]
        [ExpectedException(typeof (ArgumentNullException))]
        public async Task DeleteCommentAsync_WithIdNull_ThrowsArgumentNullException()
        {
            var fakeOAuth2TokenHandler = new FakeOAuth2TokenHandler();
            var client = new ImgurClient("123", "1234", fakeOAuth2TokenHandler.GetOAuth2TokenCodeResponse());
            var endpoint = new AccountEndpoint(client);
            await endpoint.DeleteCommentAsync(null, null);
        }

        [TestMethod]
        [ExpectedException(typeof (ArgumentNullException))]
        public async Task DeleteCommentAsync_WithOAuth2TokenNull_ThrowsArgumentNullException()
        {
            var client = new ImgurClient("123", "1234");
            var endpoint = new AccountEndpoint(client);
            await endpoint.DeleteCommentAsync("yMgB7", "sarah");
        }

        [TestMethod]
        [ExpectedException(typeof (ArgumentNullException))]
        public async Task DeleteCommentAsync_WithUsernameNull_ThrowsArgumentNullException()
        {
            var fakeOAuth2TokenHandler = new FakeOAuth2TokenHandler();
            var client = new ImgurClient("123", "1234", fakeOAuth2TokenHandler.GetOAuth2TokenCodeResponse());
            var endpoint = new AccountEndpoint(client);
            await endpoint.DeleteCommentAsync("yMgB7", null);
        }

        [TestMethod]
        public async Task GetCommentAsync_IsNotNull()
        {
            var fakeHttpMessageHandler = new FakeHttpMessageHandler();
            var fakeResponse = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(AccountEndpointResponses.GetCommentResponse)
            };

            fakeHttpMessageHandler.AddFakeResponse(new Uri("https://api.imgur.com/3/account/sarah/comment/yMgB7"),
                fakeResponse);

            var client = new ImgurClient("123", "1234");
            var endpoint = new AccountEndpoint(client, new HttpClient(fakeHttpMessageHandler));
            var comment = await endpoint.GetCommentAsync("yMgB7", "sarah");

            Assert.IsNotNull(comment);
            Assert.AreEqual(487008510, comment.Id);
            Assert.AreEqual("DMcOm2V", comment.ImageId);
            Assert.AreEqual(
                "Gyroscope detectors measure inertia.. the stabilization is done entirely by brushless motors. There are stabilizers which actually use 1/2",
                comment.CommentText);
            Assert.AreEqual("Scabab", comment.Author);
            Assert.AreEqual(4194299, comment.AuthorId);
            Assert.AreEqual(false, comment.OnAlbum);
            Assert.AreEqual(null, comment.AlbumCover);
            Assert.AreEqual(24, comment.Ups);
            Assert.AreEqual(0, comment.Downs);
            Assert.AreEqual(24, comment.Points);
            Assert.AreEqual(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(1443969120), comment.DateTime);
            Assert.AreEqual(486983435, comment.ParentId);
            Assert.AreEqual(false, comment.Deleted);
            Assert.AreEqual(Vote.Down, comment.Vote);
            Assert.AreEqual(comment.Platform, "desktop");
        }

        [ExpectedException(typeof (ArgumentNullException))]
        public async Task GetCommentAsync_WithDefaultUsernameAndOAuth2Null_ThrowsArgumentNullException()
        {
            var client = new ImgurClient("123", "1234");
            var endpoint = new AccountEndpoint(client);
            await endpoint.GetCommentAsync("yMgB7", null);
        }

        [TestMethod]
        [ExpectedException(typeof (ArgumentNullException))]
        public async Task GetCommentAsync_WithIdNull_ThrowsArgumentNullException()
        {
            var client = new ImgurClient("123", "1234");
            var endpoint = new AccountEndpoint(client);
            await endpoint.GetCommentAsync(null, null);
        }

        [TestMethod]
        [ExpectedException(typeof (ArgumentNullException))]
        public async Task GetCommentAsync_WithUsernameNull_ThrowsArgumentNullException()
        {
            var client = new ImgurClient("123", "1234");
            var endpoint = new AccountEndpoint(client);
            await endpoint.GetCommentAsync("yMgB7", null);
        }

        [TestMethod]
        public async Task GetCommentCountAsync_IsNotNull()
        {
            var fakeHttpMessageHandler = new FakeHttpMessageHandler();
            var fakeResponse = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(AccountEndpointResponses.GetCommentCountResponse)
            };

            fakeHttpMessageHandler.AddFakeResponse(new Uri("https://api.imgur.com/3/account/sarah/comments/count"),
                fakeResponse);

            var client = new ImgurClient("123", "1234");
            var endpoint = new AccountEndpoint(client, new HttpClient(fakeHttpMessageHandler));
            var count = await endpoint.GetCommentCountAsync("sarah");

            Assert.AreEqual(count, 1500);
        }

        [ExpectedException(typeof (ArgumentNullException))]
        public async Task GetCommentCountAsync_WithDefaultUsernameAndOAuth2Null_ThrowsArgumentNullException()
        {
            var client = new ImgurClient("123", "1234");
            var endpoint = new AccountEndpoint(client);
            await endpoint.GetCommentCountAsync();
        }

        [TestMethod]
        [ExpectedException(typeof (ArgumentNullException))]
        public async Task GetCommentCountAsync_WithUsernameNull_ThrowsArgumentNullException()
        {
            var client = new ImgurClient("123", "1234");
            var endpoint = new AccountEndpoint(client);
            await endpoint.GetCommentCountAsync(null);
        }

        [TestMethod]
        public async Task GetCommentIdsAsync_AreEqual()
        {
            var fakeHttpMessageHandler = new FakeHttpMessageHandler();
            var fakeResponse = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(AccountEndpointResponses.GetCommentIdsResponse)
            };

            fakeHttpMessageHandler.AddFakeResponse(new Uri("https://api.imgur.com/3/account/bob/comments/ids/worst/2"),
                fakeResponse);

            var client = new ImgurClient("123", "1234");
            var endpoint = new AccountEndpoint(client, new HttpClient(fakeHttpMessageHandler));
            var comments = await endpoint.GetCommentIdsAsync("bob", CommentSortOrder.Worst, 2);

            Assert.AreEqual(50, comments.Count());
        }

        [TestMethod]
        [ExpectedException(typeof (ArgumentNullException))]
        public async Task GetCommentIdsAsync_WithDefaultUsernameAndOAuth2Null_ThrowsArgumentNullException()
        {
            var client = new ImgurClient("123", "1234");
            var endpoint = new AccountEndpoint(client);
            await endpoint.GetCommentIdsAsync();
        }

        [TestMethod]
        [ExpectedException(typeof (ArgumentNullException))]
        public async Task GetCommentIdsAsync_WithUsernameNull_ThrowsArgumentNullException()
        {
            var client = new ImgurClient("123", "1234");
            var endpoint = new AccountEndpoint(client);
            await endpoint.GetCommentIdsAsync(null);
        }

        [TestMethod]
        public async Task GetCommentsAsync_AreEqual()
        {
            var fakeHttpMessageHandler = new FakeHttpMessageHandler();
            var fakeResponse = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(AccountEndpointResponses.GetCommentsResponse)
            };

            fakeHttpMessageHandler.AddFakeResponse(new Uri("https://api.imgur.com/3/account/bob/comments/worst/2"),
                fakeResponse);

            var client = new ImgurClient("123", "1234");
            var endpoint = new AccountEndpoint(client, new HttpClient(fakeHttpMessageHandler));
            var comments = await endpoint.GetCommentsAsync("bob", CommentSortOrder.Worst, 2);

            Assert.AreEqual(50, comments.Count());
        }

        [TestMethod]
        [ExpectedException(typeof (ArgumentNullException))]
        public async Task GetCommentsAsync_WithDefaultUsernameAndOAuth2Null_ThrowsArgumentNullException()
        {
            var client = new ImgurClient("123", "1234");
            var endpoint = new AccountEndpoint(client);
            await endpoint.GetCommentsAsync();
        }

        [TestMethod]
        [ExpectedException(typeof (ArgumentNullException))]
        public async Task GetCommentsAsync_WithUsernameNull_ThrowsArgumentNullException()
        {
            var client = new ImgurClient("123", "1234");
            var endpoint = new AccountEndpoint(client);
            await endpoint.GetCommentsAsync(null);
        }
    }
}


text:
package com.wuyin.supermarket.view;

import android.content.Context;
import android.os.SystemClock;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.FrameLayout;

import com.wuyin.supermarket.R;
import com.wuyin.supermarket.manager.ThreadManager;
import com.wuyin.supermarket.utils.UIUtils;

/**
 * Created by wuyin on 2016/5/2
 * 创建了自定义的桢布局,把BaseFragment 一部分代码,抽取到本类中
 */
public abstract class LoadingPage extends FrameLayout {
    public LoadingPage(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public LoadingPage(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init();
    }

    public LoadingPage(Context context) {
        this(context, null);
    }

    /**
     * 四种界面
     */
    private View loadView;//加载中的界面
    private View errorView;//加载错误界面
    private View emptyView;//加载空界面
    private View successView;//加载成功的界面

    /**
     * 五种状态
     */
    public static final int STATE_UNKNOE = 0;
    public static final int STATE_LOADING = 1;
    public static final int STATE_ERROR = 2;
    public static final int STATE_EMPTY = 3;
    public static final int STATE_SUCCESS = 4;
    public int STATE = STATE_UNKNOE;

    private Button btnInit;

    /**
     * 添加四种不同的界面
     */
    private void init() {

        if (loadView == null) {
            loadView = createLoadingView();//创建加载中的界面
            this.addView(loadView,
                    new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
        }

        if (errorView == null) {
            errorView = createErrorView();//创建加载失败的界面
            this.addView(errorView,
                    new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
        }

        if (emptyView == null) {
            emptyView = createEmptyView();
            this.addView(emptyView,
                    new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
        }
    }

    /**
     * 根据不同的状态显示不同的界面
     * 1、加载中的界面
     * 2、错误界面
     * 3、数据为空的界面
     * 4、请求成功的界面
     */
    private void showPage() {

        if (loadView != null) {
            loadView.setVisibility(STATE == STATE_UNKNOE ||
                    STATE == STATE_LOADING ? View.VISIBLE : View.INVISIBLE);
        }
        if (errorView != null) {
            errorView.setVisibility(STATE == STATE_ERROR
                    ? View.VISIBLE : View.INVISIBLE);
        }
        if (emptyView != null) {
            emptyView.setVisibility(STATE == STATE_EMPTY
                    ? View.VISIBLE : View.INVISIBLE);
        }
        if (STATE == STATE_SUCCESS) {
            successView = createSuccessView();
            if (successView != null) {
                this.addView(successView,
                        new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
                // successView.setVisibility(View.VISIBLE);
            }
        } else {
            if (successView != null) {
                successView.setVisibility(View.INVISIBLE);
            }
        }

    }
//223.72.76.107

    /**
     * 根据服务器的数据切换状态
     */
    public void show() {

        if (STATE == STATE_ERROR || STATE == STATE_EMPTY) {
            STATE = STATE_LOADING;
        }

        ThreadManager.getInstance().createShortPool(3, 3, 5000)
                .execute(new Runnable() {
                    @Override
                    public void run() {
                        SystemClock.sleep(500);
                        final LoadResult result = load();
                        UIUtils.runOnUiThread(new Runnable() {
                            @Override
                            public void run() {
                                if (result != null) {
                                    STATE = result.getValue();
                                    showPage();  //状态改变,重新判断当前应该显示的是哪个界面
                                }
                            }
                        });
                    }
                });

        //请求服务器,获取服务器上的数据,进行判断
        showPage();

    }

    /**
     * 创建加载为空的界面
     *
     * @return
     */
    private View createEmptyView() {
        View view = View.inflate(UIUtils.getContext(), R.layout.empty_page, null);

        return view;
    }

    /**
     * 创建加载失败的view
     *
     * @return
     */
    private View createErrorView() {
        View view = View.inflate(UIUtils.getContext(), R.layout.error_page, null);
        btnInit = (Button) view.findViewById(R.id.page_bt);
        btnInit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                show();
            }
        });
        return view;
    }

    /**
     * 创建加载中的界面
     *
     * @return
     */
    private View createLoadingView() {
        View view = View.inflate(UIUtils.getContext(), R.layout.loading_page, null);

        return view;
    }

    public enum LoadResult {
        error(2), empty(3), success(4);
        int value;

        LoadResult(int value) {
            this.value = value;
        }

        public int getValue() {
            return value;
        }
    }

    /**
     * 请求服务器
     *
     * @return
     */
    public abstract LoadResult load();

    /**
     * 创建成功的界面
     *
     * @return
     */
    public abstract View createSuccessView();

}


text:
/// <autosync enabled="true" />
/// <reference path="../bower_components/jquery/dist/jquery.min.js" />
/// <reference path="../bower_components/bootstrap/dist/js/bootstrap.min.js" />
/// <reference path="../bower_components/angular/angular.min.js" />
/// <reference path="app.js" />
/// <reference path="controllers/EventController.js" />


text:
KaTeX-iOS
=========

A UIView that renders TeX expressions with KaTeX.

###Adding:

1. Copy UIKatexView.m and .h into your project.
2. Copy "katex" folder into your project directory (or wherever you want the library). Then drag the folder into XCode, making sure to set "Copy Folder References for Any Added Folders" and uncheck "Copy items into..." (f you've copied the folder)
3. See example project's ViewController.m for usage examples.

###Usage:

Initialize using [UIKatexView katexView:tex center:cgpoint]. TeX expressions can be either:
- Pure expression (no $ signs!)
- Mixture of expression and text (HTML). Wrap a math expression in $ signs.
* You can also set a custom delimiter in place of the $ sign, using katexView:center:delimiter:. Check the other constructors in UIKatexView.h for more details.

###Example text (NSStrings):

- I heard that $c = \\\\sqrt{a^2 - b^2}$ but I don't believe it.
- What is $n$ if $n \\\\cdot 4$ gives $8$?
- Remember that $\\\\displaystyle \\\\sum_{i=0}^n{i} = \\\\frac{(n)(n+1)}{2}$. Plugging in...
- \\\\displaystyle f(x) = \\\\int_{-\\\\infty}^\\\\infty \\\\hat f(\\\\xi)\\\\,e^{2 \\\\pi i \\\\xi x} \\\\,d\\\\xi

Remember that '\' character has to be escaped when used in an NSString.

####Credits:

KaTeX (http://khan.github.io/KaTeX/)

UIKatexView by Ian Arawjo.


text:
using System;
using System.Collections.Generic;

namespace Azure.ResourceManager.DataFactory.Models
{
    /// <summary> Azure blob write settings. </summary>
    public partial class AzureBlobStorageWriteSettings : StoreWriteSettings
    {
        /// <summary> Initializes a new instance of AzureBlobStorageWriteSettings. </summary>
        public AzureBlobStorageWriteSettings()
        {
            StoreWriteSettingsType = "AzureBlobStorageWriteSettings";
        }

        /// <summary> Initializes a new instance of AzureBlobStorageWriteSettings. </summary>
        /// <param name="storeWriteSettingsType"> The write setting type. </param>
        /// <param name="maxConcurrentConnections"> The maximum concurrent connection count for the source data store. Type: integer (or Expression with resultType integer). </param>
        /// <param name="disableMetricsCollection"> If true, disable data store metrics collection. Default is false. Type: boolean (or Expression with resultType boolean). </param>
        /// <param name="copyBehavior"> The type of copy behavior for copy sink. </param>
        /// <param name="additionalProperties"> Additional Properties. </param>
        /// <param name="blockSizeInMB"> Indicates the block size(MB) when writing data to blob. Type: integer (or Expression with resultType integer). </param>
        internal AzureBlobStorageWriteSettings(string storeWriteSettingsType, BinaryData maxConcurrentConnections, BinaryData disableMetricsCollection, BinaryData copyBehavior, IDictionary<string, BinaryData> additionalProperties, BinaryData blockSizeInMB) : base(storeWriteSettingsType, maxConcurrentConnections, disableMetricsCollection, copyBehavior, additionalProperties)
        {
            BlockSizeInMB = blockSizeInMB;
            StoreWriteSettingsType = storeWriteSettingsType ?? "AzureBlobStorageWriteSettings";
        }

        /// <summary>
        /// Indicates the block size(MB) when writing data to blob. Type: integer (or Expression with resultType integer).
        /// <para>
        /// To assign an object to this property use <see cref="BinaryData.FromObjectAsJson{T}(T, System.Text.Json.JsonSerializerOptions?)"/>.
        /// </para>
        /// <para>
        /// To assign an already formated json string to this property use <see cref="BinaryData.FromString(string)"/>.
        /// </para>
        /// <para>
        /// Examples:
        /// <list type="bullet">
        /// <item>
        /// <term>BinaryData.FromObjectAsJson("foo")</term>
        /// <description>Creates a payload of "foo".</description>
        /// </item>
        /// <item>
        /// <term>BinaryData.FromString("\"foo\"")</term>
        /// <description>Creates a payload of "foo".</description>
        /// </item>
        /// <item>
        /// <term>BinaryData.FromObjectAsJson(new { key = "value" })</term>
        /// <description>Creates a payload of { "key": "value" }.</description>
        /// </item>
        /// <item>
        /// <term>BinaryData.FromString("{\"key\": \"value\"}")</term>
        /// <description>Creates a payload of { "key": "value" }.</description>
        /// </item>
        /// </list>
        /// </para>
        /// </summary>
        public BinaryData BlockSizeInMB { get; set; }
    }
}