text:
/* This file is auto-generated. Do not edit it! */

package kivikmock

import (
	"context"
	"fmt"
	"reflect"
	"time"

	"github.com/go-kivik/kivik/v3/driver"
)

var _ = &driver.Attachment{}
var _ = reflect.Int

// ExpectedAllDBs represents an expectation for a call to AllDBs().
type ExpectedAllDBs struct {
	commonExpectation
	callback func(ctx context.Context, options map[string]interface{}) ([]string, error)
	ret0     []string
}

// WithOptions sets the expected options for the call to AllDBs().
func (e *ExpectedAllDBs) WithOptions(options map[string]interface{}) *ExpectedAllDBs {
	e.options = options
	return e
}

// WillExecute sets a callback function to be called with any inputs to the
// original function. Any values returned by the callback will be returned as
// if generated by the driver.
func (e *ExpectedAllDBs) WillExecute(cb func(ctx context.Context, options map[string]interface{}) ([]string, error)) *ExpectedAllDBs {
	e.callback = cb
	return e
}

// WillReturn sets the values that will be returned by the call to AllDBs().
func (e *ExpectedAllDBs) WillReturn(ret0 []string) *ExpectedAllDBs {
	e.ret0 = ret0
	return e
}

// WillReturnError sets the error value that will be returned by the call to AllDBs().
func (e *ExpectedAllDBs) WillReturnError(err error) *ExpectedAllDBs {
	e.err = err
	return e
}

// WillDelay causes the call to AllDBs() to delay.
func (e *ExpectedAllDBs) WillDelay(delay time.Duration) *ExpectedAllDBs {
	e.delay = delay
	return e
}

func (e *ExpectedAllDBs) met(_ expectation) bool {
	return true
}

func (e *ExpectedAllDBs) method(v bool) string {
	if !v {
		return "AllDBs()"
	}
	options := defaultOptionPlaceholder
	if e.options != nil {
		options = fmt.Sprintf("%v", e.options)
	}
	return fmt.Sprintf("AllDBs(ctx, %s)", options)
}

// ExpectedClose represents an expectation for a call to Close().
type ExpectedClose struct {
	commonExpectation
	callback func(ctx context.Context) error
}

// WillExecute sets a callback function to be called with any inputs to the
// original function. Any values returned by the callback will be returned as
// if generated by the driver.
func (e *ExpectedClose) WillExecute(cb func(ctx context.Context) error) *ExpectedClose {
	e.callback = cb
	return e
}

// WillReturnError sets the error value that will be returned by the call to Close().
func (e *ExpectedClose) WillReturnError(err error) *ExpectedClose {
	e.err = err
	return e
}

// WillDelay causes the call to Close() to delay.
func (e *ExpectedClose) WillDelay(delay time.Duration) *ExpectedClose {
	e.delay = delay
	return e
}

func (e *ExpectedClose) met(_ expectation) bool {
	return true
}

func (e *ExpectedClose) method(v bool) string {
	if !v {
		return "Close()"
	}
	return fmt.Sprintf("Close(ctx)")
}

// ExpectedClusterSetup represents an expectation for a call to ClusterSetup().
type ExpectedClusterSetup struct {
	commonExpectation
	callback func(ctx context.Context, arg0 interface{}) error
	arg0     interface{}
}

// WillExecute sets a callback function to be called with any inputs to the
// original function. Any values returned by the callback will be returned as
// if generated by the driver.
func (e *ExpectedClusterSetup) WillExecute(cb func(ctx context.Context, arg0 interface{}) error) *ExpectedClusterSetup {
	e.callback = cb
	return e
}

// WillReturnError sets the error value that will be returned by the call to ClusterSetup().
func (e *ExpectedClusterSetup) WillReturnError(err error) *ExpectedClusterSetup {
	e.err = err
	return e
}

// WillDelay causes the call to ClusterSetup() to delay.
func (e *ExpectedClusterSetup) WillDelay(delay time.Duration) *ExpectedClusterSetup {
	e.delay = delay
	return e
}

func (e *ExpectedClusterSetup) met(ex expectation) bool {
	exp := ex.(*ExpectedClusterSetup)
	if exp.arg0 != nil && !jsonMeets(exp.arg0, e.arg0) {
		return false
	}
	return true
}

func (e *ExpectedClusterSetup) method(v bool) string {
	if !v {
		return "ClusterSetup()"
	}
	arg0 := "?"
	if e.arg0 != nil {
		arg0 = fmt.Sprintf("%v", e.arg0)
	}
	return fmt.Sprintf("ClusterSetup(ctx, %s)", arg0)
}

// ExpectedClusterStatus represents an expectation for a call to ClusterStatus().
type ExpectedClusterStatus struct {
	commonExpectation
	callback func(ctx context.Context, options map[string]interface{}) (string, error)
	ret0     string
}

// WithOptions sets the expected options for the call to ClusterStatus().
func (e *ExpectedClusterStatus) WithOptions(options map[string]interface{}) *ExpectedClusterStatus {
	e.options = options
	return e
}

// WillExecute sets a callback function to be called with any inputs to the
// original function. Any values returned by the callback will be returned as
// if generated by the driver.
func (e *ExpectedClusterStatus) WillExecute(cb func(ctx context.Context, options map[string]interface{}) (string, error)) *ExpectedClusterStatus {
	e.callback = cb
	return e
}

// WillReturn sets the values that will be returned by the call to ClusterStatus().
func (e *ExpectedClusterStatus) WillReturn(ret0 string) *ExpectedClusterStatus {
	e.ret0 = ret0
	return e
}

// WillReturnError sets the error value that will be returned by the call to ClusterStatus().
func (e *ExpectedClusterStatus) WillReturnError(err error) *ExpectedClusterStatus {
	e.err = err
	return e
}

// WillDelay causes the call to ClusterStatus() to delay.
func (e *ExpectedClusterStatus) WillDelay(delay time.Duration) *ExpectedClusterStatus {
	e.delay = delay
	return e
}

func (e *ExpectedClusterStatus) met(_ expectation) bool {
	return true
}

func (e *ExpectedClusterStatus) method(v bool) string {
	if !v {
		return "ClusterStatus()"
	}
	options := defaultOptionPlaceholder
	if e.options != nil {
		options = fmt.Sprintf("%v", e.options)
	}
	return fmt.Sprintf("ClusterStatus(ctx, %s)", options)
}

// ExpectedConfigValue represents an expectation for a call to ConfigValue().
type ExpectedConfigValue struct {
	commonExpectation
	callback func(ctx context.Context, arg0 string, arg1 string, arg2 string) (string, error)
	arg0     string
	arg1     string
	arg2     string
	ret0     string
}

// WillExecute sets a callback function to be called with any inputs to the
// original function. Any values returned by the callback will be returned as
// if generated by the driver.
func (e *ExpectedConfigValue) WillExecute(cb func(ctx context.Context, arg0 string, arg1 string, arg2 string) (string, error)) *ExpectedConfigValue {
	e.callback = cb
	return e
}

// WillReturn sets the values that will be returned by the call to ConfigValue().
func (e *ExpectedConfigValue) WillReturn(ret0 string) *ExpectedConfigValue {
	e.ret0 = ret0
	return e
}

// WillReturnError sets the error value that will be returned by the call to ConfigValue().
func (e *ExpectedConfigValue) WillReturnError(err error) *ExpectedConfigValue {
	e.err = err
	return e
}

// WillDelay causes the call to ConfigValue() to delay.
func (e *ExpectedConfigValue) WillDelay(delay time.Duration) *ExpectedConfigValue {
	e.delay = delay
	return e
}

func (e *ExpectedConfigValue) met(ex expectation) bool {
	exp := ex.(*ExpectedConfigValue)
	if exp.arg0 != "" && exp.arg0 != e.arg0 {
		return false
	}
	if exp.arg1 != "" && exp.arg1 != e.arg1 {
		return false
	}
	if exp.arg2 != "" && exp.arg2 != e.arg2 {
		return false
	}
	return true
}

func (e *ExpectedConfigValue) method(v bool) string {
	if !v {
		return "ConfigValue()"
	}
	arg0, arg1, arg2 := "?", "?", "?"
	if e.arg0 != "" {
		arg0 = fmt.Sprintf("%q", e.arg0)
	}
	if e.arg1 != "" {
		arg1 = fmt.Sprintf("%q", e.arg1)
	}
	if e.arg2 != "" {
		arg2 = fmt.Sprintf("%q", e.arg2)
	}
	return fmt.Sprintf("ConfigValue(ctx, %s, %s, %s)", arg0, arg1, arg2)
}

// ExpectedDBExists represents an expectation for a call to DBExists().
type ExpectedDBExists struct {
	commonExpectation
	callback func(ctx context.Context, arg0 string, options map[string]interface{}) (bool, error)
	arg0     string
	ret0     bool
}

// WithOptions sets the expected options for the call to DBExists().
func (e *ExpectedDBExists) WithOptions(options map[string]interface{}) *ExpectedDBExists {
	e.options = options
	return e
}

// WillExecute sets a callback function to be called with any inputs to the
// original function. Any values returned by the callback will be returned as
// if generated by the driver.
func (e *ExpectedDBExists) WillExecute(cb func(ctx context.Context, arg0 string, options map[string]interface{}) (bool, error)) *ExpectedDBExists {
	e.callback = cb
	return e
}

// WillReturn sets the values that will be returned by the call to DBExists().
func (e *ExpectedDBExists) WillReturn(ret0 bool) *ExpectedDBExists {
	e.ret0 = ret0
	return e
}

// WillReturnError sets the error value that will be returned by the call to DBExists().
func (e *ExpectedDBExists) WillReturnError(err error) *ExpectedDBExists {
	e.err = err
	return e
}

// WillDelay causes the call to DBExists() to delay.
func (e *ExpectedDBExists) WillDelay(delay time.Duration) *ExpectedDBExists {
	e.delay = delay
	return e
}

func (e *ExpectedDBExists) met(ex expectation) bool {
	exp := ex.(*ExpectedDBExists)
	if exp.arg0 != "" && exp.arg0 != e.arg0 {
		return false
	}
	return true
}

func (e *ExpectedDBExists) method(v bool) string {
	if !v {
		return "DBExists()"
	}
	arg0, options := "?", defaultOptionPlaceholder
	if e.arg0 != "" {
		arg0 = fmt.Sprintf("%q", e.arg0)
	}
	if e.options != nil {
		options = fmt.Sprintf("%v", e.options)
	}
	return fmt.Sprintf("DBExists(ctx, %s, %s)", arg0, options)
}

// ExpectedDeleteConfigKey represents an expectation for a call to DeleteConfigKey().
type ExpectedDeleteConfigKey struct {
	commonExpectation
	callback func(ctx context.Context, arg0 string, arg1 string, arg2 string) (string, error)
	arg0     string
	arg1     string
	arg2     string
	ret0     string
}

// WillExecute sets a callback function to be called with any inputs to the
// original function. Any values returned by the callback will be returned as
// if generated by the driver.
func (e *ExpectedDeleteConfigKey) WillExecute(cb func(ctx context.Context, arg0 string, arg1 string, arg2 string) (string, error)) *ExpectedDeleteConfigKey {
	e.callback = cb
	return e
}

// WillReturn sets the values that will be returned by the call to DeleteConfigKey().
func (e *ExpectedDeleteConfigKey) WillReturn(ret0 string) *ExpectedDeleteConfigKey {
	e.ret0 = ret0
	return e
}

// WillReturnError sets the error value that will be returned by the call to DeleteConfigKey().
func (e *ExpectedDeleteConfigKey) WillReturnError(err error) *ExpectedDeleteConfigKey {
	e.err = err
	return e
}

// WillDelay causes the call to DeleteConfigKey() to delay.
func (e *ExpectedDeleteConfigKey) WillDelay(delay time.Duration) *ExpectedDeleteConfigKey {
	e.delay = delay
	return e
}

func (e *ExpectedDeleteConfigKey) met(ex expectation) bool {
	exp := ex.(*ExpectedDeleteConfigKey)
	if exp.arg0 != "" && exp.arg0 != e.arg0 {
		return false
	}
	if exp.arg1 != "" && exp.arg1 != e.arg1 {
		return false
	}
	if exp.arg2 != "" && exp.arg2 != e.arg2 {
		return false
	}
	return true
}

func (e *ExpectedDeleteConfigKey) method(v bool) string {
	if !v {
		return "DeleteConfigKey()"
	}
	arg0, arg1, arg2 := "?", "?", "?"
	if e.arg0 != "" {
		arg0 = fmt.Sprintf("%q", e.arg0)
	}
	if e.arg1 != "" {
		arg1 = fmt.Sprintf("%q", e.arg1)
	}
	if e.arg2 != "" {
		arg2 = fmt.Sprintf("%q", e.arg2)
	}
	return fmt.Sprintf("DeleteConfigKey(ctx, %s, %s, %s)", arg0, arg1, arg2)
}

// ExpectedDestroyDB represents an expectation for a call to DestroyDB().
type ExpectedDestroyDB struct {
	commonExpectation
	callback func(ctx context.Context, arg0 string, options map[string]interface{}) error
	arg0     string
}

// WithOptions sets the expected options for the call to DestroyDB().
func (e *ExpectedDestroyDB) WithOptions(options map[string]interface{}) *ExpectedDestroyDB {
	e.options = options
	return e
}

// WillExecute sets a callback function to be called with any inputs to the
// original function. Any values returned by the callback will be returned as
// if generated by the driver.
func (e *ExpectedDestroyDB) WillExecute(cb func(ctx context.Context, arg0 string, options map[string]interface{}) error) *ExpectedDestroyDB {
	e.callback = cb
	return e
}

// WillReturnError sets the error value that will be returned by the call to DestroyDB().
func (e *ExpectedDestroyDB) WillReturnError(err error) *ExpectedDestroyDB {
	e.err = err
	return e
}

// WillDelay causes the call to DestroyDB() to delay.
func (e *ExpectedDestroyDB) WillDelay(delay time.Duration) *ExpectedDestroyDB {
	e.delay = delay
	return e
}

func (e *ExpectedDestroyDB) met(ex expectation) bool {
	exp := ex.(*ExpectedDestroyDB)
	if exp.arg0 != "" && exp.arg0 != e.arg0 {
		return false
	}
	return true
}

func (e *ExpectedDestroyDB) method(v bool) string {
	if !v {
		return "DestroyDB()"
	}
	arg0, options := "?", defaultOptionPlaceholder
	if e.arg0 != "" {
		arg0 = fmt.Sprintf("%q", e.arg0)
	}
	if e.options != nil {
		options = fmt.Sprintf("%v", e.options)
	}
	return fmt.Sprintf("DestroyDB(ctx, %s, %s)", arg0, options)
}

// ExpectedPing represents an expectation for a call to Ping().
type ExpectedPing struct {
	commonExpectation
	callback func(ctx context.Context) (bool, error)
	ret0     bool
}

// WillExecute sets a callback function to be called with any inputs to the
// original function. Any values returned by the callback will be returned as
// if generated by the driver.
func (e *ExpectedPing) WillExecute(cb func(ctx context.Context) (bool, error)) *ExpectedPing {
	e.callback = cb
	return e
}

// WillReturn sets the values that will be returned by the call to Ping().
func (e *ExpectedPing) WillReturn(ret0 bool) *ExpectedPing {
	e.ret0 = ret0
	return e
}

// WillReturnError sets the error value that will be returned by the call to Ping().
func (e *ExpectedPing) WillReturnError(err error) *ExpectedPing {
	e.err = err
	return e
}

// WillDelay causes the call to Ping() to delay.
func (e *ExpectedPing) WillDelay(delay time.Duration) *ExpectedPing {
	e.delay = delay
	return e
}

func (e *ExpectedPing) met(_ expectation) bool {
	return true
}

func (e *ExpectedPing) method(v bool) string {
	if !v {
		return "Ping()"
	}
	return fmt.Sprintf("Ping(ctx)")
}

// ExpectedSetConfigValue represents an expectation for a call to SetConfigValue().
type ExpectedSetConfigValue struct {
	commonExpectation
	callback func(ctx context.Context, arg0 string, arg1 string, arg2 string, arg3 string) (string, error)
	arg0     string
	arg1     string
	arg2     string
	arg3     string
	ret0     string
}

// WillExecute sets a callback function to be called with any inputs to the
// original function. Any values returned by the callback will be returned as
// if generated by the driver.
func (e *ExpectedSetConfigValue) WillExecute(cb func(ctx context.Context, arg0 string, arg1 string, arg2 string, arg3 string) (string, error)) *ExpectedSetConfigValue {
	e.callback = cb
	return e
}

// WillReturn sets the values that will be returned by the call to SetConfigValue().
func (e *ExpectedSetConfigValue) WillReturn(ret0 string) *ExpectedSetConfigValue {
	e.ret0 = ret0
	return e
}

// WillReturnError sets the error value that will be returned by the call to SetConfigValue().
func (e *ExpectedSetConfigValue) WillReturnError(err error) *ExpectedSetConfigValue {
	e.err = err
	return e
}

// WillDelay causes the call to SetConfigValue() to delay.
func (e *ExpectedSetConfigValue) WillDelay(delay time.Duration) *ExpectedSetConfigValue {
	e.delay = delay
	return e
}

func (e *ExpectedSetConfigValue) met(ex expectation) bool {
	exp := ex.(*ExpectedSetConfigValue)
	if exp.arg0 != "" && exp.arg0 != e.arg0 {
		return false
	}
	if exp.arg1 != "" && exp.arg1 != e.arg1 {
		return false
	}
	if exp.arg2 != "" && exp.arg2 != e.arg2 {
		return false
	}
	if exp.arg3 != "" && exp.arg3 != e.arg3 {
		return false
	}
	return true
}

func (e *ExpectedSetConfigValue) method(v bool) string {
	if !v {
		return "SetConfigValue()"
	}
	arg0, arg1, arg2, arg3 := "?", "?", "?", "?"
	if e.arg0 != "" {
		arg0 = fmt.Sprintf("%q", e.arg0)
	}
	if e.arg1 != "" {
		arg1 = fmt.Sprintf("%q", e.arg1)
	}
	if e.arg2 != "" {
		arg2 = fmt.Sprintf("%q", e.arg2)
	}
	if e.arg3 != "" {
		arg3 = fmt.Sprintf("%q", e.arg3)
	}
	return fmt.Sprintf("SetConfigValue(ctx, %s, %s, %s, %s)", arg0, arg1, arg2, arg3)
}

// ExpectedConfig represents an expectation for a call to Config().
type ExpectedConfig struct {
	commonExpectation
	callback func(ctx context.Context, arg0 string) (driver.Config, error)
	arg0     string
	ret0     driver.Config
}

// WillExecute sets a callback function to be called with any inputs to the
// original function. Any values returned by the callback will be returned as
// if generated by the driver.
func (e *ExpectedConfig) WillExecute(cb func(ctx context.Context, arg0 string) (driver.Config, error)) *ExpectedConfig {
	e.callback = cb
	return e
}

// WillReturn sets the values that will be returned by the call to Config().
func (e *ExpectedConfig) WillReturn(ret0 driver.Config) *ExpectedConfig {
	e.ret0 = ret0
	return e
}

// WillReturnError sets the error value that will be returned by the call to Config().
func (e *ExpectedConfig) WillReturnError(err error) *ExpectedConfig {
	e.err = err
	return e
}

// WillDelay causes the call to Config() to delay.
func (e *ExpectedConfig) WillDelay(delay time.Duration) *ExpectedConfig {
	e.delay = delay
	return e
}

func (e *ExpectedConfig) met(ex expectation) bool {
	exp := ex.(*ExpectedConfig)
	if exp.arg0 != "" && exp.arg0 != e.arg0 {
		return false
	}
	return true
}

func (e *ExpectedConfig) method(v bool) string {
	if !v {
		return "Config()"
	}
	arg0 := "?"
	if e.arg0 != "" {
		arg0 = fmt.Sprintf("%q", e.arg0)
	}
	return fmt.Sprintf("Config(ctx, %s)", arg0)
}

// ExpectedConfigSection represents an expectation for a call to ConfigSection().
type ExpectedConfigSection struct {
	commonExpectation
	callback func(ctx context.Context, arg0 string, arg1 string) (driver.ConfigSection, error)
	arg0     string
	arg1     string
	ret0     driver.ConfigSection
}

// WillExecute sets a callback function to be called with any inputs to the
// original function. Any values returned by the callback will be returned as
// if generated by the driver.
func (e *ExpectedConfigSection) WillExecute(cb func(ctx context.Context, arg0 string, arg1 string) (driver.ConfigSection, error)) *ExpectedConfigSection {
	e.callback = cb
	return e
}

// WillReturn sets the values that will be returned by the call to ConfigSection().
func (e *ExpectedConfigSection) WillReturn(ret0 driver.ConfigSection) *ExpectedConfigSection {
	e.ret0 = ret0
	return e
}

// WillReturnError sets the error value that will be returned by the call to ConfigSection().
func (e *ExpectedConfigSection) WillReturnError(err error) *ExpectedConfigSection {
	e.err = err
	return e
}

// WillDelay causes the call to ConfigSection() to delay.
func (e *ExpectedConfigSection) WillDelay(delay time.Duration) *ExpectedConfigSection {
	e.delay = delay
	return e
}

func (e *ExpectedConfigSection) met(ex expectation) bool {
	exp := ex.(*ExpectedConfigSection)
	if exp.arg0 != "" && exp.arg0 != e.arg0 {
		return false
	}
	if exp.arg1 != "" && exp.arg1 != e.arg1 {
		return false
	}
	return true
}

func (e *ExpectedConfigSection) method(v bool) string {
	if !v {
		return "ConfigSection()"
	}
	arg0, arg1 := "?", "?"
	if e.arg0 != "" {
		arg0 = fmt.Sprintf("%q", e.arg0)
	}
	if e.arg1 != "" {
		arg1 = fmt.Sprintf("%q", e.arg1)
	}
	return fmt.Sprintf("ConfigSection(ctx, %s, %s)", arg0, arg1)
}

// ExpectedDB represents an expectation for a call to DB().
type ExpectedDB struct {
	commonExpectation
	callback func(ctx context.Context, arg0 string, options map[string]interface{}) (driver.DB, error)
	arg0     string
	ret0     *DB
}

// WithOptions sets the expected options for the call to DB().
func (e *ExpectedDB) WithOptions(options map[string]interface{}) *ExpectedDB {
	e.options = options
	return e
}

// WillExecute sets a callback function to be called with any inputs to the
// original function. Any values returned by the callback will be returned as
// if generated by the driver.
func (e *ExpectedDB) WillExecute(cb func(ctx context.Context, arg0 string, options map[string]interface{}) (driver.DB, error)) *ExpectedDB {
	e.callback = cb
	return e
}

// WillReturn sets the values that will be returned by the call to DB().
func (e *ExpectedDB) WillReturn(ret0 *DB) *ExpectedDB {
	e.ret0 = ret0
	return e
}

// WillReturnError sets the error value that will be returned by the call to DB().
func (e *ExpectedDB) WillReturnError(err error) *ExpectedDB {
	e.err = err
	return e
}

// WillDelay causes the call to DB() to delay.
func (e *ExpectedDB) WillDelay(delay time.Duration) *ExpectedDB {
	e.delay = delay
	return e
}

func (e *ExpectedDB) met(ex expectation) bool {
	exp := ex.(*ExpectedDB)
	if exp.arg0 != "" && exp.arg0 != e.arg0 {
		return false
	}
	return true
}

func (e *ExpectedDB) method(v bool) string {
	if !v {
		return "DB()"
	}
	arg0, options := "?", defaultOptionPlaceholder
	if e.arg0 != "" {
		arg0 = fmt.Sprintf("%q", e.arg0)
	}
	if e.options != nil {
		options = fmt.Sprintf("%v", e.options)
	}
	return fmt.Sprintf("DB(ctx, %s, %s)", arg0, options)
}

// ExpectedDBUpdates represents an expectation for a call to DBUpdates().
type ExpectedDBUpdates struct {
	commonExpectation
	callback func(ctx context.Context) (driver.DBUpdates, error)
	ret0     *Updates
}

// WillExecute sets a callback function to be called with any inputs to the
// original function. Any values returned by the callback will be returned as
// if generated by the driver.
func (e *ExpectedDBUpdates) WillExecute(cb func(ctx context.Context) (driver.DBUpdates, error)) *ExpectedDBUpdates {
	e.callback = cb
	return e
}

// WillReturn sets the values that will be returned by the call to DBUpdates().
func (e *ExpectedDBUpdates) WillReturn(ret0 *Updates) *ExpectedDBUpdates {
	e.ret0 = ret0
	return e
}

// WillReturnError sets the error value that will be returned by the call to DBUpdates().
func (e *ExpectedDBUpdates) WillReturnError(err error) *ExpectedDBUpdates {
	e.err = err
	return e
}

// WillDelay causes the call to DBUpdates() to delay.
func (e *ExpectedDBUpdates) WillDelay(delay time.Duration) *ExpectedDBUpdates {
	e.delay = delay
	return e
}

func (e *ExpectedDBUpdates) met(_ expectation) bool {
	return true
}

func (e *ExpectedDBUpdates) method(v bool) string {
	if !v {
		return "DBUpdates()"
	}
	return fmt.Sprintf("DBUpdates(ctx)")
}

// ExpectedDBsStats represents an expectation for a call to DBsStats().
type ExpectedDBsStats struct {
	commonExpectation
	callback func(ctx context.Context, arg0 []string) ([]*driver.DBStats, error)
	arg0     []string
	ret0     []*driver.DBStats
}

// WillExecute sets a callback function to be called with any inputs to the
// original function. Any values returned by the callback will be returned as
// if generated by the driver.
func (e *ExpectedDBsStats) WillExecute(cb func(ctx context.Context, arg0 []string) ([]*driver.DBStats, error)) *ExpectedDBsStats {
	e.callback = cb
	return e
}

// WillReturn sets the values that will be returned by the call to DBsStats().
func (e *ExpectedDBsStats) WillReturn(ret0 []*driver.DBStats) *ExpectedDBsStats {
	e.ret0 = ret0
	return e
}

// WillReturnError sets the error value that will be returned by the call to DBsStats().
func (e *ExpectedDBsStats) WillReturnError(err error) *ExpectedDBsStats {
	e.err = err
	return e
}

// WillDelay causes the call to DBsStats() to delay.
func (e *ExpectedDBsStats) WillDelay(delay time.Duration) *ExpectedDBsStats {
	e.delay = delay
	return e
}

func (e *ExpectedDBsStats) met(ex expectation) bool {
	exp := ex.(*ExpectedDBsStats)
	if exp.arg0 != nil && !reflect.DeepEqual(exp.arg0, e.arg0) {
		return false
	}
	return true
}

func (e *ExpectedDBsStats) method(v bool) string {
	if !v {
		return "DBsStats()"
	}
	arg0 := "?"
	if e.arg0 != nil {
		arg0 = fmt.Sprintf("%v", e.arg0)
	}
	return fmt.Sprintf("DBsStats(ctx, %s)", arg0)
}

// ExpectedGetReplications represents an expectation for a call to GetReplications().
type ExpectedGetReplications struct {
	commonExpectation
	callback func(ctx context.Context, options map[string]interface{}) ([]driver.Replication, error)
	ret0     []*Replication
}

// WithOptions sets the expected options for the call to GetReplications().
func (e *ExpectedGetReplications) WithOptions(options map[string]interface{}) *ExpectedGetReplications {
	e.options = options
	return e
}

// WillExecute sets a callback function to be called with any inputs to the
// original function. Any values returned by the callback will be returned as
// if generated by the driver.
func (e *ExpectedGetReplications) WillExecute(cb func(ctx context.Context, options map[string]interface{}) ([]driver.Replication, error)) *ExpectedGetReplications {
	e.callback = cb
	return e
}

// WillReturn sets the values that will be returned by the call to GetReplications().
func (e *ExpectedGetReplications) WillReturn(ret0 []*Replication) *ExpectedGetReplications {
	e.ret0 = ret0
	return e
}

// WillReturnError sets the error value that will be returned by the call to GetReplications().
func (e *ExpectedGetReplications) WillReturnError(err error) *ExpectedGetReplications {
	e.err = err
	return e
}

// WillDelay causes the call to GetReplications() to delay.
func (e *ExpectedGetReplications) WillDelay(delay time.Duration) *ExpectedGetReplications {
	e.delay = delay
	return e
}

func (e *ExpectedGetReplications) met(_ expectation) bool {
	return true
}

func (e *ExpectedGetReplications) method(v bool) string {
	if !v {
		return "GetReplications()"
	}
	options := defaultOptionPlaceholder
	if e.options != nil {
		options = fmt.Sprintf("%v", e.options)
	}
	return fmt.Sprintf("GetReplications(ctx, %s)", options)
}

// ExpectedReplicate represents an expectation for a call to Replicate().
type ExpectedReplicate struct {
	commonExpectation
	callback func(ctx context.Context, arg0 string, arg1 string, options map[string]interface{}) (driver.Replication, error)
	arg0     string
	arg1     string
	ret0     *Replication
}

// WithOptions sets the expected options for the call to Replicate().
func (e *ExpectedReplicate) WithOptions(options map[string]interface{}) *ExpectedReplicate {
	e.options = options
	return e
}

// WillExecute sets a callback function to be called with any inputs to the
// original function. Any values returned by the callback will be returned as
// if generated by the driver.
func (e *ExpectedReplicate) WillExecute(cb func(ctx context.Context, arg0 string, arg1 string, options map[string]interface{}) (driver.Replication, error)) *ExpectedReplicate {
	e.callback = cb
	return e
}

// WillReturn sets the values that will be returned by the call to Replicate().
func (e *ExpectedReplicate) WillReturn(ret0 *Replication) *ExpectedReplicate {
	e.ret0 = ret0
	return e
}

// WillReturnError sets the error value that will be returned by the call to Replicate().
func (e *ExpectedReplicate) WillReturnError(err error) *ExpectedReplicate {
	e.err = err
	return e
}

// WillDelay causes the call to Replicate() to delay.
func (e *ExpectedReplicate) WillDelay(delay time.Duration) *ExpectedReplicate {
	e.delay = delay
	return e
}

func (e *ExpectedReplicate) met(ex expectation) bool {
	exp := ex.(*ExpectedReplicate)
	if exp.arg0 != "" && exp.arg0 != e.arg0 {
		return false
	}
	if exp.arg1 != "" && exp.arg1 != e.arg1 {
		return false
	}
	return true
}

func (e *ExpectedReplicate) method(v bool) string {
	if !v {
		return "Replicate()"
	}
	arg0, arg1, options := "?", "?", defaultOptionPlaceholder
	if e.arg0 != "" {
		arg0 = fmt.Sprintf("%q", e.arg0)
	}
	if e.arg1 != "" {
		arg1 = fmt.Sprintf("%q", e.arg1)
	}
	if e.options != nil {
		options = fmt.Sprintf("%v", e.options)
	}
	return fmt.Sprintf("Replicate(ctx, %s, %s, %s)", arg0, arg1, options)
}

// ExpectedSession represents an expectation for a call to Session().
type ExpectedSession struct {
	commonExpectation
	callback func(ctx context.Context) (*driver.Session, error)
	ret0     *driver.Session
}

// WillExecute sets a callback function to be called with any inputs to the
// original function. Any values returned by the callback will be returned as
// if generated by the driver.
func (e *ExpectedSession) WillExecute(cb func(ctx context.Context) (*driver.Session, error)) *ExpectedSession {
	e.callback = cb
	return e
}

// WillReturn sets the values that will be returned by the call to Session().
func (e *ExpectedSession) WillReturn(ret0 *driver.Session) *ExpectedSession {
	e.ret0 = ret0
	return e
}

// WillReturnError sets the error value that will be returned by the call to Session().
func (e *ExpectedSession) WillReturnError(err error) *ExpectedSession {
	e.err = err
	return e
}

// WillDelay causes the call to Session() to delay.
func (e *ExpectedSession) WillDelay(delay time.Duration) *ExpectedSession {
	e.delay = delay
	return e
}

func (e *ExpectedSession) met(_ expectation) bool {
	return true
}

func (e *ExpectedSession) method(v bool) string {
	if !v {
		return "Session()"
	}
	return fmt.Sprintf("Session(ctx)")
}

// ExpectedVersion represents an expectation for a call to Version().
type ExpectedVersion struct {
	commonExpectation
	callback func(ctx context.Context) (*driver.Version, error)
	ret0     *driver.Version
}

// WillExecute sets a callback function to be called with any inputs to the
// original function. Any values returned by the callback will be returned as
// if generated by the driver.
func (e *ExpectedVersion) WillExecute(cb func(ctx context.Context) (*driver.Version, error)) *ExpectedVersion {
	e.callback = cb
	return e
}

// WillReturn sets the values that will be returned by the call to Version().
func (e *ExpectedVersion) WillReturn(ret0 *driver.Version) *ExpectedVersion {
	e.ret0 = ret0
	return e
}

// WillReturnError sets the error value that will be returned by the call to Version().
func (e *ExpectedVersion) WillReturnError(err error) *ExpectedVersion {
	e.err = err
	return e
}

// WillDelay causes the call to Version() to delay.
func (e *ExpectedVersion) WillDelay(delay time.Duration) *ExpectedVersion {
	e.delay = delay
	return e
}

func (e *ExpectedVersion) met(_ expectation) bool {
	return true
}

func (e *ExpectedVersion) method(v bool) string {
	if !v {
		return "Version()"
	}
	return fmt.Sprintf("Version(ctx)")
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Septoria salviae-pratensis Pass.

### Remarks
null

redpajama_set_name: RedPajamaGithub


text:
package oap.http.pnio;

public class TestState {
    public StringBuilder sb = new StringBuilder();
    public String oldThreadName = Thread.currentThread().getName();
}


text:
/*
 *
 * 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.
 */

package com.comcast.cdn.traffic_control.traffic_router.core.status.model;

import java.util.List;

/**
 * Model for a Cache.
 */
public class CacheModel {
    private String cacheId;
    private String fqdn;
    private List<String> ipAddresses;
    private int port;
    private String adminStatus;
    private boolean lastUpdateHealthy;
    private long lastUpdateTime;
	private long connections;
	private long currentBW;
	private long availBW;
	boolean cacheOnline;

    /**
     * Gets adminStatus.
     *
     * @return the adminStatus
     */
    public String getAdminStatus() {
        return adminStatus;
    }

    /**
     * Gets cacheId.
     *
     * @return the cacheId
     */
    public String getCacheId() {
        return cacheId;
    }

    /**
     * Gets fqdn.
     *
     * @return the fqdn
     */
    public String getFqdn() {
        return fqdn;
    }

    /**
     * Gets ipAddresses.
     *
     * @return the ipAddresses
     */
    public List<String> getIpAddresses() {
        return ipAddresses;
    }

    /**
     * Gets lastUpdateTime.
     *
     * @return the lastUpdateTime
     */
    public long getLastUpdateTime() {
        return lastUpdateTime;
    }

    /**
     * Gets port.
     *
     * @return the port
     */
    public int getPort() {
        return port;
    }

    /**
     * Gets lastUpdateHealth.
     *
     * @return the lastUpdateHealth
     */
    public boolean isLastUpdateHealthy() {
        return lastUpdateHealthy;
    }

    /**
     * Sets adminStatus.
     *
     * @param adminStatus
     *            the adminStatus to set
     */
    public void setAdminStatus(final String adminStatus) {
        this.adminStatus = adminStatus;
    }

    /**
     * Sets cacheId.
     *
     * @param cacheId
     *            the cacheId to set
     */
    public void setCacheId(final String cacheId) {
        this.cacheId = cacheId;
    }

    /**
     * Sets fqdn.
     *
     * @param fqdn
     *            the fqdn to set
     */
    public void setFqdn(final String fqdn) {
        this.fqdn = fqdn;
    }

    /**
     * Sets lastUpdateHealthy.
     *
     * @param lastUpdateHealthy
     *            the lastUpdateHealthy to set
     */
    public void setLastUpdateHealthy(final boolean lastUpdateHealthy) {
        this.lastUpdateHealthy = lastUpdateHealthy;
    }

    /**
     * Sets ipAddresses.
     *
     * @param ipAddresses
     *            the ipAddresses to set
     */
    public void setIpAddresses(final List<String> ipAddresses) {
        this.ipAddresses = ipAddresses;
    }

    /**
     * Sets lastUpdateTime.
     *
     * @param lastUpdateTime
     *            the lastUpdateTime to set
     */
    public void setLastUpdateTime(final long lastUpdateTime) {
        this.lastUpdateTime = lastUpdateTime;
    }

    /**
     * Sets port.
     *
     * @param port
     *            the port to set
     */
    public void setPort(final int port) {
        this.port = port;
    }

	public void setConnections(final long numConn) {
		this.connections = numConn;
	}

	public long getConnections() {
		return connections;
	}

	public long getCurrentBW() {
		return currentBW;
	}

	public long getAvailBW() {
		return availBW;
	}

	public void setCurrentBW(final long currBW) {
		this.currentBW = currBW;
	}

	public void setAvailBW(final long availBW) {
		this.availBW = availBW;
	}

	public void setCacheOnline(final boolean cacheOnline) {
		this.cacheOnline = cacheOnline;
	}
	public boolean isCacheOnline() {
		return cacheOnline;
	}
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

  <title>404</title>
  <meta name="author" content="Roland Yonaba">

Sorry, Page Not Found.

This is certainly not the page you were looking for :)


text:
//
//  TKSearchHotKeyTextFiled.m
//  MMHSMeterialProject
//
//  Created by supin-tech on 16/4/18.
//  Copyright © 2016年 hushuaike. All rights reserved.
//

#import "TKSearchHotKeyTextFiled.h"

@implementation TKSearchHotKeyTextFiled

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        self.borderStyle = UITextBorderStyleNone;
        self.placeholder = @" 搜索您希望看到的热门";
        [self setTextColor:RGBColor(0x14, 0x14, 0x14)];
        self.font = [UIFont systemFontOfSize:16.0];

        self.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
        self.returnKeyType = UIReturnKeySearch;
        self.enablesReturnKeyAutomatically = YES;
        self.clearButtonMode = UITextFieldViewModeWhileEditing;

    }
    return self;
}

- (void)drawPlaceholderInRect:(CGRect)rect{

    UIColor *placeHoldColor = RGBColor(0x99, 0x99, 0x99);
    [placeHoldColor setFill];
    [[self placeholder] drawInRect:CGRectMake(0, 0, rect.size.width, rect.size.height) withFont:[UIFont systemFontOfSize:16]];
}

@end


text:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Api_Login extends CI_Controller {

	public function __construct()
	{
	  	parent::__construct();
	  	$this->load->model('api_login_model');
	}

	public function twitter(){
		$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);
		$request_token = $connection->getRequestToken(OAUTH_CALLBACK);

		//received token info from twitter
		$_SESSION['token'] 			= $request_token['oauth_token'];
		$_SESSION['token_secret'] 	= $request_token['oauth_token_secret'];

		if($connection->http_code == 200){
            //get twitter connect url
			$url = $connection->getAuthorizeURL($request_token);
            //send them

			redirect($url);
		}else{
            //error here
			redirect('login_user');
		}
	}

	public function twitter_call_back(){
		if (isset($_REQUEST['oauth_token']) && $_SESSION['token']  !== $_REQUEST['oauth_token']) {
			// if token is old, distroy any session and redirect user to index.php
			session_destroy();
			header('Location: ./login_user');

		}elseif(isset($_REQUEST['oauth_token']) && $_SESSION['token'] == $_REQUEST['oauth_token']) {

			//successful response returns oauth_token, oauth_token_secret, user_id, and screen_name
			$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $_SESSION['token'] , $_SESSION['token_secret']);
			$access_token = $connection->getAccessToken($_REQUEST['oauth_verifier']);
			if($connection->http_code=='200') {
				//redirect user to twitter
				$_SESSION['status'] = 'verified';
				$_SESSION['request_vars'] = $access_token;

				//DB Insert
				$data = array(
					'api_id' => $access_token['user_id'],
					'f_name' => $access_token['screen_name'],
					'app_type' =>3,
				);
			$id = $access_token['user_id'];
			$this->api_login_model->insert_api_info($data,$id);
			$_SESSION['tw_status'] = $access_token['screen_name'];

			// unset no longer needed request tokens
				unset($_SESSION['token']);
				unset($_SESSION['token_secret']);
                $this->session->set_userdata( 'user_flash_msg_type', "success" );
                $this->session->set_flashdata('user_flash_msg', 'Sucessfully Login');
				redirect('home');
			}else{
				die("error, try again later!");
			}
		}else{
			die("error connecting to twitter! try again later!");
		}
	}

	public function gmail_call_back(){
		$gClient = new Google_Client();
		$gClient->setApplicationName('Job Portal');
		$gClient->setClientId(CLIENT_ID);
		$gClient->setClientSecret(CLIENT_SECRET);
		$gClient->setRedirectUri(REDIRECT_URI);
		$google_oauthV2 = new Google_Oauth2Service($gClient);

		if(isset($_REQUEST['code'])) {
			$gClient->authenticate();
			$_SESSION['token'] = $gClient->getAccessToken();
			header('Location: ' . filter_var(REDIRECT_URI, FILTER_SANITIZE_URL));
		}
		if (isset($_SESSION['token'])) {
			$gClient->setAccessToken($_SESSION['token']);
		}

		if ($gClient->getAccessToken()) {
			$userProfile = $google_oauthV2->userinfo->get();
			//DB Insert
			$data = array(
					'api_id'  => $userProfile['id'],
                    'f_name' => $userProfile['given_name'],
                    'l_name'  => $userProfile['family_name'],
                    'image'  	 => $userProfile['picture'],
                    'gender'     => $userProfile['gender'],
                    'app_type'   =>1,
                );
			$id = $userProfile['id'];
			$_SESSION['gmail_full_name'] = $userProfile['name'];

			$this->api_login_model->insert_api_info($data,$id);
				unset($_SESSION['token']);
                $this->session->set_userdata( 'user_flash_msg_type', "success" );
                $this->session->set_flashdata('user_flash_msg', 'Sucessfully Login');
				redirect('home');
		} else {
			$authUrl = $gClient->createAuthUrl();
		}
	}

	public function fb_callback(){
		$fb = new Facebook\Facebook([
		  'app_id' => '535759006585393', // Replace {app-id} with your app id
		  'app_secret' => '7b747f50721cd007c6b802f54d16793c',
		  'default_graph_version' => 'v2.2',
		  ]);

		$helper = $fb->getRedirectLoginHelper();

		try {
		  $accessToken = $helper->getAccessToken();
		  $_SESSION['fb_access_token'] = (string) $accessToken;
		  $response = $fb->get('/me', $_SESSION['fb_access_token']);
		} catch(Facebook\Exceptions\FacebookResponseException $e) {
		  // When Graph returns an error
		  echo 'Graph returned an error: ' . $e->getMessage();
		  exit;
		} catch(Facebook\Exceptions\FacebookSDKException $e) {
		  // When validation fails or other local issues
		  echo 'Facebook SDK returned an error: ' . $e->getMessage();
		  exit;
		}
		$fbData = $response->getGraphUser();

		//DB Insert
		$data = array(
			'api_id'  => $fbData['id'],
			'f_name' => $fbData['name'],
			'app_type'   =>2,
			);
		$id = $fbData['id'];
		$_SESSION['fb_status'] = $fbData['name'];

		$this->api_login_model->insert_api_info($data,$id);
		unset($_SESSION['fb_access_token']);
		$this->session->set_userdata( 'user_flash_msg_type', "success" );
		$this->session->set_flashdata('user_flash_msg', 'Sucessfully Login');
		redirect('home');
	}
}


text:
#include "pairwise.h"
#include <iostream>

Kernel::~Kernel() {
}
class ComparisonKernel: public Kernel {
protected:
  MatrixXf pair_comp_;

public:
  ComparisonKernel(const MatrixXf & pair_comp) {
    pair_comp_ = pair_comp;
  }
  virtual void apply( MatrixXf & out, const MatrixXf & Q) const {
    out = Q * pair_comp_;
    // printf("%d %d %d %d %d %d\n", Q.rows(), Q.cols(), pair_comp_.rows(), pair_comp_.cols(), out.rows(), out.cols());
  }
  virtual void applyTranspose( MatrixXf & out, const MatrixXf & Q) const {
  	out = Q * pair_comp_.transpose();
  }
  virtual VectorXf parameters() const {
  }
  virtual void setParameters( const VectorXf & p ) {
  }
  virtual VectorXf gradient( const MatrixXf & b, const MatrixXf & Q ) const {
  }
};

class ComparisonKernelNystrom: public Kernel {
protected:
  MatrixXf ns_left_;
  MatrixXf ns_right_;

public:
  ComparisonKernelNystrom(const MatrixXf & ns_left, const MatrixXf & ns_right) {
    ns_left_ = ns_left;
    ns_right_ = ns_right;
  }
  virtual void apply( MatrixXf & out, const MatrixXf & Q) const {
  	// printf("%d %d %d %d %d %d %d %d\n", Q.rows(), Q.cols(), ns_left_.rows(), ns_left_.cols(), ns_right_.rows(), ns_right_.cols(), out.rows(), out.cols());
  	// MatrixXf tmp;
  	// tmp = ns_left_ * ns_right_;
    out = (Q * ns_left_) * ns_right_;
    // printf("%d %d %d %d %d %d %d %d\n", Q.rows(), Q.cols(), ns_left_.rows(), ns_left_.cols(), ns_right_.rows(), ns_right_.cols(), out.rows(), out.cols());
    // printf("%d %d %d %d %d %d\n", Q.rows(), Q.cols(), pair_comp_.rows(), pair_comp_.cols(), out.rows(), out.cols());
  }
  virtual void applyTranspose( MatrixXf & out, const MatrixXf & Q) const {
  	// out = Q * pair_comp_.transpose();
  }
  virtual VectorXf parameters() const {
  }
  virtual void setParameters( const VectorXf & p ) {
  }
  virtual VectorXf gradient( const MatrixXf & b, const MatrixXf & Q ) const {
  }
};

class DenseKernel: public Kernel {
protected:
	MatrixXf f_;
	KernelType ktype_;
	NormalizationType ntype_;
	Permutohedral lattice_;
	VectorXf norm_;
	MatrixXf parameters_;
	void initLattice( const MatrixXf & f ) {
		const int N = f.cols();
		lattice_.init( f );

		norm_ = lattice_.compute( VectorXf::Ones( N ).transpose() ).transpose();

		if ( ntype_ == NO_NORMALIZATION ) {
			float mean_norm = 0;
			for ( int i=0; i<N; i++ )
				mean_norm += norm_[i];
			mean_norm = N / mean_norm;
			for ( int i=0; i<N; i++ )
				norm_[i] = mean_norm;
		}
		else if ( ntype_ == NORMALIZE_SYMMETRIC ) {
			for ( int i=0; i<N; i++ )
				norm_[i] = 1.0 / sqrt(norm_[i]+1e-20);
		}
		else {
			for ( int i=0; i<N; i++ )
				norm_[i] = 1.0 / (norm_[i]+1e-20);
		}
	}
	void filter( MatrixXf & out, const MatrixXf & in, bool transpose ) const {
		// Read in the values
		if( ntype_ == NORMALIZE_SYMMETRIC || (ntype_ == NORMALIZE_BEFORE && !transpose) || (ntype_ == NORMALIZE_AFTER && transpose))
			out = in*norm_.asDiagonal();
		else
			out = in;

		// Filter
		if( transpose )
			lattice_.compute( out, out, true );
		else
			lattice_.compute( out, out );
// 			lattice_.compute( out.data(), out.data(), out.rows() );

		// Normalize again
		if( ntype_ == NORMALIZE_SYMMETRIC || (ntype_ == NORMALIZE_BEFORE && transpose) || (ntype_ == NORMALIZE_AFTER && !transpose))
			out = out*norm_.asDiagonal();
	}
	// Compute d/df a^T*K*b
	MatrixXf kernelGradient( const MatrixXf & a, const MatrixXf & b ) const {
		MatrixXf g = 0*f_;
		lattice_.gradient( g.data(), a.data(), b.data(), a.rows() );
		return g;
	}
	MatrixXf featureGradient( const MatrixXf & a, const MatrixXf & b ) const {
		if (ntype_ == NO_NORMALIZATION )
			return kernelGradient( a, b );
		else if (ntype_ == NORMALIZE_SYMMETRIC ) {
			MatrixXf fa = lattice_.compute( a*norm_.asDiagonal(), true );
			MatrixXf fb = lattice_.compute( b*norm_.asDiagonal() );
			MatrixXf ones = MatrixXf::Ones( a.rows(), a.cols() );
			VectorXf norm3 = norm_.array()*norm_.array()*norm_.array();
			MatrixXf r = kernelGradient( 0.5*( a.array()*fb.array() + fa.array()*b.array() ).matrix()*norm3.asDiagonal(), ones );
			return - r + kernelGradient( a*norm_.asDiagonal(), b*norm_.asDiagonal() );
		}
		else if (ntype_ == NORMALIZE_AFTER ) {
			MatrixXf fb = lattice_.compute( b );

			MatrixXf ones = MatrixXf::Ones( a.rows(), a.cols() );
			VectorXf norm2 = norm_.array()*norm_.array();
			MatrixXf r = kernelGradient( ( a.array()*fb.array() ).matrix()*norm2.asDiagonal(), ones );
			return - r + kernelGradient( a*norm_.asDiagonal(), b );
		}
		else /*if (ntype_ == NORMALIZE_BEFORE )*/ {
			MatrixXf fa = lattice_.compute( a, true );

			MatrixXf ones = MatrixXf::Ones( a.rows(), a.cols() );
			VectorXf norm2 = norm_.array()*norm_.array();
			MatrixXf r = kernelGradient( ( fa.array()*b.array() ).matrix()*norm2.asDiagonal(), ones );
			return -r+kernelGradient( a, b*norm_.asDiagonal() );
		}
	}
public:
	DenseKernel(const MatrixXf & f, KernelType ktype, NormalizationType ntype):f_(f), ktype_(ktype), ntype_(ntype) {
		if (ktype_ == DIAG_KERNEL)
			parameters_ = VectorXf::Ones( f.rows() );
		else if( ktype == FULL_KERNEL )
			parameters_ = MatrixXf::Identity( f.rows(), f.rows() );
		initLattice( f );
	}
	virtual void apply( MatrixXf & out, const MatrixXf & Q ) const {
		filter( out, Q, false );
	}
	virtual void applyTranspose( MatrixXf & out, const MatrixXf & Q ) const {
		filter( out, Q, true );
	}
	virtual VectorXf parameters() const {
		if (ktype_ == CONST_KERNEL)
			return VectorXf();
		else if (ktype_ == DIAG_KERNEL)
			return parameters_;
		else {
			MatrixXf p = parameters_;
			p.resize( p.cols()*p.rows(), 1 );
			return p;
		}
	}
	virtual void setParameters( const VectorXf & p ) {
		if (ktype_ == DIAG_KERNEL) {
			parameters_ = p;
			initLattice( p.asDiagonal() * f_ );
		}
		else if (ktype_ == FULL_KERNEL) {
			MatrixXf tmp = p;
			tmp.resize( parameters_.rows(), parameters_.cols() );
			parameters_ = tmp;
			initLattice( tmp * f_ );
		}
	}
	virtual VectorXf gradient( const MatrixXf & a, const MatrixXf & b ) const {
		if (ktype_ == CONST_KERNEL)
			return VectorXf();
		MatrixXf fg = featureGradient( a, b );
		if (ktype_ == DIAG_KERNEL)
			return (f_.array()*fg.array()).rowwise().sum();
		else {
			MatrixXf p = fg*f_.transpose();
			p.resize( p.cols()*p.rows(), 1 );
			return p;
		}
	}
};

PairwisePotential::~PairwisePotential(){
	delete compatibility_;
	delete kernel_;
}
PairwisePotential::PairwisePotential(const MatrixXf & features, LabelCompatibility * compatibility, KernelType ktype, NormalizationType ntype) : compatibility_(compatibility) {
	kernel_ = new DenseKernel( features, ktype, ntype );
}
PairwisePotential::PairwisePotential(LabelCompatibility * compatibility, const MatrixXf & pair_comp) : compatibility_(compatibility) {
  kernel_ = new ComparisonKernel(pair_comp);
}
PairwisePotential::PairwisePotential(LabelCompatibility * compatibility, const MatrixXf & ns_left, const MatrixXf & ns_right) : compatibility_(compatibility) {
	// MatrixXf tmp;

  kernel_ = new ComparisonKernelNystrom(ns_left, ns_right);
}

void PairwisePotential::apply(MatrixXf & out, const MatrixXf & Q) const {
	// printf("Inside PairwisePotential::apply...\n");
	kernel_->apply( out, Q );

	// Apply the compatibility
	compatibility_->apply( out, out );
}
void PairwisePotential::applyTranspose(MatrixXf & out, const MatrixXf & Q) const {
	kernel_->applyTranspose( out, Q );
	// Apply the compatibility
	compatibility_->applyTranspose( out, out );
}
VectorXf PairwisePotential::parameters() const {
	return compatibility_->parameters();
}
void PairwisePotential::setParameters( const VectorXf & v ) {
	compatibility_->setParameters( v );
}
VectorXf PairwisePotential::gradient( const MatrixXf & b, const MatrixXf & Q ) const {
	MatrixXf filtered_Q = 0*Q;
	// You could reuse the filtered_b from applyTranspose
	kernel_->apply( filtered_Q, Q );
	return compatibility_->gradient(b,filtered_Q);
}
VectorXf PairwisePotential::kernelParameters() const {
	return kernel_->parameters();
}
void PairwisePotential::setKernelParameters( const VectorXf & v ) {
	kernel_->setParameters( v );
}
VectorXf PairwisePotential::kernelGradient( const MatrixXf & b, const MatrixXf & Q ) const {
	MatrixXf lbl_Q = 0*Q;
	// You could reuse the filtered_b from applyTranspose
	compatibility_->apply( lbl_Q, Q );
	return kernel_->gradient(b,lbl_Q);
}


text:
package iot.jcypher.domain.mapping.surrogate;

import java.util.Collection;
import java.util.Map;

public abstract class AbstractSurrogate {

	@SuppressWarnings("unchecked")
	public static AbstractSurrogate createSurrogate(Object original) {
		if (original instanceof Map<?, ?>)
			return new iot.jcypher.domain.mapping.surrogate.Map((Map<Object, Object>) original);
		else if (original instanceof Collection<?>)
			return new iot.jcypher.domain.mapping.surrogate.Collection((Collection<Object>) original);
		else if (original instanceof Object[])
			return new iot.jcypher.domain.mapping.surrogate.Array((Object[]) original);
		return null;
	}

	public abstract Object getContent();

	public abstract Object objectToUpdate();
}


text:
- [Installation](#installation)
- [Importing](#importing)
- [API](#api)
- [Links and Related Projects](#links-and-related-projects)

---

A collection of classes to represent and manipulate various vector shapes

# Installation

```
npm install kld-contours
```

# Importing

The following sections indicate how you can import the code for use in various environments.

## Node

```javascript
import {CubicBezier2D, QuadraticBezier2D, Rectangle2D} = require("kld-contours");
```

## ESM in Modern Browsers

```javascript
import {CubicBezier2D, QuadraticBezier2D, Rectangle2D} from './node_modules/kld-contours/dist/index-esm.js';
```

## Older Browsers

```html
<script src="./node_modules/kld-contours/dist/index-umd.js"></script>
<script>
  var CubicBezier2D = KldContours.CubicBezier2D;
  var QuadraticBezier2D = KldContours.QuadraticBezier2D;
  var Rectangle2D = KldContours.Rectangle2D;
</script>
```

## Bundlers

```javascript
import {CubicBezier2D, QuadraticBezier2D, Rectangle2D} from "kld-contours";
```

# API

## BoundingBox2D

- overlaps
- isEmpty
- toString

## Circle2D

- getBoundingBox

## CubicBezier2D

- getPointAtParameter
- splitAtParameter
- getBernsteinPolynomials
- getArcLengthPolynomial
- getParameterFromArcLength
- getBoundingBox
- getAlignedBoundingBox
- getAlignedBezier
- toPolygon2D
- toString

## Ellipse2D

- getBoundingBox

## Line2D

- getBoundingBox
- toPolygon2D

## Polygon2D

- getBoundingBox
- toPolygon2D

## QuadraticBezier2D

- getPointAtParameter
- splitAtParameter
- getBernsteinPolynomials
- getArcLengthPolynomial
- getParameterFromArcLength
- getBoundingBox
- getAlignedBoundingBox
- getAlignedBezier
- toPolygon2D
- toString

## Rectangle2D

- getBoundingBox
- toPolygon2D

# Links and Related Projects

- [kld-affine](https://github.com/thelonious/kld-affine)
- [kld-polynomial](https://github.com/thelonious/kld-polynomial)
- [kld-intersections](https://github.com/thelonious/kld-intersections)


text:
namespace Light.Data
{
	internal class SpecifiedSelector : Selector
	{
		public override string CreateSelectString (CommandFactory factory, bool isFullName, CreateSqlState state)
		{
			var list = new string [selectList.Count];
			var index = 0;
			foreach (var fieldInfo in selectList) {
                if (fieldInfo is IAliasDataFieldInfo alias) {
                    list[index] = alias.CreateAliasDataFieldSql(factory, isFullName, state);
                }
                else {
                    list[index] = fieldInfo.CreateSqlString(factory, isFullName, state);
                }
                index++;
			}
			var customSelect = string.Join (",", list);
			return customSelect;
		}
	}
}


text:
package org.apache.nifi.processors.mongodb;

import org.apache.nifi.mongodb.MongoDBClientService;
import org.apache.nifi.mongodb.MongoDBControllerService;
import org.apache.nifi.util.TestRunner;
import org.bson.Document;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import java.util.HashMap;
import java.util.Map;

public class DeleteMongoIT extends MongoWriteTestBase {
    @Before
    public void setup() {
        super.setup(DeleteMongo.class);
        collection.insertMany(DOCUMENTS);
    }

    @After
    public void teardown() {
        super.teardown();
    }

    private void testOne(TestRunner runner, String query, Map<String, String> attrs) {
        runner.enqueue(query, attrs);
        runner.run(1, true);
        runner.assertTransferCount(DeleteMongo.REL_FAILURE, 0);
        runner.assertTransferCount(DeleteMongo.REL_SUCCESS, 1);

        Assert.assertEquals("Found a document that should have been deleted.",
                0, collection.count(Document.parse(query)));
    }

    @Test
    public void testDeleteOne() {
        TestRunner runner = init(DeleteMongo.class);
        String query = "{ \"_id\": \"doc_1\" }";
        runner.setProperty(DeleteMongo.DELETE_MODE, DeleteMongo.DELETE_ONE);
        testOne(runner, query, new HashMap<>());
        Map<String, String> attrs = new HashMap<>();
        attrs.put("mongodb.delete.mode", "one");
        runner.setProperty(DeleteMongo.DELETE_MODE, DeleteMongo.DELETE_ATTR);
        query = "{ \"_id\": \"doc_2\" }";
        runner.clearTransferState();
        testOne(runner, query, attrs);
    }

    private void manyTest(TestRunner runner, String query, Map<String, String> attrs) {
        runner.enqueue(query, attrs);
        runner.run(1, true);
        runner.assertTransferCount(DeleteMongo.REL_FAILURE, 0);
        runner.assertTransferCount(DeleteMongo.REL_SUCCESS, 1);

        Assert.assertEquals("Found a document that should have been deleted.",
                0, collection.count(Document.parse(query)));
        Assert.assertEquals("One document should have been left.",
                1, collection.count(Document.parse("{}")));
    }

    @Test
    public void testDeleteMany() {
        TestRunner runner = init(DeleteMongo.class);
        String query = "{\n" +
                "\t\"_id\": {\n" +
                "\t\t\"$in\": [\"doc_1\", \"doc_2\"]\n" +
                "\t}\n" +
                "}";
        runner.setProperty(DeleteMongo.DELETE_MODE, DeleteMongo.DELETE_MANY);
        manyTest(runner, query, new HashMap<>());

        runner.setProperty(DeleteMongo.DELETE_MODE, DeleteMongo.DELETE_ATTR);
        Map<String, String> attrs = new HashMap<>();
        attrs.put("mongodb.delete.mode", "many");
        collection.drop();
        collection.insertMany(DOCUMENTS);
        runner.clearTransferState();
        manyTest(runner, query, attrs);
    }

    @Test
    public void testFailOnNoDeleteOptions() {
        TestRunner runner = init(DeleteMongo.class);
        String query = "{ \"_id\": \"doc_4\"} ";
        runner.enqueue(query);
        runner.run(1, true);
        runner.assertTransferCount(DeleteMongo.REL_FAILURE, 1);
        runner.assertTransferCount(DeleteMongo.REL_SUCCESS, 0);

        Assert.assertEquals("A document was deleted", 3, collection.count(Document.parse("{}")));

        runner.setProperty(DeleteMongo.FAIL_ON_NO_DELETE, DeleteMongo.NO_FAIL);
        runner.clearTransferState();
        runner.enqueue(query);
        runner.run(1, true, true);

        runner.assertTransferCount(DeleteMongo.REL_FAILURE, 0);
        runner.assertTransferCount(DeleteMongo.REL_SUCCESS, 1);

        Assert.assertEquals("A document was deleted", 3, collection.count(Document.parse("{}")));
    }

    @Test
    public void testClientService() throws Exception {
        MongoDBClientService clientService = new MongoDBControllerService();
        TestRunner runner = init(DeleteMongo.class);
        runner.addControllerService("clientService", clientService);
        runner.removeProperty(DeleteMongo.URI);
        runner.setProperty(DeleteMongo.DELETE_MODE, DeleteMongo.DELETE_MANY);
        runner.setProperty(clientService, MongoDBControllerService.URI, MONGO_URI);
        runner.setProperty(DeleteMongo.CLIENT_SERVICE, "clientService");
        runner.enableControllerService(clientService);
        runner.assertValid();

        runner.enqueue("{}");
        runner.run();
        runner.assertTransferCount(DeleteMongo.REL_SUCCESS, 1);
        runner.assertTransferCount(DeleteMongo.REL_FAILURE, 0);

        Assert.assertEquals(0, collection.count());
    }
}


text:
<!doctype html>
<html lang="">

<head>
    <meta charset="utf-8">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <title>Demo</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style type="text/css">
    .source {
        width: 100%;
        height: 5em;
    }

    #toUpper {
        text-transform: uppercase;
    }

    #toLower {
        text-transform: lowercase;
    }

    #capital {
        text-transform: capitalize;
    }
    </style>
</head>

<body>
    <textarea class="source"></textarea>
    <textarea id="toUpper" class="source"></textarea>
    <textarea id="toLower" class="source"></textarea>
    <textarea id="capital" class="source"></textarea>
</body>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script type="text/javascript">
String.prototype.capitalizeFirstLetter = function() {
    return this.charAt(0).toUpperCase() + this.slice(1).toLowerCase();
}
$(function() {
    $source = $(".source");
    $toUpper = $("#toUpper");
    $toLower = $("#toLower");
    $capital = $("#capital");
    $source.keyup(function() {
        $toUpper.text($source.val());
        $toLower.text($source.val());
        $capital.text($source.val().capitalizeFirstLetter());
    });
});
</script>

</html>


text:
package org.uberfire.client.mvp;

import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.jboss.errai.ioc.client.container.DynamicAnnotation;
import org.jboss.errai.ioc.client.container.IOCBeanDef;
import org.junit.Test;
import org.uberfire.client.workbench.annotations.AssociatedResources;
import org.uberfire.client.workbench.annotations.Priority;
import org.uberfire.client.workbench.type.ClientResourceType;
import org.uberfire.commons.data.Pair;

import static org.junit.Assert.*;
import static org.mockito.Mockito.*;

public class ActivityMetaInfoTest {

    @Test
    public void generateNotGenerateActivityMetaInfo() {
        IOCBeanDef<?> beanDefinition = mock(IOCBeanDef.class);
        when(beanDefinition.getQualifiers()).thenReturn(Collections.<Annotation>emptySet());

        Pair<Integer, List<String>> nullGenerated = ActivityMetaInfo.generate(beanDefinition);

        assertNull(nullGenerated);
    }

    @Test
    @SuppressWarnings("unchecked")
    public void generateActivityMetaInfo() {
        IOCBeanDef<?> beanDefinition = mock(IOCBeanDef.class);
        Priority priority = mock(Priority.class);
        Integer priorityValue = 1;
        when(priority.value()).thenReturn(priorityValue);

        Set<Annotation> qualifiers = new HashSet<Annotation>();
        AssociatedResources associatedResources = mock(AssociatedResources.class);

        final List<Class<? extends ClientResourceType>> typesList = new ArrayList<Class<? extends ClientResourceType>>();
        typesList.add(ClientResourceType.class);

        Class<? extends ClientResourceType>[] array = typesList.toArray(new Class[typesList.size()]);
        when(associatedResources.value()).thenReturn(array);

        qualifiers.add(associatedResources);
        qualifiers.add(priority);

        when(beanDefinition.getQualifiers()).thenReturn(qualifiers);

        Pair<Integer, List<String>> generated = ActivityMetaInfo.generate(beanDefinition);

        assertEquals(priorityValue,
                     generated.getK1());
        assertTrue(generated.getK2().contains(ClientResourceType.class.getName()));
    }

    @Test
    public void generateActivityMetaInfoForDynamicActivity() {
        final String otherResourceType = "org.uberfire.OtherResourceType";
        IOCBeanDef<?> beanDefinition = mock(IOCBeanDef.class);

        DynamicAnnotation priority = mock(DynamicAnnotation.class);
        when(priority.getName()).thenReturn(Priority.class.getName());
        when(priority.getMember("value")).thenReturn("1");

        Set<Annotation> qualifiers = new HashSet<Annotation>();
        DynamicAnnotation associatedResources = mock(DynamicAnnotation.class);
        when(associatedResources.getName()).thenReturn(AssociatedResources.class.getName());
        when(associatedResources.getMember("value")).thenReturn("[" + ClientResourceType.class.getName() + "," + otherResourceType + "]");

        qualifiers.add(associatedResources);
        qualifiers.add(priority);

        when(beanDefinition.isDynamic()).thenReturn(true);
        when(beanDefinition.getQualifiers()).thenReturn(qualifiers);

        Pair<Integer, List<String>> generated = ActivityMetaInfo.generate(beanDefinition);

        assertEquals(Integer.valueOf(1),
                     generated.getK1());
        assertTrue(generated.getK2().contains(ClientResourceType.class.getName()));
        assertTrue(generated.getK2().contains("org.uberfire.OtherResourceType"));
    }
}


text:
Create github page for project - done
Add travis.yml - done
Add batch and msbuild project - done
Add shared versioninfo.cs - done

Update readme.md with full description - done

Top level structure
src
tests
packages

Create wiki for documentation
Provide links to wiki from readme and pages

Create end user help documentation

Create developer guide
 how to get the source code
 how the code is laid out
 setting up the build system
 how to run a build and setup unit tests
 how to contribute - unit tests, documentation, checklist of things

Add solution - done
Add core project - done
Add msbuild project
Add gui project - done
Add console project
Add powershell project binding?

Version number
Tag version in git

Create change log
Announce availability
Release checklist

Handle extension methods
System.Runtime.CompilerServices.ExtensionAttribute

* Graph of Assembly dependencies
* Hashes - done
* Levenstein Distance for code

# Namespaces

Reflection
Analysis
Exceptions
Reporting
Framework
Logging
Tasks

# Events in Reflection

Consider
IdentifiedEvent
InterfaceFound
ClassFound
StructFound
EnumFound
TypeFound
AssemblyFound

# Rules

Framework to load custom inspection rules - done

# Reporting

Framework to load custom reports - done

# Rule Implementation

## Product Inspection

* Removed assemblies - done
* Changed assemblies - done
* Added assemblies - done

## Assembly Inspection

* Changed target architecture - done
* Changed assembly references - done
* Removed types - done
* Added types - done
* Obsolete types - done
* Changed types - done

## Type Inspection

* Constant values - done
* Enum values - done
* Abstraction - done
* Constructors - done
* Derivation - done
* Events - done
* Fields - done
* Finalizers - done
* Interface implementation - done
* Methods - done
* Properties - done
* Sealing - done
* Obsolete members - done
* Taxonomy changes - class to interface, concrete to abstract class etc. - done

# UI Issues

Add textbox or lable to show directory for from and to folders. - done
Use a different dialog to browse to directory so that copy/paste of path can be used.
If highlighting multiple entries on either list, then the Delete key should perform the same job as clicking the - (minus) button. - done
When clicking into a list of assemblies in the UI, allow Ctrl+A or add a select all button. - done

Task libraries
Completion token to cancel
Closing the app?

Rules for attribute changes
Reports by namespace and/or by assembly - full object model to query.

# Examples

using c#, vb.net, f# ???

generate fragments of files used for sandcastle ui

Do unit tests on built code and on itypeinfos?

handle params arguments
in out ref arguments
handle arrays[]

# Metrics
(see http://www.cppdepend.com/Metrics.aspx#MetricsOnApplication)
Efferent coupling
Afferent coupling
Dependencies between assemblies and objects
(http://raygun.io)


text:
{% extends "skeleton.html" %}
{% load djangocodemirror_tags %}

{% block head_title %}Usage on a HTML element{% endblock %}

{% block base_content %}

Usage on a HTML element

<form>
    <textarea id="code" name="code">Lorem ipsum dolor sit amet.</textarea>
</form>

{% codemirror_instance 'restructuredtext' 'code_codemirror' 'code' %}
{% endblock %}


text:
{-# LANGUAGE CPP #-}

{-|
Module:      Spec.FromStringTextShowSpec
Copyright:   (C) 2014-2017 Ryan Scott
License:     BSD-style (see the file LICENSE)
Maintainer:  Ryan Scott
Stability:   Provisional
Portability: GHC

@hspec@ tests for 'FromStringShow' and 'FromTextShow'.
-}
module Spec.FromStringTextShowSpec (main, spec) where

import Data.Proxy.Compat (Proxy(..))
import Instances.FromStringTextShow ()
import Spec.Utils (matchesTextShowSpec)
import Test.Hspec (Spec, describe, hspec, parallel)
import TextShow (FromStringShow(..), FromTextShow(..))

#if defined(NEW_FUNCTOR_CLASSES)
import Spec.Utils (matchesTextShow1Spec, matchesTextShow2Spec)
import TextShow (FromStringShow1(..), FromStringShow2(..),
                 FromTextShow1(..), FromTextShow2(..))
#endif

main :: IO ()
main = hspec spec

spec :: Spec
spec = parallel $ do
    describe "FromStringShow Int" $ do
        let p :: Proxy (FromStringShow Int)
            p = Proxy
        matchesTextShowSpec  p
    describe "FromStringShow String" $ do
        let p :: Proxy (FromStringShow String)
            p = Proxy
        matchesTextShowSpec  p
    describe "FromTextShow Int" $ do
        let p :: Proxy (FromTextShow Int)
            p = Proxy
        matchesTextShowSpec  p
    describe "FromTextShow String" $ do
        let p :: Proxy (FromTextShow String)
            p = Proxy
        matchesTextShowSpec  p
#if defined(NEW_FUNCTOR_CLASSES)
    describe "FromStringShow1 Maybe Int" $ do
        let p :: Proxy (FromStringShow1 Maybe Int)
            p = Proxy
        matchesTextShow1Spec p
    describe "FromTextShow1 Maybe Int" $ do
        let p :: Proxy (FromTextShow1 Maybe Int)
            p = Proxy
        matchesTextShow1Spec p
    describe "FromStringShow2 Either Char Int" $ do
        let p :: Proxy (FromStringShow2 Either Char Int)
            p = Proxy
        matchesTextShow2Spec p
    describe "FromTextShow2 Either Char Int" $ do
        let p :: Proxy (FromTextShow2 Either Char Int)
            p = Proxy
        matchesTextShow2Spec p
#endif


text:
package auth

import (
	"mime/multipart"

	"github.com/go-macaron/binding"
	"gopkg.in/macaron.v1"
)

type InstallForm struct {
	DbType   string `binding:"Required"`
	DbHost   string
	DbUser   string
	DbPasswd string
	DbName   string
	SSLMode  string
	DbPath   string

	AppName             string `binding:"Required" locale:"install.app_name"`
	RepoRootPath        string `binding:"Required"`
	RunUser             string `binding:"Required"`
	Domain              string `binding:"Required"`
	SSHPort             int
	UseBuiltinSSHServer bool
	HTTPPort            string `binding:"Required"`
	AppUrl              string `binding:"Required"`
	LogRootPath         string `binding:"Required"`

	SMTPHost        string
	SMTPFrom        string
	SMTPUser        string `binding:"OmitEmpty;MaxSize(254)" locale:"install.mailer_user"`
	SMTPPasswd      string
	RegisterConfirm bool
	MailNotify      bool

	OfflineMode           bool
	DisableGravatar       bool
	EnableFederatedAvatar bool
	DisableRegistration   bool
	EnableCaptcha         bool
	RequireSignInView     bool

	AdminName          string `binding:"OmitEmpty;AlphaDashDot;MaxSize(30)" locale:"install.admin_name"`
	AdminPasswd        string `binding:"OmitEmpty;MaxSize(255)" locale:"install.admin_password"`
	AdminConfirmPasswd string
	AdminEmail         string `binding:"OmitEmpty;MinSize(3);MaxSize(254);Include(@)" locale:"install.admin_email"`
}

func (f *InstallForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
	return validate(errs, ctx.Data, f, ctx.Locale)
}

//    _____   ____ _________________ ___
//   /  _  \ |    |   \__    ___/   |   \
//  /  /_\  \|    |   / |    | /    ~    \
// /    |    \    |  /  |    | \    Y    /
// \____|__  /______/   |____|  \___|_  /
//         \/                         \/

type RegisterForm struct {
	UserName string `binding:"Required;AlphaDashDot;MaxSize(35)"`
	Email    string `binding:"Required;Email;MaxSize(254)"`
	Password string `binding:"Required;MaxSize(255)"`
	Retype   string
}

func (f *RegisterForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
	return validate(errs, ctx.Data, f, ctx.Locale)
}

type SignInForm struct {
	UserName string `binding:"Required;MaxSize(254)"`
	Password string `binding:"Required;MaxSize(255)"`
	Remember bool
}

func (f *SignInForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
	return validate(errs, ctx.Data, f, ctx.Locale)
}

//   __________________________________________.___ _______    ________  _________
//  /   _____/\_   _____/\__    ___/\__    ___/|   |\      \  /  _____/ /   _____/
//  \_____  \  |    __)_   |    |     |    |   |   |/   |   \/   \  ___ \_____  \
//  /        \ |        \  |    |     |    |   |   /    |    \    \_\  \/        \
// /_______  //_______  /  |____|     |____|   |___\____|__  /\______  /_______  /
//         \/         \/                                   \/        \/        \/

type UpdateProfileForm struct {
	Name     string `binding:"OmitEmpty;MaxSize(35)"`
	FullName string `binding:"MaxSize(100)"`
	Email    string `binding:"Required;Email;MaxSize(254)"`
	Website  string `binding:"Url;MaxSize(100)"`
	Location string `binding:"MaxSize(50)"`
}

func (f *UpdateProfileForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
	return validate(errs, ctx.Data, f, ctx.Locale)
}

const (
	AVATAR_LOCAL  string = "local"
	AVATAR_BYMAIL string = "bymail"
)

type AvatarForm struct {
	Source      string
	Avatar      *multipart.FileHeader
	Gravatar    string `binding:"OmitEmpty;Email;MaxSize(254)"`
	Federavatar bool
}

func (f *AvatarForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
	return validate(errs, ctx.Data, f, ctx.Locale)
}

type AddEmailForm struct {
	Email string `binding:"Required;Email;MaxSize(254)"`
}

func (f *AddEmailForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
	return validate(errs, ctx.Data, f, ctx.Locale)
}

type ChangePasswordForm struct {
	OldPassword string `form:"old_password" binding:"Required;MinSize(1);MaxSize(255)"`
	Password    string `form:"password" binding:"Required;MaxSize(255)"`
	Retype      string `form:"retype"`
}

func (f *ChangePasswordForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
	return validate(errs, ctx.Data, f, ctx.Locale)
}

type AddSSHKeyForm struct {
	Title   string `binding:"Required;MaxSize(50)"`
	Content string `binding:"Required"`
}

func (f *AddSSHKeyForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
	return validate(errs, ctx.Data, f, ctx.Locale)
}

type NewAccessTokenForm struct {
	Name string `binding:"Required"`
}

func (f *NewAccessTokenForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
	return validate(errs, ctx.Data, f, ctx.Locale)
}


text:
namespace Tests {

  class Process {
  public:

    void startChild(const std::string& executablePath, const std::vector<std::string>& args = {});
    void wait();

  private:

    size_t m_pid = 0;

  };
}


text:
// ***********************************************************************
// Copyright (c) 2010 Charlie Poole
//
// 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.
// ***********************************************************************
#if false
using NUnit.Framework.Api;

namespace NUnit.Framework.Internal.Commands
{
    /// <summary>
    /// TODO: Documentation needed for class
    /// </summary>
    public class RepeatedTestCommand : DelegatingTestCommand
    {
        private int repeatCount;

        /// <summary>
        /// Initializes a new instance of the <see cref="RepeatedTestCommand"/> class.
        /// TODO: Add a comment about where the repeat count is retrieved.
        /// </summary>
        /// <param name="innerCommand">The inner command.</param>
        public RepeatedTestCommand(TestCommand innerCommand)
            : base(innerCommand)
        {
            this.repeatCount = Test.Properties.GetSetting(PropertyNames.RepeatCount, 1);
        }

        /// <summary>
        /// Runs the test, saving a TestResult in the supplied TestExecutionContext.
        /// </summary>
        /// <param name="context">The context in which the test should run.</param>
        /// <returns>A TestResult</returns>
        public override TestResult Execute(TestExecutionContext context)
        {
            int count = repeatCount;

            while (count-- > 0)
            {
                context.CurrentResult = innerCommand.Execute(context);

                // TODO: We may want to change this so that all iterations are run
                if (context.CurrentResult.ResultState == ResultState.Failure ||
                    context.CurrentResult.ResultState == ResultState.Error ||
                    context.CurrentResult.ResultState == ResultState.Cancelled)
                {
                    break;
                }
            }

            return context.CurrentResult;
        }
    }
}
#endif


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

<title>WebSocketServer</title>
<meta name="date" content="2014-07-23">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.java_websocket.server

Class WebSocketServer

java.lang.Object

org.java_websocket.WebSocketAdapter

org.java_websocket.server.WebSocketServer

All Implemented Interfaces:

java.lang.Runnable, WebSocketListener

Direct Known Subclasses:

ChatServer

public abstract class WebSocketServer
extends WebSocketAdapter
implements java.lang.Runnable

<tt>WebSocketServer</tt> is an abstract class that only takes care of the
 HTTP handshake portion of WebSockets. It's up to a subclass to add
 functionality/purpose to the server.

Nested Class Summary

Nested Classes

Modifier and Type
Class and Description

static interface
WebSocketServer.WebSocketServerFactory

class
WebSocketServer.WebSocketWorker

Field Summary

Fields

Modifier and Type
Field and Description

static int
DECODERS

Constructor Summary

Constructors

Constructor and Description

WebSocketServer()

Creates a WebSocketServer that will attempt to
 listen on port <var>WebSocket.DEFAULT_PORT</var>.

WebSocketServer(java.net.InetSocketAddress address)

Creates a WebSocketServer that will attempt to bind/listen on the given <var>address</var>.

WebSocketServer(java.net.InetSocketAddress address,
               int decoders)

WebSocketServer(java.net.InetSocketAddress address,
               int decodercount,
               java.util.List<Draft> drafts)

WebSocketServer(java.net.InetSocketAddress address,
               int decodercount,
               java.util.List<Draft> drafts,
               java.util.Collection<WebSocket> connectionscontainer)

Creates a WebSocketServer that will attempt to bind/listen on the given <var>address</var>,
 and comply with <tt>Draft</tt> version <var>draft</var>.

WebSocketServer(java.net.InetSocketAddress address,
               java.util.List<Draft> drafts)

Method Summary

Methods

Modifier and Type
Method and Description

protected boolean
addConnection(WebSocket ws)

protected void
allocateBuffers(WebSocket c)

java.util.Collection<WebSocket>
connections()

Returns a WebSocket[] of currently connected clients.

java.nio.ByteBuffer
createBuffer()

java.net.InetSocketAddress
getAddress()

java.util.List<Draft>
getDraft()

protected java.lang.String
getFlashSecurityPolicy()

Gets the XML string that should be returned if a client requests a Flash
 security policy.

java.net.InetSocketAddress
getLocalSocketAddress(WebSocket conn)

int
getPort()

Gets the port number that this server listens on.

java.net.InetSocketAddress
getRemoteSocketAddress(WebSocket conn)

WebSocketFactory
getWebSocketFactory()

abstract void
onClose(WebSocket conn,
       int code,
       java.lang.String reason,
       boolean remote)

Called after the websocket connection has been closed.

void
onCloseInitiated(WebSocket conn,
                int code,
                java.lang.String reason)

void
onClosing(WebSocket conn,
         int code,
         java.lang.String reason,
         boolean remote)

protected boolean
onConnect(java.nio.channels.SelectionKey key)

Returns whether a new connection shall be accepted or not.

 Therefore method is well suited to implement some kind of connection limitation.

abstract void
onError(WebSocket conn,
       java.lang.Exception ex)

Called when errors occurs.

void
onFragment(WebSocket conn,
          Framedata fragment)

void
onMessage(WebSocket conn,
         java.nio.ByteBuffer message)

Callback for binary messages received from the remote host

abstract void
onMessage(WebSocket conn,
         java.lang.String message)

Callback for string messages received from the remote host

abstract void
onOpen(WebSocket conn,
      ClientHandshake handshake)

Called after an opening handshake has been performed and the given websocket is ready to be written on.

void
onWebsocketClose(WebSocket conn,
                int code,
                java.lang.String reason,
                boolean remote)

Called after <tt>WebSocket#close</tt> is explicity called, or when the
 other end of the WebSocket connection is closed.

void
onWebsocketCloseInitiated(WebSocket conn,
                         int code,
                         java.lang.String reason)

send when this peer sends a close handshake

void
onWebsocketClosing(WebSocket conn,
                  int code,
                  java.lang.String reason,
                  boolean remote)

called as soon as no further frames are accepted

void
onWebsocketError(WebSocket conn,
                java.lang.Exception ex)

Called if an exception worth noting occurred.

ServerHandshakeBuilder
onWebsocketHandshakeReceivedAsServer(WebSocket conn,
                                    Draft draft,
                                    ClientHandshake request)

This default implementation does not do anything.

void
onWebsocketMessage(WebSocket conn,
                  java.nio.ByteBuffer blob)

Called when an entire binary frame has been received.

void
onWebsocketMessage(WebSocket conn,
                  java.lang.String message)

Called when an entire text frame has been received.

void
onWebsocketMessageFragment(WebSocket conn,
                          Framedata frame)

Deprecated.

void
onWebsocketOpen(WebSocket conn,
               Handshakedata handshake)

Called after <var>onHandshakeReceived</var> returns <var>true</var>.

void
onWriteDemand(WebSocket w)

This method is used to inform the selector thread that there is data queued to be written to the socket.

protected void
releaseBuffers(WebSocket c)

protected boolean
removeConnection(WebSocket ws)

This method performs remove operations on the connection and therefore also gives control over whether the operation shall be synchronized

void
run()

void
setWebSocketFactory(WebSocketServer.WebSocketServerFactory wsf)

void
start()

Starts the server selectorthread that binds to the currently set port number and
 listeners for WebSocket connection requests.

void
stop()

void
stop(int timeout)

Closes all connected clients sockets, then closes the underlying
 ServerSocketChannel, effectively killing the server socket selectorthread,
 freeing the port the server was bound to and stops all internal workerthreads.

Methods inherited from class org.java_websocket.WebSocketAdapter

getFlashPolicy, onWebsocketHandshakeReceivedAsClient, onWebsocketHandshakeSentAsClient, onWebsocketPing, onWebsocketPong

Methods inherited from class java.lang.Object

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

Field Detail

DECODERS

public static int DECODERS

Constructor Detail

WebSocketServer

public WebSocketServer()
                throws java.net.UnknownHostException

Creates a WebSocketServer that will attempt to
 listen on port <var>WebSocket.DEFAULT_PORT</var>.

Throws:

java.net.UnknownHostException

See Also:

more details here

WebSocketServer

public WebSocketServer(java.net.InetSocketAddress address)

Creates a WebSocketServer that will attempt to bind/listen on the given <var>address</var>.

See Also:

more details here

WebSocketServer

public WebSocketServer(java.net.InetSocketAddress address,
               int decoders)

See Also:

more details here

WebSocketServer

public WebSocketServer(java.net.InetSocketAddress address,
               java.util.List<Draft> drafts)

See Also:

more details here

WebSocketServer

public WebSocketServer(java.net.InetSocketAddress address,
               int decodercount,
               java.util.List<Draft> drafts)

See Also:

more details here

WebSocketServer

public WebSocketServer(java.net.InetSocketAddress address,
               int decodercount,
               java.util.List<Draft> drafts,
               java.util.Collection<WebSocket> connectionscontainer)

Creates a WebSocketServer that will attempt to bind/listen on the given <var>address</var>,
 and comply with <tt>Draft</tt> version <var>draft</var>.

Parameters:

address - The address (host:port) this server should listen on.

decodercount - The number of WebSocketServer.WebSocketWorkers that will be used to process the incoming network data. By default this will be Runtime.getRuntime().availableProcessors()

drafts - The versions of the WebSocket protocol that this server
            instance should comply to. Clients that use an other protocol version will be rejected.

connectionscontainer - Allows to specify a collection that will be used to store the websockets in.

            If you plan to often iterate through the currently connected websockets you may want to use a collection that does not require synchronization like a CopyOnWriteArraySet. In that case make sure that you overload removeConnection(WebSocket) and addConnection(WebSocket).

            By default a HashSet will be used.

See Also:

for more control over syncronized operation,
 more about drafts

Method Detail

start

public void start()

Starts the server selectorthread that binds to the currently set port number and
 listeners for WebSocket connection requests. Creates a fixed thread pool with the size DECODERS

 May only be called once.

 Alternatively you can call run() directly.

Throws:

java.lang.IllegalStateException

stop

public void stop(int timeout)
          throws java.lang.InterruptedException

Closes all connected clients sockets, then closes the underlying
 ServerSocketChannel, effectively killing the server socket selectorthread,
 freeing the port the server was bound to and stops all internal workerthreads.

 If this method is called before the server is started it will never start.

Parameters:

timeout - Specifies how many milliseconds the overall close handshaking may take altogether before the connections are closed without proper close handshaking.

Throws:

java.io.IOException - When ServerSocketChannel.close throws an IOException

java.lang.InterruptedException

stop

public void stop()
          throws java.io.IOException,
                 java.lang.InterruptedException

Throws:

java.io.IOException

java.lang.InterruptedException

connections

public java.util.Collection<WebSocket> connections()

Returns a WebSocket[] of currently connected clients.
 Its iterators will be failfast and its not judicious
 to modify it.

Returns:

The currently connected clients.

getAddress

public java.net.InetSocketAddress getAddress()

getPort

public int getPort()

Gets the port number that this server listens on.

Returns:

The port number.

getDraft

public java.util.List<Draft> getDraft()

run

public void run()

Specified by:

run in interface java.lang.Runnable

allocateBuffers

protected void allocateBuffers(WebSocket c)
                        throws java.lang.InterruptedException

Throws:

java.lang.InterruptedException

releaseBuffers

protected void releaseBuffers(WebSocket c)
                       throws java.lang.InterruptedException

Throws:

java.lang.InterruptedException

createBuffer

public java.nio.ByteBuffer createBuffer()

getFlashSecurityPolicy

protected java.lang.String getFlashSecurityPolicy()

Gets the XML string that should be returned if a client requests a Flash
 security policy.

 The default implementation allows access from all remote domains, but
 only on the port that this WebSocketServer is listening on.

 This is specifically implemented for gitime's WebSocket client for Flash:
 http://github.com/gimite/web-socket-js

Returns:

An XML String that comforms to Flash's security policy. You MUST
         not include the null char at the end, it is appended automatically.

onWebsocketMessage

public final void onWebsocketMessage(WebSocket conn,
                      java.lang.String message)

Description copied from interface: WebSocketListener

Called when an entire text frame has been received. Do whatever you want
 here...

Specified by:

onWebsocketMessage in interface WebSocketListener

Parameters:

conn - The <tt>WebSocket</tt> instance this event is occurring on.

message - The UTF-8 decoded message that was received.

onWebsocketMessageFragment

@Deprecated
public void onWebsocketMessageFragment(WebSocket conn,
                                         Framedata frame)

Deprecated.

Description copied from class: WebSocketAdapter

This default implementation does not do anything. Go ahead and overwrite it

Specified by:

onWebsocketMessageFragment in interface WebSocketListener

Overrides:

onWebsocketMessageFragment in class WebSocketAdapter

See Also:

WebSocketListener.onWebsocketMessageFragment(WebSocket, Framedata)

onWebsocketMessage

public final void onWebsocketMessage(WebSocket conn,
                      java.nio.ByteBuffer blob)

Description copied from interface: WebSocketListener

Called when an entire binary frame has been received. Do whatever you want
 here...

Specified by:

onWebsocketMessage in interface WebSocketListener

Parameters:

conn - The <tt>WebSocket</tt> instance this event is occurring on.

blob - The binary message that was received.

onWebsocketOpen

public final void onWebsocketOpen(WebSocket conn,
                   Handshakedata handshake)

Description copied from interface: WebSocketListener

Called after <var>onHandshakeReceived</var> returns <var>true</var>.
 Indicates that a complete WebSocket connection has been established,
 and we are ready to send/receive data.

Specified by:

onWebsocketOpen in interface WebSocketListener

Parameters:

conn - The <tt>WebSocket</tt> instance this event is occuring on.

onWebsocketClose

public final void onWebsocketClose(WebSocket conn,
                    int code,
                    java.lang.String reason,
                    boolean remote)

Description copied from interface: WebSocketListener

Called after <tt>WebSocket#close</tt> is explicity called, or when the
 other end of the WebSocket connection is closed.

Specified by:

onWebsocketClose in interface WebSocketListener

removeConnection

protected boolean removeConnection(WebSocket ws)

This method performs remove operations on the connection and therefore also gives control over whether the operation shall be synchronized

 WebSocketServer(InetSocketAddress, int, List, Collection) allows to specify a collection which will be used to store current connections in.

 Depending on the type on the connection, modifications of that collection may have to be synchronized.

onWebsocketHandshakeReceivedAsServer

public ServerHandshakeBuilder onWebsocketHandshakeReceivedAsServer(WebSocket conn,
                                                          Draft draft,
                                                          ClientHandshake request)
                                                            throws InvalidDataException

Description copied from class: WebSocketAdapter

This default implementation does not do anything. Go ahead and overwrite it.

Specified by:

onWebsocketHandshakeReceivedAsServer in interface WebSocketListener

Overrides:

onWebsocketHandshakeReceivedAsServer in class WebSocketAdapter

Parameters:

conn - The WebSocket related to this event

draft - The protocol draft the client uses to connect

request - The opening http message send by the client. Can be used to access additional fields like cookies.

Returns:

Returns an incomplete handshake containing all optional fields

Throws:

InvalidDataException - Throwing this exception will cause this handshake to be rejected

See Also:

WebSocketListener.onWebsocketHandshakeReceivedAsServer(WebSocket, Draft, ClientHandshake)

addConnection

protected boolean addConnection(WebSocket ws)

See Also:

removeConnection(WebSocket)

onWebsocketError

public final void onWebsocketError(WebSocket conn,
                    java.lang.Exception ex)

Description copied from interface: WebSocketListener

Called if an exception worth noting occurred.
 If an error causes the connection to fail onClose will be called additionally afterwards.

Specified by:

onWebsocketError in interface WebSocketListener

Parameters:

conn - may be null if the error does not belong to a single connection

ex - The exception that occurred.

            Might be null if the exception is not related to any specific connection. For example if the server port could not be bound.

onWriteDemand

public final void onWriteDemand(WebSocket w)

Description copied from interface: WebSocketListener

This method is used to inform the selector thread that there is data queued to be written to the socket.

Specified by:

onWriteDemand in interface WebSocketListener

onWebsocketCloseInitiated

public void onWebsocketCloseInitiated(WebSocket conn,
                             int code,
                             java.lang.String reason)

Description copied from interface: WebSocketListener

send when this peer sends a close handshake

Specified by:

onWebsocketCloseInitiated in interface WebSocketListener

onWebsocketClosing

public void onWebsocketClosing(WebSocket conn,
                      int code,
                      java.lang.String reason,
                      boolean remote)

Description copied from interface: WebSocketListener

called as soon as no further frames are accepted

Specified by:

onWebsocketClosing in interface WebSocketListener

onCloseInitiated

public void onCloseInitiated(WebSocket conn,
                    int code,
                    java.lang.String reason)

onClosing

public void onClosing(WebSocket conn,
             int code,
             java.lang.String reason,
             boolean remote)

setWebSocketFactory

public final void setWebSocketFactory(WebSocketServer.WebSocketServerFactory wsf)

getWebSocketFactory

public final WebSocketFactory getWebSocketFactory()

onConnect

protected boolean onConnect(java.nio.channels.SelectionKey key)

Returns whether a new connection shall be accepted or not.

 Therefore method is well suited to implement some kind of connection limitation.

See Also:

#onOpen(WebSocket, ClientHandshake)}, {@link #onWebsocketHandshakeReceivedAsServer(WebSocket, Draft, ClientHandshake)}

getLocalSocketAddress

public java.net.InetSocketAddress getLocalSocketAddress(WebSocket conn)

Specified by:

getLocalSocketAddress in interface WebSocketListener

getRemoteSocketAddress

public java.net.InetSocketAddress getRemoteSocketAddress(WebSocket conn)

Specified by:

getRemoteSocketAddress in interface WebSocketListener

onOpen

public abstract void onOpen(WebSocket conn,
          ClientHandshake handshake)

Called after an opening handshake has been performed and the given websocket is ready to be written on.

onClose

public abstract void onClose(WebSocket conn,
           int code,
           java.lang.String reason,
           boolean remote)

Called after the websocket connection has been closed.

Parameters:

code - The codes can be looked up here: CloseFrame

reason - Additional information string

remote - Returns whether or not the closing of the connection was initiated by the remote host.

onMessage

public abstract void onMessage(WebSocket conn,
             java.lang.String message)

Callback for string messages received from the remote host

See Also:

onMessage(WebSocket, ByteBuffer)

onError

public abstract void onError(WebSocket conn,
           java.lang.Exception ex)

Called when errors occurs. If an error causes the websocket connection to fail onClose(WebSocket, int, String, boolean) will be called additionally.

 This method will be called primarily because of IO or protocol errors.

 If the given exception is an RuntimeException that probably means that you encountered a bug.

Parameters:

con - Can be null if there error does not belong to one specific websocket. For example if the servers port could not be bound.

onMessage

public void onMessage(WebSocket conn,
             java.nio.ByteBuffer message)

Callback for binary messages received from the remote host

See Also:

onMessage(WebSocket, String)

onFragment

public void onFragment(WebSocket conn,
              Framedata fragment)

See Also:

WebSocket.sendFragmentedFrame(org.java_websocket.framing.Framedata.Opcode, ByteBuffer, boolean)

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
import { SecurityContext } from '@angular/core';
export var MockSchemaRegistry = (function () {
    function MockSchemaRegistry(existingProperties, attrPropMapping, existingElements, invalidProperties, invalidAttributes) {
        this.existingProperties = existingProperties;
        this.attrPropMapping = attrPropMapping;
        this.existingElements = existingElements;
        this.invalidProperties = invalidProperties;
        this.invalidAttributes = invalidAttributes;
    }
    MockSchemaRegistry.prototype.hasProperty = function (tagName, property, schemas) {
        var value = this.existingProperties[property];
        return value === void 0 ? true : value;
    };
    MockSchemaRegistry.prototype.hasElement = function (tagName, schemaMetas) {
        var value = this.existingElements[tagName.toLowerCase()];
        return value === void 0 ? true : value;
    };
    MockSchemaRegistry.prototype.securityContext = function (tagName, property) {
        return SecurityContext.NONE;
    };
    MockSchemaRegistry.prototype.getMappedPropName = function (attrName) { return this.attrPropMapping[attrName] || attrName; };
    MockSchemaRegistry.prototype.getDefaultComponentElementName = function () { return 'ng-component'; };
    MockSchemaRegistry.prototype.validateProperty = function (name) {
        if (this.invalidProperties.indexOf(name) > -1) {
            return { error: true, msg: "Binding to property '" + name + "' is disallowed for security reasons" };
        }
        else {
            return { error: false };
        }
    };
    MockSchemaRegistry.prototype.validateAttribute = function (name) {
        if (this.invalidAttributes.indexOf(name) > -1) {
            return {
                error: true,
                msg: "Binding to attribute '" + name + "' is disallowed for security reasons"
            };
        }
        else {
            return { error: false };
        }
    };
    return MockSchemaRegistry;
}());
//# sourceMappingURL=schema_registry_mock.js.map