text:
package admin // import "google.golang.org/api/admin/datatransfer/v1"

import (
	"bytes"
	"encoding/json"
	"errors"
	"fmt"
	context "golang.org/x/net/context"
	ctxhttp "golang.org/x/net/context/ctxhttp"
	gensupport "google.golang.org/api/gensupport"
	googleapi "google.golang.org/api/googleapi"
	"io"
	"net/http"
	"net/url"
	"strconv"
	"strings"
)

// Always reference these packages, just in case the auto-generated code
// below doesn't.
var _ = bytes.NewBuffer
var _ = strconv.Itoa
var _ = fmt.Sprintf
var _ = json.NewDecoder
var _ = io.Copy
var _ = url.Parse
var _ = gensupport.MarshalJSON
var _ = googleapi.Version
var _ = errors.New
var _ = strings.Replace
var _ = context.Canceled
var _ = ctxhttp.Do

const apiId = "admin:datatransfer_v1"
const apiName = "admin"
const apiVersion = "datatransfer_v1"
const basePath = "https://www.googleapis.com/admin/datatransfer/v1/"

// OAuth2 scopes used by this API.
const (
	// View and manage data transfers between users in your organization
	AdminDatatransferScope = "https://www.googleapis.com/auth/admin.datatransfer"

	// View data transfers between users in your organization
	AdminDatatransferReadonlyScope = "https://www.googleapis.com/auth/admin.datatransfer.readonly"
)

func New(client *http.Client) (*Service, error) {
	if client == nil {
		return nil, errors.New("client is nil")
	}
	s := &Service{client: client, BasePath: basePath}
	s.Applications = NewApplicationsService(s)
	s.Transfers = NewTransfersService(s)
	return s, nil
}

type Service struct {
	client                    *http.Client
	BasePath                  string // API endpoint base URL
	UserAgent                 string // optional additional User-Agent fragment
	GoogleClientHeaderElement string // client header fragment, for Google use only

	Applications *ApplicationsService

	Transfers *TransfersService
}

func (s *Service) userAgent() string {
	if s.UserAgent == "" {
		return googleapi.UserAgent
	}
	return googleapi.UserAgent + " " + s.UserAgent
}

func (s *Service) clientHeader() string {
	return gensupport.GoogleClientHeader("20170210", s.GoogleClientHeaderElement)
}

func NewApplicationsService(s *Service) *ApplicationsService {
	rs := &ApplicationsService{s: s}
	return rs
}

type ApplicationsService struct {
	s *Service
}

func NewTransfersService(s *Service) *TransfersService {
	rs := &TransfersService{s: s}
	return rs
}

type TransfersService struct {
	s *Service
}

// Application: The JSON template for an Application resource.
type Application struct {
	// Etag: Etag of the resource.
	Etag string `json:"etag,omitempty"`

	// Id: The application's ID.
	Id int64 `json:"id,omitempty,string"`

	// Kind: Identifies the resource as a DataTransfer Application Resource.
	Kind string `json:"kind,omitempty"`

	// Name: The application's name.
	Name string `json:"name,omitempty"`

	// TransferParams: The list of all possible transfer parameters for this
	// application. These parameters can be used to select the data of the
	// user in this application to be transfered.
	TransferParams []*ApplicationTransferParam `json:"transferParams,omitempty"`

	// ServerResponse contains the HTTP response code and headers from the
	// server.
	googleapi.ServerResponse `json:"-"`

	// ForceSendFields is a list of field names (e.g. "Etag") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "Etag") to include in API
	// requests with the JSON null value. By default, fields with empty
	// values are omitted from API requests. However, any field with an
	// empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

func (s *Application) MarshalJSON() ([]byte, error) {
	type noMethod Application
	raw := noMethod(*s)
	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}

// ApplicationDataTransfer: Template to map fields of
// ApplicationDataTransfer resource.
type ApplicationDataTransfer struct {
	// ApplicationId: The application's ID.
	ApplicationId int64 `json:"applicationId,omitempty,string"`

	// ApplicationTransferParams: The transfer parameters for the
	// application. These parameters are used to select the data which will
	// get transfered in context of this application.
	ApplicationTransferParams []*ApplicationTransferParam `json:"applicationTransferParams,omitempty"`

	// ApplicationTransferStatus: Current status of transfer for this
	// application. (Read-only)
	ApplicationTransferStatus string `json:"applicationTransferStatus,omitempty"`

	// ForceSendFields is a list of field names (e.g. "ApplicationId") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "ApplicationId") to include
	// in API requests with the JSON null value. By default, fields with
	// empty values are omitted from API requests. However, any field with
	// an empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

func (s *ApplicationDataTransfer) MarshalJSON() ([]byte, error) {
	type noMethod ApplicationDataTransfer
	raw := noMethod(*s)
	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}

// ApplicationTransferParam: Template for application transfer
// parameters.
type ApplicationTransferParam struct {
	// Key: The type of the transfer parameter. eg: 'PRIVACY_LEVEL'
	Key string `json:"key,omitempty"`

	// Value: The value of the coressponding transfer parameter. eg:
	// 'PRIVATE' or 'SHARED'
	Value []string `json:"value,omitempty"`

	// ForceSendFields is a list of field names (e.g. "Key") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "Key") to include in API
	// requests with the JSON null value. By default, fields with empty
	// values are omitted from API requests. However, any field with an
	// empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

func (s *ApplicationTransferParam) MarshalJSON() ([]byte, error) {
	type noMethod ApplicationTransferParam
	raw := noMethod(*s)
	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}

// ApplicationsListResponse: Template for a collection of Applications.
type ApplicationsListResponse struct {
	// Applications: List of applications that support data transfer and are
	// also installed for the customer.
	Applications []*Application `json:"applications,omitempty"`

	// Etag: ETag of the resource.
	Etag string `json:"etag,omitempty"`

	// Kind: Identifies the resource as a collection of Applications.
	Kind string `json:"kind,omitempty"`

	// NextPageToken: Continuation token which will be used to specify next
	// page in list API.
	NextPageToken string `json:"nextPageToken,omitempty"`

	// ServerResponse contains the HTTP response code and headers from the
	// server.
	googleapi.ServerResponse `json:"-"`

	// ForceSendFields is a list of field names (e.g. "Applications") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "Applications") to include
	// in API requests with the JSON null value. By default, fields with
	// empty values are omitted from API requests. However, any field with
	// an empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

func (s *ApplicationsListResponse) MarshalJSON() ([]byte, error) {
	type noMethod ApplicationsListResponse
	raw := noMethod(*s)
	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}

// DataTransfer: The JSON template for a DataTransfer resource.
type DataTransfer struct {
	// ApplicationDataTransfers: List of per application data transfer
	// resources. It contains data transfer details of the applications
	// associated with this transfer resource. Note that this list is also
	// used to specify the applications for which data transfer has to be
	// done at the time of the transfer resource creation.
	ApplicationDataTransfers []*ApplicationDataTransfer `json:"applicationDataTransfers,omitempty"`

	// Etag: ETag of the resource.
	Etag string `json:"etag,omitempty"`

	// Id: The transfer's ID (Read-only).
	Id string `json:"id,omitempty"`

	// Kind: Identifies the resource as a DataTransfer request.
	Kind string `json:"kind,omitempty"`

	// NewOwnerUserId: ID of the user to whom the data is being transfered.
	NewOwnerUserId string `json:"newOwnerUserId,omitempty"`

	// OldOwnerUserId: ID of the user whose data is being transfered.
	OldOwnerUserId string `json:"oldOwnerUserId,omitempty"`

	// OverallTransferStatusCode: Overall transfer status (Read-only).
	OverallTransferStatusCode string `json:"overallTransferStatusCode,omitempty"`

	// RequestTime: The time at which the data transfer was requested
	// (Read-only).
	RequestTime string `json:"requestTime,omitempty"`

	// ServerResponse contains the HTTP response code and headers from the
	// server.
	googleapi.ServerResponse `json:"-"`

	// ForceSendFields is a list of field names (e.g.
	// "ApplicationDataTransfers") to unconditionally include in API
	// requests. By default, fields with empty values are omitted from API
	// requests. However, any non-pointer, non-interface field appearing in
	// ForceSendFields will be sent to the server regardless of whether the
	// field is empty or not. This may be used to include empty fields in
	// Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "ApplicationDataTransfers")
	// to include in API requests with the JSON null value. By default,
	// fields with empty values are omitted from API requests. However, any
	// field with an empty value appearing in NullFields will be sent to the
	// server as null. It is an error if a field in this list has a
	// non-empty value. This may be used to include null fields in Patch
	// requests.
	NullFields []string `json:"-"`
}

func (s *DataTransfer) MarshalJSON() ([]byte, error) {
	type noMethod DataTransfer
	raw := noMethod(*s)
	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}

// DataTransfersListResponse: Template for a collection of DataTransfer
// resources.
type DataTransfersListResponse struct {
	// DataTransfers: List of data transfer requests.
	DataTransfers []*DataTransfer `json:"dataTransfers,omitempty"`

	// Etag: ETag of the resource.
	Etag string `json:"etag,omitempty"`

	// Kind: Identifies the resource as a collection of data transfer
	// requests.
	Kind string `json:"kind,omitempty"`

	// NextPageToken: Continuation token which will be used to specify next
	// page in list API.
	NextPageToken string `json:"nextPageToken,omitempty"`

	// ServerResponse contains the HTTP response code and headers from the
	// server.
	googleapi.ServerResponse `json:"-"`

	// ForceSendFields is a list of field names (e.g. "DataTransfers") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "DataTransfers") to include
	// in API requests with the JSON null value. By default, fields with
	// empty values are omitted from API requests. However, any field with
	// an empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

func (s *DataTransfersListResponse) MarshalJSON() ([]byte, error) {
	type noMethod DataTransfersListResponse
	raw := noMethod(*s)
	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}

// method id "datatransfer.applications.get":

type ApplicationsGetCall struct {
	s             *Service
	applicationId int64
	urlParams_    gensupport.URLParams
	ifNoneMatch_  string
	ctx_          context.Context
	header_       http.Header
}

// Get: Retrieves information about an application for the given
// application ID.
func (r *ApplicationsService) Get(applicationId int64) *ApplicationsGetCall {
	c := &ApplicationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
	c.applicationId = applicationId
	return c
}

// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *ApplicationsGetCall) Fields(s ...googleapi.Field) *ApplicationsGetCall {
	c.urlParams_.Set("fields", googleapi.CombineFields(s))
	return c
}

// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *ApplicationsGetCall) IfNoneMatch(entityTag string) *ApplicationsGetCall {
	c.ifNoneMatch_ = entityTag
	return c
}

// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *ApplicationsGetCall) Context(ctx context.Context) *ApplicationsGetCall {
	c.ctx_ = ctx
	return c
}

// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *ApplicationsGetCall) Header() http.Header {
	if c.header_ == nil {
		c.header_ = make(http.Header)
	}
	return c.header_
}

func (c *ApplicationsGetCall) doRequest(alt string) (*http.Response, error) {
	reqHeaders := make(http.Header)
	for k, v := range c.header_ {
		reqHeaders[k] = v
	}
	reqHeaders.Set("User-Agent", c.s.userAgent())
	reqHeaders.Set("x-goog-api-client", c.s.clientHeader())
	if c.ifNoneMatch_ != "" {
		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
	}
	var body io.Reader = nil
	c.urlParams_.Set("alt", alt)
	urls := googleapi.ResolveRelative(c.s.BasePath, "applications/{applicationId}")
	urls += "?" + c.urlParams_.Encode()
	req, _ := http.NewRequest("GET", urls, body)
	req.Header = reqHeaders
	googleapi.Expand(req.URL, map[string]string{
		"applicationId": strconv.FormatInt(c.applicationId, 10),
	})
	return gensupport.SendRequest(c.ctx_, c.s.client, req)
}

// Do executes the "datatransfer.applications.get" call.
// Exactly one of *Application or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *Application.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *ApplicationsGetCall) Do(opts ...googleapi.CallOption) (*Application, error) {
	gensupport.SetOptions(c.urlParams_, opts...)
	res, err := c.doRequest("json")
	if res != nil && res.StatusCode == http.StatusNotModified {
		if res.Body != nil {
			res.Body.Close()
		}
		return nil, &googleapi.Error{
			Code:   res.StatusCode,
			Header: res.Header,
		}
	}
	if err != nil {
		return nil, err
	}
	defer googleapi.CloseBody(res)
	if err := googleapi.CheckResponse(res); err != nil {
		return nil, err
	}
	ret := &Application{
		ServerResponse: googleapi.ServerResponse{
			Header:         res.Header,
			HTTPStatusCode: res.StatusCode,
		},
	}
	target := &ret
	if err := json.NewDecoder(res.Body).Decode(target); err != nil {
		return nil, err
	}
	return ret, nil
	// {
	//   "description": "Retrieves information about an application for the given application ID.",
	//   "httpMethod": "GET",
	//   "id": "datatransfer.applications.get",
	//   "parameterOrder": [
	//     "applicationId"
	//   ],
	//   "parameters": {
	//     "applicationId": {
	//       "description": "ID of the application resource to be retrieved.",
	//       "format": "int64",
	//       "location": "path",
	//       "required": true,
	//       "type": "string"
	//     }
	//   },
	//   "path": "applications/{applicationId}",
	//   "response": {
	//     "$ref": "Application"
	//   },
	//   "scopes": [
	//     "https://www.googleapis.com/auth/admin.datatransfer",
	//     "https://www.googleapis.com/auth/admin.datatransfer.readonly"
	//   ]
	// }

}

// method id "datatransfer.applications.list":

type ApplicationsListCall struct {
	s            *Service
	urlParams_   gensupport.URLParams
	ifNoneMatch_ string
	ctx_         context.Context
	header_      http.Header
}

// List: Lists the applications available for data transfer for a
// customer.
func (r *ApplicationsService) List() *ApplicationsListCall {
	c := &ApplicationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
	return c
}

// CustomerId sets the optional parameter "customerId": Immutable ID of
// the Google Apps account.
func (c *ApplicationsListCall) CustomerId(customerId string) *ApplicationsListCall {
	c.urlParams_.Set("customerId", customerId)
	return c
}

// MaxResults sets the optional parameter "maxResults": Maximum number
// of results to return. Default is 100.
func (c *ApplicationsListCall) MaxResults(maxResults int64) *ApplicationsListCall {
	c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
	return c
}

// PageToken sets the optional parameter "pageToken": Token to specify
// next page in the list.
func (c *ApplicationsListCall) PageToken(pageToken string) *ApplicationsListCall {
	c.urlParams_.Set("pageToken", pageToken)
	return c
}

// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *ApplicationsListCall) Fields(s ...googleapi.Field) *ApplicationsListCall {
	c.urlParams_.Set("fields", googleapi.CombineFields(s))
	return c
}

// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *ApplicationsListCall) IfNoneMatch(entityTag string) *ApplicationsListCall {
	c.ifNoneMatch_ = entityTag
	return c
}

// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *ApplicationsListCall) Context(ctx context.Context) *ApplicationsListCall {
	c.ctx_ = ctx
	return c
}

// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *ApplicationsListCall) Header() http.Header {
	if c.header_ == nil {
		c.header_ = make(http.Header)
	}
	return c.header_
}

func (c *ApplicationsListCall) doRequest(alt string) (*http.Response, error) {
	reqHeaders := make(http.Header)
	for k, v := range c.header_ {
		reqHeaders[k] = v
	}
	reqHeaders.Set("User-Agent", c.s.userAgent())
	reqHeaders.Set("x-goog-api-client", c.s.clientHeader())
	if c.ifNoneMatch_ != "" {
		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
	}
	var body io.Reader = nil
	c.urlParams_.Set("alt", alt)
	urls := googleapi.ResolveRelative(c.s.BasePath, "applications")
	urls += "?" + c.urlParams_.Encode()
	req, _ := http.NewRequest("GET", urls, body)
	req.Header = reqHeaders
	return gensupport.SendRequest(c.ctx_, c.s.client, req)
}

// Do executes the "datatransfer.applications.list" call.
// Exactly one of *ApplicationsListResponse or error will be non-nil.
// Any non-2xx status code is an error. Response headers are in either
// *ApplicationsListResponse.ServerResponse.Header or (if a response was
// returned at all) in error.(*googleapi.Error).Header. Use
// googleapi.IsNotModified to check whether the returned error was
// because http.StatusNotModified was returned.
func (c *ApplicationsListCall) Do(opts ...googleapi.CallOption) (*ApplicationsListResponse, error) {
	gensupport.SetOptions(c.urlParams_, opts...)
	res, err := c.doRequest("json")
	if res != nil && res.StatusCode == http.StatusNotModified {
		if res.Body != nil {
			res.Body.Close()
		}
		return nil, &googleapi.Error{
			Code:   res.StatusCode,
			Header: res.Header,
		}
	}
	if err != nil {
		return nil, err
	}
	defer googleapi.CloseBody(res)
	if err := googleapi.CheckResponse(res); err != nil {
		return nil, err
	}
	ret := &ApplicationsListResponse{
		ServerResponse: googleapi.ServerResponse{
			Header:         res.Header,
			HTTPStatusCode: res.StatusCode,
		},
	}
	target := &ret
	if err := json.NewDecoder(res.Body).Decode(target); err != nil {
		return nil, err
	}
	return ret, nil
	// {
	//   "description": "Lists the applications available for data transfer for a customer.",
	//   "httpMethod": "GET",
	//   "id": "datatransfer.applications.list",
	//   "parameters": {
	//     "customerId": {
	//       "description": "Immutable ID of the Google Apps account.",
	//       "location": "query",
	//       "type": "string"
	//     },
	//     "maxResults": {
	//       "description": "Maximum number of results to return. Default is 100.",
	//       "format": "int32",
	//       "location": "query",
	//       "maximum": "500",
	//       "minimum": "1",
	//       "type": "integer"
	//     },
	//     "pageToken": {
	//       "description": "Token to specify next page in the list.",
	//       "location": "query",
	//       "type": "string"
	//     }
	//   },
	//   "path": "applications",
	//   "response": {
	//     "$ref": "ApplicationsListResponse"
	//   },
	//   "scopes": [
	//     "https://www.googleapis.com/auth/admin.datatransfer",
	//     "https://www.googleapis.com/auth/admin.datatransfer.readonly"
	//   ]
	// }

}

// Pages invokes f for each page of results.
// A non-nil error returned from f will halt the iteration.
// The provided context supersedes any context provided to the Context method.
func (c *ApplicationsListCall) Pages(ctx context.Context, f func(*ApplicationsListResponse) error) error {
	c.ctx_ = ctx
	defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
	for {
		x, err := c.Do()
		if err != nil {
			return err
		}
		if err := f(x); err != nil {
			return err
		}
		if x.NextPageToken == "" {
			return nil
		}
		c.PageToken(x.NextPageToken)
	}
}

// method id "datatransfer.transfers.get":

type TransfersGetCall struct {
	s              *Service
	dataTransferId string
	urlParams_     gensupport.URLParams
	ifNoneMatch_   string
	ctx_           context.Context
	header_        http.Header
}

// Get: Retrieves a data transfer request by its resource ID.
func (r *TransfersService) Get(dataTransferId string) *TransfersGetCall {
	c := &TransfersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
	c.dataTransferId = dataTransferId
	return c
}

// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *TransfersGetCall) Fields(s ...googleapi.Field) *TransfersGetCall {
	c.urlParams_.Set("fields", googleapi.CombineFields(s))
	return c
}

// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *TransfersGetCall) IfNoneMatch(entityTag string) *TransfersGetCall {
	c.ifNoneMatch_ = entityTag
	return c
}

// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *TransfersGetCall) Context(ctx context.Context) *TransfersGetCall {
	c.ctx_ = ctx
	return c
}

// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *TransfersGetCall) Header() http.Header {
	if c.header_ == nil {
		c.header_ = make(http.Header)
	}
	return c.header_
}

func (c *TransfersGetCall) doRequest(alt string) (*http.Response, error) {
	reqHeaders := make(http.Header)
	for k, v := range c.header_ {
		reqHeaders[k] = v
	}
	reqHeaders.Set("User-Agent", c.s.userAgent())
	reqHeaders.Set("x-goog-api-client", c.s.clientHeader())
	if c.ifNoneMatch_ != "" {
		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
	}
	var body io.Reader = nil
	c.urlParams_.Set("alt", alt)
	urls := googleapi.ResolveRelative(c.s.BasePath, "transfers/{dataTransferId}")
	urls += "?" + c.urlParams_.Encode()
	req, _ := http.NewRequest("GET", urls, body)
	req.Header = reqHeaders
	googleapi.Expand(req.URL, map[string]string{
		"dataTransferId": c.dataTransferId,
	})
	return gensupport.SendRequest(c.ctx_, c.s.client, req)
}

// Do executes the "datatransfer.transfers.get" call.
// Exactly one of *DataTransfer or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *DataTransfer.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *TransfersGetCall) Do(opts ...googleapi.CallOption) (*DataTransfer, error) {
	gensupport.SetOptions(c.urlParams_, opts...)
	res, err := c.doRequest("json")
	if res != nil && res.StatusCode == http.StatusNotModified {
		if res.Body != nil {
			res.Body.Close()
		}
		return nil, &googleapi.Error{
			Code:   res.StatusCode,
			Header: res.Header,
		}
	}
	if err != nil {
		return nil, err
	}
	defer googleapi.CloseBody(res)
	if err := googleapi.CheckResponse(res); err != nil {
		return nil, err
	}
	ret := &DataTransfer{
		ServerResponse: googleapi.ServerResponse{
			Header:         res.Header,
			HTTPStatusCode: res.StatusCode,
		},
	}
	target := &ret
	if err := json.NewDecoder(res.Body).Decode(target); err != nil {
		return nil, err
	}
	return ret, nil
	// {
	//   "description": "Retrieves a data transfer request by its resource ID.",
	//   "httpMethod": "GET",
	//   "id": "datatransfer.transfers.get",
	//   "parameterOrder": [
	//     "dataTransferId"
	//   ],
	//   "parameters": {
	//     "dataTransferId": {
	//       "description": "ID of the resource to be retrieved. This is returned in the response from the insert method.",
	//       "location": "path",
	//       "required": true,
	//       "type": "string"
	//     }
	//   },
	//   "path": "transfers/{dataTransferId}",
	//   "response": {
	//     "$ref": "DataTransfer"
	//   },
	//   "scopes": [
	//     "https://www.googleapis.com/auth/admin.datatransfer",
	//     "https://www.googleapis.com/auth/admin.datatransfer.readonly"
	//   ]
	// }

}

// method id "datatransfer.transfers.insert":

type TransfersInsertCall struct {
	s            *Service
	datatransfer *DataTransfer
	urlParams_   gensupport.URLParams
	ctx_         context.Context
	header_      http.Header
}

// Insert: Inserts a data transfer request.
func (r *TransfersService) Insert(datatransfer *DataTransfer) *TransfersInsertCall {
	c := &TransfersInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
	c.datatransfer = datatransfer
	return c
}

// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *TransfersInsertCall) Fields(s ...googleapi.Field) *TransfersInsertCall {
	c.urlParams_.Set("fields", googleapi.CombineFields(s))
	return c
}

// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *TransfersInsertCall) Context(ctx context.Context) *TransfersInsertCall {
	c.ctx_ = ctx
	return c
}

// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *TransfersInsertCall) Header() http.Header {
	if c.header_ == nil {
		c.header_ = make(http.Header)
	}
	return c.header_
}

func (c *TransfersInsertCall) doRequest(alt string) (*http.Response, error) {
	reqHeaders := make(http.Header)
	for k, v := range c.header_ {
		reqHeaders[k] = v
	}
	reqHeaders.Set("User-Agent", c.s.userAgent())
	reqHeaders.Set("x-goog-api-client", c.s.clientHeader())
	var body io.Reader = nil
	body, err := googleapi.WithoutDataWrapper.JSONReader(c.datatransfer)
	if err != nil {
		return nil, err
	}
	reqHeaders.Set("Content-Type", "application/json")
	c.urlParams_.Set("alt", alt)
	urls := googleapi.ResolveRelative(c.s.BasePath, "transfers")
	urls += "?" + c.urlParams_.Encode()
	req, _ := http.NewRequest("POST", urls, body)
	req.Header = reqHeaders
	return gensupport.SendRequest(c.ctx_, c.s.client, req)
}

// Do executes the "datatransfer.transfers.insert" call.
// Exactly one of *DataTransfer or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *DataTransfer.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *TransfersInsertCall) Do(opts ...googleapi.CallOption) (*DataTransfer, error) {
	gensupport.SetOptions(c.urlParams_, opts...)
	res, err := c.doRequest("json")
	if res != nil && res.StatusCode == http.StatusNotModified {
		if res.Body != nil {
			res.Body.Close()
		}
		return nil, &googleapi.Error{
			Code:   res.StatusCode,
			Header: res.Header,
		}
	}
	if err != nil {
		return nil, err
	}
	defer googleapi.CloseBody(res)
	if err := googleapi.CheckResponse(res); err != nil {
		return nil, err
	}
	ret := &DataTransfer{
		ServerResponse: googleapi.ServerResponse{
			Header:         res.Header,
			HTTPStatusCode: res.StatusCode,
		},
	}
	target := &ret
	if err := json.NewDecoder(res.Body).Decode(target); err != nil {
		return nil, err
	}
	return ret, nil
	// {
	//   "description": "Inserts a data transfer request.",
	//   "httpMethod": "POST",
	//   "id": "datatransfer.transfers.insert",
	//   "path": "transfers",
	//   "request": {
	//     "$ref": "DataTransfer"
	//   },
	//   "response": {
	//     "$ref": "DataTransfer"
	//   },
	//   "scopes": [
	//     "https://www.googleapis.com/auth/admin.datatransfer"
	//   ]
	// }

}

// method id "datatransfer.transfers.list":

type TransfersListCall struct {
	s            *Service
	urlParams_   gensupport.URLParams
	ifNoneMatch_ string
	ctx_         context.Context
	header_      http.Header
}

// List: Lists the transfers for a customer by source user, destination
// user, or status.
func (r *TransfersService) List() *TransfersListCall {
	c := &TransfersListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
	return c
}

// CustomerId sets the optional parameter "customerId": Immutable ID of
// the Google Apps account.
func (c *TransfersListCall) CustomerId(customerId string) *TransfersListCall {
	c.urlParams_.Set("customerId", customerId)
	return c
}

// MaxResults sets the optional parameter "maxResults": Maximum number
// of results to return. Default is 100.
func (c *TransfersListCall) MaxResults(maxResults int64) *TransfersListCall {
	c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
	return c
}

// NewOwnerUserId sets the optional parameter "newOwnerUserId":
// Destination user's profile ID.
func (c *TransfersListCall) NewOwnerUserId(newOwnerUserId string) *TransfersListCall {
	c.urlParams_.Set("newOwnerUserId", newOwnerUserId)
	return c
}

// OldOwnerUserId sets the optional parameter "oldOwnerUserId": Source
// user's profile ID.
func (c *TransfersListCall) OldOwnerUserId(oldOwnerUserId string) *TransfersListCall {
	c.urlParams_.Set("oldOwnerUserId", oldOwnerUserId)
	return c
}

// PageToken sets the optional parameter "pageToken": Token to specify
// the next page in the list.
func (c *TransfersListCall) PageToken(pageToken string) *TransfersListCall {
	c.urlParams_.Set("pageToken", pageToken)
	return c
}

// Status sets the optional parameter "status": Status of the transfer.
func (c *TransfersListCall) Status(status string) *TransfersListCall {
	c.urlParams_.Set("status", status)
	return c
}

// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *TransfersListCall) Fields(s ...googleapi.Field) *TransfersListCall {
	c.urlParams_.Set("fields", googleapi.CombineFields(s))
	return c
}

// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *TransfersListCall) IfNoneMatch(entityTag string) *TransfersListCall {
	c.ifNoneMatch_ = entityTag
	return c
}

// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *TransfersListCall) Context(ctx context.Context) *TransfersListCall {
	c.ctx_ = ctx
	return c
}

// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *TransfersListCall) Header() http.Header {
	if c.header_ == nil {
		c.header_ = make(http.Header)
	}
	return c.header_
}

func (c *TransfersListCall) doRequest(alt string) (*http.Response, error) {
	reqHeaders := make(http.Header)
	for k, v := range c.header_ {
		reqHeaders[k] = v
	}
	reqHeaders.Set("User-Agent", c.s.userAgent())
	reqHeaders.Set("x-goog-api-client", c.s.clientHeader())
	if c.ifNoneMatch_ != "" {
		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
	}
	var body io.Reader = nil
	c.urlParams_.Set("alt", alt)
	urls := googleapi.ResolveRelative(c.s.BasePath, "transfers")
	urls += "?" + c.urlParams_.Encode()
	req, _ := http.NewRequest("GET", urls, body)
	req.Header = reqHeaders
	return gensupport.SendRequest(c.ctx_, c.s.client, req)
}

// Do executes the "datatransfer.transfers.list" call.
// Exactly one of *DataTransfersListResponse or error will be non-nil.
// Any non-2xx status code is an error. Response headers are in either
// *DataTransfersListResponse.ServerResponse.Header or (if a response
// was returned at all) in error.(*googleapi.Error).Header. Use
// googleapi.IsNotModified to check whether the returned error was
// because http.StatusNotModified was returned.
func (c *TransfersListCall) Do(opts ...googleapi.CallOption) (*DataTransfersListResponse, error) {
	gensupport.SetOptions(c.urlParams_, opts...)
	res, err := c.doRequest("json")
	if res != nil && res.StatusCode == http.StatusNotModified {
		if res.Body != nil {
			res.Body.Close()
		}
		return nil, &googleapi.Error{
			Code:   res.StatusCode,
			Header: res.Header,
		}
	}
	if err != nil {
		return nil, err
	}
	defer googleapi.CloseBody(res)
	if err := googleapi.CheckResponse(res); err != nil {
		return nil, err
	}
	ret := &DataTransfersListResponse{
		ServerResponse: googleapi.ServerResponse{
			Header:         res.Header,
			HTTPStatusCode: res.StatusCode,
		},
	}
	target := &ret
	if err := json.NewDecoder(res.Body).Decode(target); err != nil {
		return nil, err
	}
	return ret, nil
	// {
	//   "description": "Lists the transfers for a customer by source user, destination user, or status.",
	//   "httpMethod": "GET",
	//   "id": "datatransfer.transfers.list",
	//   "parameters": {
	//     "customerId": {
	//       "description": "Immutable ID of the Google Apps account.",
	//       "location": "query",
	//       "type": "string"
	//     },
	//     "maxResults": {
	//       "description": "Maximum number of results to return. Default is 100.",
	//       "format": "int32",
	//       "location": "query",
	//       "maximum": "500",
	//       "minimum": "1",
	//       "type": "integer"
	//     },
	//     "newOwnerUserId": {
	//       "description": "Destination user's profile ID.",
	//       "location": "query",
	//       "type": "string"
	//     },
	//     "oldOwnerUserId": {
	//       "description": "Source user's profile ID.",
	//       "location": "query",
	//       "type": "string"
	//     },
	//     "pageToken": {
	//       "description": "Token to specify the next page in the list.",
	//       "location": "query",
	//       "type": "string"
	//     },
	//     "status": {
	//       "description": "Status of the transfer.",
	//       "location": "query",
	//       "type": "string"
	//     }
	//   },
	//   "path": "transfers",
	//   "response": {
	//     "$ref": "DataTransfersListResponse"
	//   },
	//   "scopes": [
	//     "https://www.googleapis.com/auth/admin.datatransfer",
	//     "https://www.googleapis.com/auth/admin.datatransfer.readonly"
	//   ]
	// }

}

// Pages invokes f for each page of results.
// A non-nil error returned from f will halt the iteration.
// The provided context supersedes any context provided to the Context method.
func (c *TransfersListCall) Pages(ctx context.Context, f func(*DataTransfersListResponse) error) error {
	c.ctx_ = ctx
	defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
	for {
		x, err := c.Do()
		if err != nil {
			return err
		}
		if err := f(x); err != nil {
			return err
		}
		if x.NextPageToken == "" {
			return nil
		}
		c.PageToken(x.NextPageToken)
	}
}


text:
class Test implements I {
  A myField;
}

redpajama_set_name: RedPajamaGithub


text:
define([], function() {

  /** Used to restore the original `_` reference in `_.noConflict` */
  var oldDash = window._;

  /**
   * Reverts the `_` variable to its previous value and returns a reference to
   * the `lodash` function.
   *
   * @static
   * @memberOf _
   * @category Utilities
   * @returns {Function} Returns the `lodash` function.
   * @example
   *
   * var lodash = _.noConflict();
   */
  function noConflict() {
    window._ = oldDash;
    return this;
  }

  return noConflict;
});


text:
/*
 * common.js: Tests for common utility function in nconf.
 *
 * (C) 2011, Nodejitsu Inc.
 *
 */

var fs = require('fs'),
    path = require('path'),
    vows = require('vows'),
    assert = require('assert'),
    helpers = require('./helpers'),
    nconf = require('../lib/nconf');

var mergeDir = path.join(__dirname, 'fixtures', 'merge'),
    files = fs.readdirSync(mergeDir).map(function (f) {
        return path.join(mergeDir, f)
    });

vows.describe('nconf/common').addBatch({
    "Using nconf.common module": {
        "the loadFiles() method": {
            topic: function () {
                nconf.loadFiles(files, this.callback);
            },
            "should merge the files correctly": helpers.assertMerged
        },
        "the loadFilesSync() method": {
            "should merge the files correctly": function () {
                helpers.assertMerged(null, nconf.loadFilesSync(files));
            }
        }
    }
}).export(module);


text:
.class final Landroid/location/Location$2;
.super Ljava/lang/Object;
.source "Location.java"

# interfaces
.implements Landroid/os/Parcelable$Creator;

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/location/Location;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x8
    name = null
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "Ljava/lang/Object;",
        "Landroid/os/Parcelable$Creator",
        "<",
        "Landroid/location/Location;",
        ">;"
    }
.end annotation

# direct methods
.method constructor <init>()V
    .locals 0

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

    return-void
.end method

# virtual methods
.method public createFromParcel(Landroid/os/Parcel;)Landroid/location/Location;
    .locals 4

    invoke-virtual {p1}, Landroid/os/Parcel;->readString()Ljava/lang/String;

    move-result-object v1

    new-instance v0, Landroid/location/Location;

    invoke-direct {v0, v1}, Landroid/location/Location;-><init>(Ljava/lang/String;)V

    invoke-virtual {p1}, Landroid/os/Parcel;->readLong()J

    move-result-wide v2

    invoke-static {v0, v2, v3}, Landroid/location/Location;->-set11(Landroid/location/Location;J)J

    invoke-virtual {p1}, Landroid/os/Parcel;->readLong()J

    move-result-wide v2

    invoke-static {v0, v2, v3}, Landroid/location/Location;->-set3(Landroid/location/Location;J)J

    invoke-virtual {p1}, Landroid/os/Parcel;->readByte()B

    move-result v2

    invoke-static {v0, v2}, Landroid/location/Location;->-set5(Landroid/location/Location;B)B

    invoke-virtual {p1}, Landroid/os/Parcel;->readDouble()D

    move-result-wide v2

    invoke-static {v0, v2, v3}, Landroid/location/Location;->-set7(Landroid/location/Location;D)D

    invoke-virtual {p1}, Landroid/os/Parcel;->readDouble()D

    move-result-wide v2

    invoke-static {v0, v2, v3}, Landroid/location/Location;->-set8(Landroid/location/Location;D)D

    invoke-virtual {p1}, Landroid/os/Parcel;->readDouble()D

    move-result-wide v2

    invoke-static {v0, v2, v3}, Landroid/location/Location;->-set0(Landroid/location/Location;D)D

    invoke-virtual {p1}, Landroid/os/Parcel;->readFloat()F

    move-result v2

    invoke-static {v0, v2}, Landroid/location/Location;->-set9(Landroid/location/Location;F)F

    invoke-virtual {p1}, Landroid/os/Parcel;->readFloat()F

    move-result v2

    invoke-static {v0, v2}, Landroid/location/Location;->-set1(Landroid/location/Location;F)F

    invoke-virtual {p1}, Landroid/os/Parcel;->readFloat()F

    move-result v2

    invoke-static {v0, v2}, Landroid/location/Location;->-set6(Landroid/location/Location;F)F

    invoke-virtual {p1}, Landroid/os/Parcel;->readFloat()F

    move-result v2

    invoke-static {v0, v2}, Landroid/location/Location;->-set12(Landroid/location/Location;F)F

    invoke-virtual {p1}, Landroid/os/Parcel;->readFloat()F

    move-result v2

    invoke-static {v0, v2}, Landroid/location/Location;->-set10(Landroid/location/Location;F)F

    invoke-virtual {p1}, Landroid/os/Parcel;->readFloat()F

    move-result v2

    invoke-static {v0, v2}, Landroid/location/Location;->-set2(Landroid/location/Location;F)F

    invoke-virtual {p1}, Landroid/os/Parcel;->readBundle()Landroid/os/Bundle;

    move-result-object v2

    const/4 v3, 0x1

    invoke-static {v2, v3}, Landroid/os/Bundle;->setDefusable(Landroid/os/Bundle;Z)Landroid/os/Bundle;

    move-result-object v2

    invoke-static {v0, v2}, Landroid/location/Location;->-set4(Landroid/location/Location;Landroid/os/Bundle;)Landroid/os/Bundle;

    return-object v0
.end method

.method public bridge synthetic createFromParcel(Landroid/os/Parcel;)Ljava/lang/Object;
    .locals 1

    invoke-virtual {p0, p1}, Landroid/location/Location$2;->createFromParcel(Landroid/os/Parcel;)Landroid/location/Location;

    move-result-object v0

    return-object v0
.end method

.method public newArray(I)[Landroid/location/Location;
    .locals 1

    new-array v0, p1, [Landroid/location/Location;

    return-object v0
.end method

.method public bridge synthetic newArray(I)[Ljava/lang/Object;
    .locals 1

    invoke-virtual {p0, p1}, Landroid/location/Location$2;->newArray(I)[Landroid/location/Location;

    move-result-object v0

    return-object v0
.end method


text:
package rel

type UpdateManager struct {
	Engine Engine
	Ast    *UpdateStatementNode
	BaseVisitable
}

func NewUpdateManager(engine Engine) *UpdateManager {
	return &UpdateManager{
		Engine: engine,
		Ast:    NewUpdateStatementNode(),
	}
}

func (mgr *UpdateManager) ToSql() string {
	return mgr.Engine.Visitor().Accept(mgr.Ast)
}

func (mgr *UpdateManager) Take(limit int) *UpdateManager {
	if limit > 0 {
		mgr.Ast.Limit = NewLimitNode(Sql(limit))
	}
	return mgr
}

func (mgr *UpdateManager) SetKey(node *AttributeNode) *UpdateManager {
	mgr.Ast.Key = node
	return mgr
}

func (mgr *UpdateManager) Order(expressions ...Visitable) *UpdateManager {
	mgr.Ast.Orders = &expressions
	return mgr
}

func (mgr *UpdateManager) Table(relation *Table) *UpdateManager {
	mgr.Ast.Relation = relation
	return mgr
}

func (mgr *UpdateManager) From(relation *Table) *UpdateManager {
	return mgr.Table(relation)
}

func (mgr *UpdateManager) Where(visitable Visitable) *UpdateManager {
	if mgr.Ast.Wheres == nil {
		mgr.Ast.Wheres = &[]Visitable{}
	}
	*mgr.Ast.Wheres = append(*mgr.Ast.Wheres, visitable)
	return mgr
}

func (mgr *UpdateManager) Set(field *AttributeNode, value Visitable) *UpdateManager {
	if mgr.Ast.Values == nil {
		mgr.Ast.Values = &[]Visitable{}
	}
	*mgr.Ast.Values = append(*mgr.Ast.Values, &AssignmentNode{
		Left:  &UnqualifiedColumnNode{Expr: field},
		Right: value,
	})
	return mgr
}


text:
package gwt.material.design.client.base.mixin;

import com.google.gwt.user.client.ui.UIObject;

/**
 * @author Sven Jacobs
 */
public abstract class AbstractMixin<T extends UIObject> {

    T uiObject;

    AbstractMixin(final T uiObject) {
        setUiObject(uiObject);
    }

    public void setUiObject(T uiObject) {
        this.uiObject = uiObject;
    }

    public T getUiObject() {
        return uiObject;
    }
}


text:
package com.cloutteam.jarcraftinator.world;

public class Chunk {

    private final World world;
    private final int x;
    private final int z;

    public Chunk(World world, int x, int z) {
        this.world = world;
        this.x = x;
        this.z = z;
    }

    public int getX() {
        return x;
    }

    public int getZ() {
        return z;
    }

    public boolean isSectionEmpty(int y) {
        //TODO check section array

        // For testing proposes only
        return y != 6;
    }

    public World getWorld() {
        return world;
    }

    public ChunkSection getSection(int y) {
        // Return dummy section
        return new ChunkSection(y);
    }

    public Biome getBiome(int x, int z){
        // For testing proposes only
        return Biome.PLAINS;
    }

    public class ChunkSection {
        private final int y;

        public ChunkSection(int y) {
            this.y = y;
        }

        public int getX() {
            return x;
        }

        public int getY() {
            return y;
        }

        public int getZ() {
            return z;
        }

        public boolean isEmpty() {
            return false;
        }

        public BlockState getState(int x, int y, int z) {
            // For testing proposes
            return new BlockState();
        }

        public int getBlockLight(int x, int y, int z) {
            return 15;
        }

        public int getSkyLight(int x, int y, int z) {
            return 15;
        }

        public World getWorld() {
            return world;
        }

    }

}


text:
void gpGetStats(ezStringBuilder& out_Stats, const gpEntity& entity)
{
    const auto& vPos = gpValueOf(gpPositionOf(entity));
    const auto& vVel = gpValueOf(gpLinearVelocityOf(entity));
    out_Stats.Format("position = {%3.3f, %3.3f, %3.3f} linearVelocity = {%3.3f, %3.3f, %3.3f}",
                     vPos.x, vPos.y, vPos.z,
                     vVel.x, vVel.y, vVel.z);
}

ezDynamicArray<gpEntity*> g_entities;

gpEntity* gpTypeAllocator<gpEntity>::New()
{
    auto pEntity = EZ_DEFAULT_NEW(gpEntity);
    g_entities.PushBack(pEntity);
    return pEntity;
}

void gpHandleUnreferencedObject(gpEntity*& pEntity)
{
    EZ_ASSERT(g_entities.Contains(pEntity), "Invalid or double free.");
    g_entities.RemoveSwap(pEntity);
    EZ_DEFAULT_DELETE(pEntity);
}


text:
from scripts.rake import *
import json

# get review texts aggregated by asin id
def get_rdd(base, input, num_part):
                base_dir = os.path.join(base)
                input_path = os.path.join(input)
                file_name = os.path.join(base_dir, input_path)
                # load data
                rdd = sc.textFile(file_name, num_part)
                rdd_j = rdd.map(json.loads)
                rdd_j.cache()
                return rdd_j

revs = get_rdd('data', 'reviews_electronics.json', 4)
rev_texts = revs.map(lambda x: (x['asin'], x['reviewText']))
rev_agg_texts = rev_texts.map(lambda (asin, text): (asin, [text])).reduceByKey(lambda x, y: x + y)

# 1. RAKE: keyword. use rake algorithm to extract keywords and take top 10 keywords from each asin
rake = Rake('data/SmartStoplist.txt')
rev_agg_rake = rev_agg_texts.map( lambda (asin, texts): (asin, rake.run(' '.join(texts))) )
rev_agg_rake10 = rev_agg_rake.map( lambda (asin, rakes): (asin, rakes[:10]) )
rev_agg_rake10.take(2)

# 2. NP: noun phrasee among these keywords
import nltk
from scripts.np_extractor import *
rev_agg_rake10.cache()
rev_np = rev_agg_rake10.map(lambda (asin, pairs): [(NPExtractor(string).extract(), score) for (string, score) in pairs])
rev_np = rev_np.map(lambda lst: [(np_lst, score) for (np_lst, score) in lst if len(np_lst) > 0])
rev_np = rev_np.filter(lambda lst: len(lst) > 0)

# 3. output
import pandas as pd
df = pf.DataFrame(rev_np.collect())
df.to_csv('data/electronics_kw.csv')


text:
package otaruapiserver

import (
	"os"
	"runtime"

	"context"

	"google.golang.org/grpc"

	"github.com/nyaxt/otaru/apiserver"
	"github.com/nyaxt/otaru/apiserver/clientauth"
	"github.com/nyaxt/otaru/pb"
	"github.com/nyaxt/otaru/util/countfds"
	"github.com/nyaxt/otaru/version"
)

type systemService struct {
	pb.UnimplementedSystemInfoServiceServer
}

func (*systemService) GetSystemInfo(ctx context.Context, in *pb.GetSystemInfoRequest) (*pb.SystemInfoResponse, error) {
	if err := clientauth.RequireRoleGRPC(ctx, clientauth.RoleAdmin); err != nil {
		return nil, err
	}

	var m runtime.MemStats
	runtime.ReadMemStats(&m)

	hostname, err := os.Hostname()
	if err != nil {
		hostname = "<os.Hostname failed!>"
	}

	return &pb.SystemInfoResponse{
		GoVersion: runtime.Version(),
		Os:        runtime.GOOS,
		Arch:      runtime.GOARCH,

		NumGoroutine: uint32(runtime.NumGoroutine()),

		Hostname: hostname,
		Pid:      uint64(os.Getpid()),
		Uid:      uint64(os.Getuid()),

		MemAlloc: m.Alloc,
		MemSys:   m.Sys,

		NumGc: m.NumGC,

		NumFds: uint32(countfds.CountFds()),
	}, nil
}

func (*systemService) GetVersion(ctx context.Context, in *pb.GetVersionRequest) (*pb.VersionResponse, error) {
	return &pb.VersionResponse{
		GitCommit: version.GIT_COMMIT,
		BuildHost: version.BUILD_HOST,
	}, nil
}

func (*systemService) Whoami(ctx context.Context, in *pb.WhoamiRequest) (*pb.WhoamiResponse, error) {
	ui := clientauth.UserInfoFromContext(ctx)

	return &pb.WhoamiResponse{
		Role: ui.Role.String(),
		User: ui.User,
	}, nil
}

func (*systemService) AuthTestAnonymous(ctx context.Context, in *pb.AuthTestRequest) (*pb.AuthTestResponse, error) {
	if err := clientauth.RequireRoleGRPC(ctx, clientauth.RoleAnonymous); err != nil {
		return nil, err
	}

	return &pb.AuthTestResponse{}, nil
}

func (*systemService) AuthTestReadOnly(ctx context.Context, in *pb.AuthTestRequest) (*pb.AuthTestResponse, error) {
	if err := clientauth.RequireRoleGRPC(ctx, clientauth.RoleReadOnly); err != nil {
		return nil, err
	}

	return &pb.AuthTestResponse{}, nil
}

func (*systemService) AuthTestAdmin(ctx context.Context, in *pb.AuthTestRequest) (*pb.AuthTestResponse, error) {
	if err := clientauth.RequireRoleGRPC(ctx, clientauth.RoleAdmin); err != nil {
		return nil, err
	}

	return &pb.AuthTestResponse{}, nil
}

func InstallSystemService() apiserver.Option {
	return apiserver.RegisterService(
		func(s *grpc.Server) { pb.RegisterSystemInfoServiceServer(s, &systemService{}) },
		pb.RegisterSystemInfoServiceHandlerFromEndpoint,
	)
}


text:
package org.example.sboot.domain.repo;

import io.ebean.EbeanServer;
import io.ebean.bean.EntityBean;

public abstract class BeanRepository extends BeanFinder {

	public BeanRepository(Class<T> type, EbeanServer server) {
		super(type, server);
	}

	/**
	 * Marks the entity bean as dirty.
	 *

	 * This is used so that when a bean that is otherwise unmodified is updated the version
	 * property is updated.
	 *

	 * An unmodified bean that is saved or updated is normally skipped and this marks the bean as
	 * dirty so that it is not skipped.
	 *

	 *
{@code
	 *
	 * Customer customer = Customer.find.byId(id);
	 *
	 * // mark the bean as dirty so that a save() or update() will
	 * // increment the version property
	 * customer.markAsDirty();
	 * customer.save();
	 *
	 * }

	 *
	 * @see EbeanServer#markAsDirty(Object)
	 */
	public void markAsDirty(T bean) {
		db().markAsDirty(bean);
	}

	/**
	 * Mark the property as unset or 'not loaded'.
	 *

	 * This would be used to specify a property that we did not wish to include in a stateless update.
	 *

	 *
{@code
	 *
	 *   // populate an entity bean from JSON or whatever
	 *   User user = ...;
	 *
	 *   // mark the email property as 'unset' so that it is not
	 *   // included in a 'stateless update'
	 *   user.markPropertyUnset("email");
	 *
	 *   user.update();
	 *
	 * }

	 *
	 * @param propertyName the name of the property on the bean to be marked as 'unset'
	 */
	public void markPropertyUnset(T bean, String propertyName) {
		((EntityBean) bean)._ebean_getIntercept().setPropertyLoaded(propertyName, false);
	}

	/**
	 * Insert or update this entity depending on its state.
	 *

	 * Ebean will detect if this is a new bean or a previously fetched bean and perform either an
	 * insert or an update based on that.
	 *
	 * @see EbeanServer#save(Object)
	 */
	public void save(T bean) {
		db().save(bean);
	}

	/**
	 * Update this entity.
	 *
	 * @see EbeanServer#update(Object)
	 */
	public void update(T bean) {
		db().update(bean);
	}

	/**
	 * Insert this entity.
	 *
	 * @see EbeanServer#insert(Object)
	 */
	public void insert(T bean) {
		db().insert(bean);
	}

	/**
	 * Delete this bean.
	 *

	 * This will return true if the bean was deleted successfully or JDBC batch is being used.
	 *

	 *

	 * If there is no current transaction one will be created and committed for
	 * you automatically.
	 *

	 *

	 * If the Bean does not have a version property (or loaded version property) and
	 * the bean does not exist then this returns false indicating that nothing was
	 * deleted. Note that, if JDBC batch mode is used then this always returns true.
	 *

	 *
	 * @see EbeanServer#delete(Object)
	 */
	public boolean delete(T bean) {
		return db().delete(bean);
	}

	/**
	 * Delete a bean permanently without soft delete.
	 *

	 * This is used when the bean contains a @SoftDelete property and we
	 * want to perform a hard/permanent delete.
	 *

	 *
	 * @see EbeanServer#deletePermanent(Object)
	 */
	public boolean deletePermanent(T bean) {
		return db().deletePermanent(bean);
	}

	/**
	 * Refreshes this entity from the database.
	 *
	 * @see EbeanServer#refresh(Object)
	 */
	public void refresh(T bean) {
		db().refresh(bean);
	}
}


text:
Package.describe({
  name: 'q42:memcached',
  summary: 'Memcached client for Meteor. Based on 3rd-eden node-memcached,version 2.0.0',
  version: '1.0.0',
  git: ' /* Fill me in! */ '
});

Package.onUse(function(api) {
  api.versionsFrom('1.0.2');

  api.addFiles(['lib/utils.js', 'lib/ms.js', 'lib/connection-parse.js', 'lib/simple-lru.js', 'lib/retry-operation.js',
  'lib/retry.js','lib/jackpot.js','lib/hashring.js','lib/connection.js','q42:memcached.js'], 'server');
  api.export('Memcached');

});

Package.onTest(function(api) {

});


text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Security.Cryptography;
using System.Text;

using LythumOSL.Security.Metadata;

namespace LythumOSL.Security.Encryptions
{
	/// <summary>
	/// Simetrinis AES algoritmas, skirtingai nei asimetrinis (pvz. RSA), neturi dviejø raktø, o tik vienà raktà.
	/// Su ðiuo raktu informacija yra ir atkoduojama ir uþkoduojama.
	/// Dël to jis paprastai perduodamas uþkoduotas.
	/// Faktas gal eitø viskam naudoti RSA algoritmà, bet jis yra gan lëtas ir stipriai lëtintø sistemos darbà,
	/// dël to RSA paprastai naudojamas tik saugiai perduoti AES raktà.
	/// </summary>
	public sealed class Aes : IDecryption
	{
		#region Attributes
		byte[] _Key;
		/// <summary>
		/// AES initialization vector
		/// </summary>
		byte[] _IV;
		bool _UrlSafe;
		Encoding _OponentEncoding;

		#endregion

		#region Properties
		/// <summary>
		/// Encryption key.
		/// </summary>
		public byte[] Key
		{
			get { return _Key; }
		}

		/// <summary>
		/// Initialization vector
		/// </summary>
		public byte[] IV
		{
			get { return _IV; }
		}

		/// <summary>
		/// AES key as a base64 encoded string.
		/// </summary>
		public string KeyString
		{
			get
			{
				return Base64.Encode (_Key, _UrlSafe);
			}
		}

		/// <summary>
		/// AES Initialization vector as a base64 encoded string.
		/// </summary>
		public string IVString
		{
			get
			{
				return Base64.Encode (_IV, _UrlSafe);
			}
		}

		#endregion

		#region Ctor

		public Aes ()
		{
			_OponentEncoding = Encoding.UTF8;
			_Key = new byte[256 / 8];
			_IV = new byte[128 / 8];
			_UrlSafe = true;

			GenerateRandomKeys ();
		}

		public Aes (Encoding oponentEncoding)
			: this ()
		{
			_OponentEncoding = oponentEncoding;
		}

		/// <summary>
		/// Constructor with key and initialization vector initialization
		/// </summary>
		/// <param name="key">AES Key</param>
		/// <param name="iv">AES Initialization vector</param>
		/// <param name="urlSafe">URL safe base64 encoding, required for LSLW system, set it to true if unsure</param>
		public Aes (Encoding oponentEncoding, string key, string iv, bool urlSafe)
		{
			_UrlSafe = urlSafe;
			_OponentEncoding = oponentEncoding;

			if (urlSafe)
			{
				_Key = Base64.DecodeToBytes (key, _UrlSafe);
				_IV = Base64.DecodeToBytes (iv, _UrlSafe);
			}
			else
			{
				_Key = Base64.DecodeToBytes (key, _UrlSafe);
				_IV = Base64.DecodeToBytes (iv, _UrlSafe);
			}

			if (_Key.Length * 8 != 256)
				throw new Exception (Properties.Resources.ENC_ERROR_KEY256_LENGTH);
			if (_IV.Length * 8 != 128)
				throw new Exception (Properties.Resources.ENC_ERROR_IV128_LENGTH);
		}

		#endregion

		#region Methods

		/// <summary>
        /// Generate the cryptographically secure random 256 bit Key and 128 bit IV for the AES algorithm.
        /// </summary>
        public void GenerateRandomKeys()
        {
            RNGCryptoServiceProvider random = new RNGCryptoServiceProvider();
            random.GetBytes(_Key);
            random.GetBytes(_IV);
        }

        /// <summary>
        /// Encrypt a message and get the encrypted message in a URL safe form of base64.
        /// </summary>
        /// <param name="plainText">The message to encrypt.</param>
        public string Encrypt(string plainText)
        {
			return Base64.Encode (EncryptData (plainText), _UrlSafe);
		}

		/// <summary>
		/// Decrypt a message that is in a url safe base64 encoded string.
		/// </summary>
		/// <param name="cipherText">The string to decrypt.</param>
		public string Decrypt (string cipherText)
		{
			return DecryptData (Base64.DecodeToBytes (cipherText, _UrlSafe));
		}

		#endregion

		#region Helpers
		/// <summary>
		/// Encrypt a message using AES.
		/// </summary>
		/// <param name="plainText">The message to encrypt.</param>
		private byte[] EncryptData (string plainText)
		{
			try
			{
				RijndaelManaged aes = new RijndaelManaged ();
				aes.Padding = PaddingMode.PKCS7;
				aes.Mode = CipherMode.CBC;
				aes.KeySize = 256;
				aes.Key = Key;
				aes.IV = IV;

				ICryptoTransform encryptor = aes.CreateEncryptor (aes.Key, aes.IV);

				MemoryStream msEncrypt = new MemoryStream ();
				CryptoStream csEncrypt = new CryptoStream (msEncrypt, encryptor, CryptoStreamMode.Write);
				StreamWriter swEncrypt = new StreamWriter (csEncrypt, _OponentEncoding);

				swEncrypt.Write (plainText);

				swEncrypt.Close ();
				csEncrypt.Close ();
				aes.Clear ();

				return msEncrypt.ToArray ();
			}
			catch (Exception ex)
			{
				throw new CryptographicException (Properties.Resources.ENC_ERROR_ENCRYPT, ex);
			}
		}

		/// <summary>
		/// Decrypt a message that was AES encrypted.
		/// </summary>
		/// <param name="cipherText">The string to decrypt.</param>
		private string DecryptData (byte[] cipherText)
		{
			try
			{
				RijndaelManaged aes = new RijndaelManaged ();
				aes.Padding = PaddingMode.PKCS7;
				aes.Mode = CipherMode.CBC;
				aes.KeySize = 256;
				aes.Key = Key;
				aes.IV = IV;

				ICryptoTransform decryptor = aes.CreateDecryptor (aes.Key, aes.IV);

				MemoryStream msDecrypt = new MemoryStream (cipherText);
				CryptoStream csDecrypt = new CryptoStream (msDecrypt, decryptor, CryptoStreamMode.Read);
				StreamReader srDecrypt = new StreamReader (csDecrypt, _OponentEncoding, false);

				string plaintext = srDecrypt.ReadToEnd ();

				//string normal = Encoding.UTF8.GetString (Encoding.Default.GetBytes (plaintext));

				srDecrypt.Close ();
				csDecrypt.Close ();
				msDecrypt.Close ();
				aes.Clear ();

				return plaintext;
			}
			catch (Exception ex)
			{
				throw new CryptographicException (Properties.Resources.ENC_ERROR_DECRYPT, ex);
			}
		}
		#endregion
	}
}


text:
module Metronome
  describe TaskResult do
    before do
      @client = double('client')
    end

    describe '.list' do
      it 'return empty array when kvs hasn\'t result' do
        allow(@client).to receive_message_chain(:kv, :get).and_return(nil)

        results = TaskResult.list(@client, '00000000-0000-0000-0000-000000000000')
        expect(results.size).to eq(0)
      end

      it 'return array of TaskResult that are created from kvs response' do
        response = {
          'metronome/results/6195e436-d702-4866-56af-06889ac08364/0' => {
            'EventID' => '6195e436-d702-4866-56af-06889ac08364',
            'No' => 0,
            'Name' => 'configure',
            'Status' => 'success',
            'StartedAt' => '2015-08-07T15:32:50+09:00',
            'FinishedAt' => '2015-08-07T15:49:15+09:00'
          }
        }
        allow(@client).to receive_message_chain(:kv, :get).and_return(response)

        results = TaskResult.list(@client, '6195e436-d702-4866-56af-06889ac08364')
        expect(results.size).to eq(1)
        expect(results).to be_is_a(Array)
        expect(results.first).to be_is_a(Metronome::TaskResult)
      end
    end

    describe '.find' do
      it 'return nil when kvs hasn\'t result' do
        allow(@client).to receive_message_chain(:kv, :get).and_return(nil)

        results = TaskResult.find(@client, '00000000-0000-0000-0000-000000000000', 0)
        expect(results).to be_nil
      end

      it 'initialize TaskResult with kvs response' do
        response = {
          'EventID' => '6195e436-d702-4866-56af-06889ac08364',
          'No' => 0,
          'Name' => 'configure',
          'Status' => 'success',
          'StartedAt' => '2015-08-07T15:32:50+09:00',
          'FinishedAt' => '2015-08-07T15:49:15+09:00'
        }
        allow(@client).to receive_message_chain(:kv, :get).and_return(response)

        expect(TaskResult).to receive(:new).with(@client, response)
        TaskResult.find(@client, '6195e436-d702-4866-56af-06889ac08364', 0)
      end
    end

    describe '#initialize' do
      it 'return TaskResult that is created from kvs response' do
        response = {
          'EventID' => '6195e436-d702-4866-56af-06889ac08364',
          'No' => 0,
          'Name' => 'configure',
          'Status' => 'success',
          'StartedAt' => '2015-08-07T15:32:50+09:00',
          'FinishedAt' => '2015-08-07T15:49:15+09:00'
        }

        result = TaskResult.new(@client, response)
        expect(result).to be_is_a(TaskResult)
        expect(result.id).to eq('6195e436-d702-4866-56af-06889ac08364')
        expect(result.no).to eq(0)
        expect(result.name).to eq('configure')
        expect(result.status).to eq(:success)
        expect(result.started_at).to be_is_a(DateTime)
        expect(result.started_at).to eq(DateTime.new(2015, 8, 7, 15, 32, 50, '+0900'))
        expect(result.finished_at).to be_is_a(DateTime)
        expect(result.finished_at).to eq(DateTime.new(2015, 8, 7, 15, 49, 15, '+0900'))
      end

      it 'use nil instead of finished_at when initialize with unfinished result' do
        response = {
          'EventID' => '6195e436-d702-4866-56af-06889ac08364',
          'No' => 0,
          'Name' => 'configure',
          'Status' => 'success',
          'StartedAt' => '2015-08-07T15:32:50+09:00'
        }

        result = TaskResult.new(@client, response)
        expect(result.finished_at).to be_nil
      end
    end

    context 'with instance' do
      before do
        response = {
          'EventID' => '6195e436-d702-4866-56af-06889ac08364',
          'No' => 0,
          'Name' => 'configure',
          'Status' => 'success',
          'StartedAt' => '2015-08-07T15:32:50+09:00',
          'FinishedAt' => '2015-08-07T15:49:15+09:00'
        }
        @task_result = TaskResult.new(@client, response)
      end

      describe '#finished?' do
        it 'return true when status is success' do
          @task_result.status = :success
          expect(@task_result.finished?).to be_truthy
        end

        it 'return true when status is error' do
          @task_result.status = :error
          expect(@task_result.finished?).to be_truthy
        end

        it 'return false when status isn\'t success and error' do
          @task_result.status = :inprogress
          expect(@task_result.finished?).to be_falsey
        end
      end

      describe '#success?' do
        it 'return true when status is success' do
          @task_result.status = :success
          expect(@task_result.finished?).to be_truthy
        end

        it 'return true when status isn\'t success' do
          @task_result.status = :inprogress
          expect(@task_result.finished?).to be_falsey
        end
      end

      describe '#as_json' do
        it 'return Hash that is excluded client field' do
          expect(@task_result.as_json.keys).to eq(%w(id no name status started_at finished_at))
        end
      end

      describe '#nodes' do
        it 'will call NodeTaskResult.list and return it when first request' do
          expect(NodeTaskResult).to receive(:list).with(@client, '6195e436-d702-4866-56af-06889ac08364', 0).and_return([])
          expect(@task_result.nodes).to eq([])
        end

        it 'return cache instead of calling TaskResult.list when already cached' do
          expect(NodeTaskResult).not_to receive(:list)
          @task_result.instance_variable_set(:@nodes, [])
          expect(@task_result.nodes).to eq([])
        end
      end

      describe '#refresh!' do
        it 'will retrieve NodeTaskResult' do
          node = double(:node)
          expect(NodeTaskResult).to receive(:list).with(@client, '6195e436-d702-4866-56af-06889ac08364', 0).and_return([node])
          expect(@task_result.refresh!).to eq(@task_result)
        end
      end
    end
  end
end


text:
package se.mulander.cosmos.common.model.movies;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;

import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

/**
 * Created by marcu on 2017-06-25.
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
@ApiModel(value = "Movie", description = "A movie object containing all relevant information about a particular movie")
@Entity
@Table(name = "movie")
public class Movie
{
	@ApiModelProperty(name = "internal_id", value = "The unique identifier used by the cosmos system")
	@JsonProperty("internal_id")
	@Column(name = "movie_id")
	@Id
	public String internalID;
	@ApiModelProperty(name = "image_url", value = "An absolute link to a thumbnail image")
	@JsonProperty("image_url")
	@Column(name = "image_url")
	public String imageURL;
	@ApiModelProperty(value = "The title of the movie")
	@Column(name = "title")
	public String title;
	@ApiModelProperty(value = "Release year of the movie")
	@Column(name = "year")
	public int year;
	@ApiModelProperty(value = "A list of ratings by different providers such as rotten tomato and imdb")
	@OneToMany(fetch = FetchType.EAGER, cascade = {CascadeType.ALL}, mappedBy = "rating")
	public List<Rating> rating = new ArrayList<>();
	@ApiModelProperty(name = "extended_movie",
					  value = "More details about the movie. This can be info such as a description an what actors are in it")
	@JsonProperty("extended_movie")
	@OneToOne(fetch = FetchType.EAGER, cascade = {CascadeType.ALL})
	@JoinColumn(name = "movie_id")
	public ExtendedMovie extendedMovie;
	@ApiModelProperty(value = "A list of strings noting what genre the movie is part of")
	@ElementCollection
	@LazyCollection(LazyCollectionOption.FALSE)
	@CollectionTable(name = "genre", joinColumns = @JoinColumn(name = "movie_id"))
	@Column(name = "genre")
	public List<String> genre = new ArrayList<>();

	public Movie()
	{
	}

	public Movie setID(String id)
	{
		this.internalID = id;
		if(this.extendedMovie != null)
			this.extendedMovie.movieID = id;
		return this;
	}

	public Movie setExtended(ExtendedMovie ex)
	{
		ex.parent = this;
		ex.movieID = this.internalID;
		this.extendedMovie = ex;
		return this;
	}

	public Movie addGenre(String genre)
	{
		this.genre.add(genre);
		return this;
	}

	public Movie(String imageURL, String title, int year)
	{
		this.internalID = UUID.randomUUID().toString();
		this.imageURL = imageURL;
		this.title = title;
		this.year = year;
	}

	public Movie addRating(Rating r)
	{
		r.parent = this;
		this.rating.add(r);
		return this;
	}
}


text:
<?php

class NoteController extends \BaseController
{

    /* rules for the form validator */
    private $rules = array(
        'title' => "required|min:3|max:100",
        'content' => 'required|min:10'
    );

    /**
     * create and return the new note writing form
     * @return writing note form view
     */
    public function getWritingForm($idcourse)
    {
        if ($this->canUserWriteNote($idcourse)) {
            $course = Courses::find($idcourse);

            return View::make('notes.writenote')->with(array('idcourse' => $idcourse, 'nomcours' => $course->getName())); //retourner le nom du cours plutot que son id
        }
    }

    /**
     * create and return the editing note view
     * @param $idnote the note id into database
     * @return editing view
     */
    public function getEditingForm($idnote)
    {
        if ($this->canUserDoActionOnNote($idnote, 'edit')) {
            $note = Manuscrits::find($idnote);
            return View::make('notes.editnote')->with(array('idnote' => $idnote, 'title' => $note->getTitle(), 'content' => $note->getContent()));
        }
        return Redirect::to('404');
    }

    /**
     * create and return the uploading form (view)
     * @param $idcourse
     * @return the uploading file view
     */
    public function getUploadingForm($idcourse)
    {
        if ($this->canUserWriteNote($idcourse)) {
            $course = Courses::find($idcourse);
            return View::make('notes.uploadnote')->with(array('idcourse' => $idcourse, 'course' => $course->name));
        }
        return Redirect::to('/unauthorized');
    }

    /**
     * insert the new note into database assuming the user having rights
     */
    public function saveNote($idcourse)
    {
        //assuming the user is connected cause of filter auth
        if ($this->canUserWriteNote($idcourse)) {

            $validator = Validator::make(Input::all(), $this->rules);

            if (!$validator->fails()) {
                $token = bin2hex(BaseNotes::getNewToken()); //generate a new token
                $note = BaseNotes::firstOrCreate(array('id_author' => Auth::id(), 'id_cours' => $idcourse, 'token' => $token)); //write in basenote
                Manuscrits::firstOrCreate(array('id_basenotes' => $note->getID(), 'content' => e(Input::get('content')), 'title' => e(Input::get('title')))); //store in manuscrits
                Session::put('toast', array('success', 'The note has been created.')); //insert message in session for toast message
                return Redirect::to('/courses/open/' . $idcourse);
            } else {
                return Redirect::to('/notes/write/' . $idcourse)->withErrors($validator)->withInput();
            }
        } else {
            return Redirect::to('/unauthorized');
        }
    }

    /**
     * Update the note content assuming the user having rights
     * @param $idnote the note id into database
     */
    public function updateNote($idnote)
    {
        $note = Manuscrits::find($idnote); //trying to get the manuscrit
        //if any note is found
        if (!is_null($note)) {
            if ($this->canUserDoActionOnNote($idnote, 'edit')) {
                $validator = Validator::make(Input::all(), $this->rules);

                //validate and store updates
                if (!$validator->fails()) {
                    $note->title = e(Input::get('title'));
                    $note->content = e(Input::get('content'));
                    $note->save();
                    $basenote = $note->getParent();
                    $idcourse = $basenote->id_cours;
                    Session::put('toast', array('success', 'The note has been updated.')); //toast message
                    return Redirect::to('courses/open/' . $idcourse);
                } else {
                    return Redirect::to('/notes/edit/' . $idnote)->withErrors($validator)->withInput();
                }
            } else {
                return Redirect::to('/unauthorized');
            }
        } else {
            return Redirect::to('/404');
        }
    }

    /**
     * Save an existing note assuming POST request was sent by AJAX and errors/success messages will be send back in a JSON object
     * @param $idnote The note's id to save (Manuscrit)
     */
    public function ajaxSaveNote($idnote)
    {
        $note = Manuscrits::find($idnote); //trying to get the note
        //check existence
        if (!is_null($note)) {
            if ($this->canUserDoActionOnNote($idnote, 'edit')) {
                $validator = Validator::make(Input::all(), $this->rules);
                //if everything ok update and save changes
                if (!$validator->fails()) {
                    $note->title = e(Input::get('title'));
                    $note->content = e(Input::get('content'));
                    $note->save();
                    return Response::json(array('success' => true, 'msg' => 'Note sucessfully saved')); //send success into a json response
                } else {
                    return Response::json(array('success' => false, 'errors' => $validator->messages()->all()), 400); // 400 being the HTTP code for an invalid request.
                }
            } else {
                return Response::json(array('success' => false, 'errors' => 'Insuffisant rights'), 400);
            }
        } else {
            return Response::json(array('success' => false, 'errors' => 'Note does not exist, unable to save'), 400);
        }
    }

    /**
     * remove the note given assuming user rights
     * @param $idnote the note id into database
     */
    public function removeNote($idnote)
    {
        //test if note exists
        $note = Manuscrits::find($idnote);
        if (!is_null($note)) {
            //get the basenote parent
            $basenote = $note->getParent();
            //if user can edit and read
            if ($this->canUserDoActionOnNote($idnote, 'edit')) {
                //deletion
                $idcourse = $basenote->id_cours;
                $basenote->delete();
                $note->delete();
                Session::put('toast', array('success', 'The note has been deleted.'));
                return Redirect::to('/courses/open/' . $idcourse);
            } else {
                return Redirect::to('/unauthorized');
            }
        } else {
            return Redirect::to('/404');
        }
    }

    /**
     * upload a new note file into the given course assuming the user having rights
     * @param $idcourse
     */
    public function uploadFileNote($idcourse)
    {
        //before all we have to check if user can uplaod anything in the course
        //writing a note is the same as upoad a file
        if ($this->canUserWriteNote($idcourse)) {
            if (input::hasFile('file')) {
                //we get all information that concern the course to get the directory hierarchy path
                $course = Courses::find($idcourse);
                $idclass = $course->getClassID();
                $class = Classes::find($idclass);
                $classname = $class->getName();
                $schollaryear = $class->getSchollarYear();
                $schoolname = $class->getSchoolName();
                $city = $class->getCityName();
                $file = Input::file('file');
                $path = '/uploads' . '/' . $city . '/' . $schoolname . '/' . $schollaryear . '/' . $classname;
                $destinationPath = public_path() . $path;
                $extension = $file->getClientOriginalExtension();
                $filename = str_random(12) . '.' . $extension;
                $original_filename = $file->getClientOriginalName();
                $fileMIME = $file->getMimeType();

                //files validator : max filesize and extensions
                $rules = array('file' => 'required|max:10000|mimes:doc,docx,txt,pdf,xls,xlsx,odt,jpeg,xml,png,jpg');
                $validator = Validator::make(Input::all(), $rules);

                if (!$validator->fails()) {
                    if ($file->isValid()) {
                        //laravel autommatically check if directory exists
                        $upload_success = Input::file('file')->move($destinationPath, $filename);
                        if ($upload_success) {
                            //if the upload is a success then insert into database the file
                            $token = bin2hex(BaseNotes::getNewToken());
                            $note = BaseNotes::firstOrCreate(array('id_author' => Auth::id(), 'id_cours' => $idcourse, 'token' => $token));
                            $file = Files::firstOrCreate(array('id_basenotes' => $note->getID(), 'path' => $path . '/' . $filename, 'original_filename' => $original_filename, 'mime' => $fileMIME));
                            Session::put('toast', array('success', 'The file has been uploaded.'));
                            return Redirect::to('/courses/open/' . $idcourse);
                        } else {
                            return Redirect::to('/notes/add/' . $idcourse)->withErrors(array('the file upload failed'));
                        }
                    } else {
                        return Redirect::to('/notes/add/' . $idcourse)->withErrors(array('The file was identified as invalid'));
                    }
                } else {
                    return Redirect::to('/notes/add/' . $idcourse)->withErrors($validator);
                }
            } else {
                return Redirect::to('/notes/add/' . $idcourse)->withErrors(array('No file was sent'));
            }
        } else return Redirect::to('/unauthorized');
    }

    /**
     * return the direct download file response
     * @param $idfile the file id that will be downloaded
     * @return
     */
    public function downloadFile($idfile)
    {
        $file = Files::find($idfile);
        if (!is_null($file)) {
            if ($this->canUserDoActionOnFile($idfile, 'read')) {
                $pathToFile = public_path() . $file->getPath();
                if (is_file($pathToFile)) {
                    return Response::download($pathToFile, $file->getOriginalName(), array($file->getMIMEType()));
                } else {
                    return Redirect::to('/404');
                }
            } else {
                return Redirect::to('/unauthorized');
            }
        }
        return Redirect::to('/404');
    }

    /**
     * Return the view that display a note for reading it
     * @param $idnote the note to display
     */
    public function readNote($idnote)
    {
        $note = Manuscrits::find($idnote);
        if (!is_null($note)) {
            if ($this->canUserDoActionOnNote($idnote, 'read')) {
                $basenote = $note->getParent();
                $author = User::find($basenote->id_author);
                if (!is_null($author)) {
                    $author_string = $author->getSignature();
                } else {
                    $author_string = 'unknown author';
                }
                $last_update = $note->updated_at;
                return View::make('notes.readnote')->with(array('author' => $author_string, 'update' => $last_update, 'title' => $note->title, 'content' => $note->content, 'idcourse' => $basenote->id_cours));
            } else {
                return Redirect::to('/unauthorized');
            }
        } else {
            return Redirect::to('/404');
        }
    }

    /**
     * Return the view or the download response to read/download a shared note (shared with token)
     * @param $token the note's token that is shared
     */
    public function readSharedNote($token)
    {
        //we get the basenote
        $basenote = BaseNotes::where('token', '=', $token)->first();
        //if basenote exists
        if (!is_null($basenote)) {
            //we try to get a written note
            $note = Manuscrits::where('id_basenotes', '=', $basenote->getID())->first();
            if (!is_null($note)) {
                $author = User::find($basenote->id_author);
                if (!is_null($author)) {
                    $author_string = $author->getSignature();
                } else {
                    $author_string = 'unknown author';
                }
                $last_update = $note->updated_at;
                //if a written note exists then we display it to user
                return View::make('notes.readsharednote')->with(array('author' => $author_string, 'update' => $last_update, 'title' => $note->title, 'content' => $note->content));
            }

            //we try to get a file if we didnt get a written not
            $file = Files::where('id_basenotes', '=', $basenote->getID())->first();
            if (!is_null($file)) {
                $pathToFile = public_path() . $file->getPath();
                if (is_file($pathToFile)) {
                    //if we get a file then we propose user to download it
                    return Response::download($pathToFile, $file->getOriginalName(), array($file->getMIMEType()));
                }
            }
        }
        //if nothing found then redirect to 404 page
        return Redirect::to('/404');
    }

    /**
     * Remove the file given (physic file and database entry) assuming user having rights
     * @param $idfile
     */
    public function removeFileNote($idfile)
    {
        $file = Files::find($idfile);
        if (!is_null($file)) {
            if ($this->canUserDoActionOnFile($idfile, 'edit')) {
                //if the file does exist
                if (is_file($file->path)) {
                    //delete it
                    chmod($file->path, 0777);
                    unlink($file->path);
                }
                //delete the bdd entry anyway
                $basenote = $file->getParent();
                $idcourse = $basenote->id_cours;
                $basenote->delete();
                $file->delete();
                Session::put('toast', array('success', 'The file has been deleted.'));
                return Redirect::to('courses/open/' . $idcourse);
            } else {
                return Redirect::to('/unauthorized');
            }
        } else {
            return Redirect::to('/404');
        }
    }

    /**
     * Check if user can write a note on a course (check the user's rights on the class given by the course)
     * @param $idcourse the course to test if user has rights
     * @return bool
     */
    private function canUserWriteNote($idcourse)
    {
        //check if user can write into course
        //get the class id from the course
        $course = Courses::find($idcourse);
        if (!is_null($course)) {
            $idclass = $course->getClassID();
            $class = Classes::find($idclass);
            $perms = $class->getPermissionsTab(Auth::id());

            //if user can write something this returns true else false
            return $perms['create'];
        }
        return false;
    }

    /**
     * Check if a user can proceed a given action on a written note
     * @param $idnote the note onto rights should be checked
     * @param $action given action read, create or edit
     * @return bool
     */
    private function canUserDoActionOnNote($idnote, $action)
    {
        $note = Manuscrits::find($idnote);
        //does the note exist
        if (!is_null($note)) {
            $basenote = $note->getParent();
            $course = Courses::find($basenote->getParentCourseID());
            $class = Classes::find($course->getClassID());

            //does the class exists
            if (!is_null($class)) {
                //get the perms
                $perms = $class->getPermissionsTab(Auth::Id());
                return $perms[$action];
            }
        }
        return false;
    }

    /**
     * Check if a user can proceed a given action on an uploaded file
     * @param $idfile the file onto rights should be checked
     * @param $action given action read, create or edit
     * @return bool
     */
    private function canUserDoActionOnFile($idfile, $action)
    {
        $file = Files::find($idfile);
        //does the note exist
        if (!is_null($file)) {
            $basenote = $file->getParent();
            $course = Courses::find($basenote->getParentCourseID());
            $class = Classes::find($course->getClassID());

            if (!is_null($class)) {
                $perms = $class->getPermissionsTab(Auth::Id());
                return $perms[$action];
            }
        }
        return false;
    }
}


text:
    /**
     * This is the control time panel
     * @param {videojs.Player|Object} player
     * @param {Object=} options
     * @constructor
     */
    videojs.ControlTimePanel = videojs.Component.extend({
        /** @constructor */
        init: function(player, options) {
            var controlTimePanelLeft, controlTimePanelRight;

            videojs.Component.call(this, player, options);

            controlTimePanelLeft = new videojs.ControlTimePanelLeft(player, options);
            this.addChild(controlTimePanelLeft);
            this.ControlTimePanelLeft = controlTimePanelLeft;

            controlTimePanelRight = new videojs.ControlTimePanelRight(player, options);
            this.addChild(controlTimePanelRight);
            this.ControlTimePanelRight = controlTimePanelRight;
        }
    });

    videojs.ControlTimePanel.prototype.init_ = function(rangeslider) {
        this.rs = rangeslider;
    };

    videojs.ControlTimePanel.prototype.options_ = {
        children: {
            'ControlTimePanelLeft': {},
            'ControlTimePanelRight': {},
        }
    };

    videojs.ControlTimePanel.prototype.createEl = function() {
        return videojs.Component.prototype.createEl.call(this, 'div', {
            className: 'vjs-controltimepanel-RS vjs-control',
        });
    };

    videojs.ControlTimePanel.prototype.enable = function(enable) {
        var enable = typeof enable != 'undefined' ? enable : true;
        this.rs.ctpl.el().children[0].disabled = enable ? "" : "disabled";
        this.rs.ctpl.el().children[1].disabled = enable ? "" : "disabled";
        this.rs.ctpl.el().children[2].disabled = enable ? "" : "disabled";
        this.rs.ctpr.el().children[0].disabled = enable ? "" : "disabled";
        this.rs.ctpr.el().children[1].disabled = enable ? "" : "disabled";
        this.rs.ctpr.el().children[2].disabled = enable ? "" : "disabled";
    };


text:
// .NAME vtk2DHistogramItem - 2D histogram item.
//
// .SECTION Description
//

#ifndef vtkPlotHistogram2D_h
#define vtkPlotHistogram2D_h

#include "vtkChartsCoreModule.h" // For export macro
#include "vtkPlot.h"
#include "vtkSmartPointer.h"  // Needed for SP ivars
#include "vtkRect.h"          // Needed for vtkRectf

class vtkImageData;
class vtkScalarsToColors;

class VTKCHARTSCORE_EXPORT vtkPlotHistogram2D : public vtkPlot
{
public:
  vtkTypeMacro(vtkPlotHistogram2D, vtkPlot);
  virtual void PrintSelf(ostream &os, vtkIndent indent);

  // Description:
  // Creates a new object.
  static vtkPlotHistogram2D *New();

  // Description:
  // Perform any updates to the item that may be necessary before rendering.
  // The scene should take care of calling this on all items before their
  // Paint function is invoked.
  virtual void Update();

  // Description:
  // Paint event for the item, called whenever it needs to be drawn.
  virtual bool Paint(vtkContext2D *painter);

  // Description:
  // Set the input, we are expecting a vtkImageData with just one component,
  // this would normally be a float or a double. It will be passed to the other
  // functions as a double to generate a color.
  virtual void SetInputData(vtkImageData *data, vtkIdType z = 0);
  virtual void SetInputData(vtkTable*) { }
  virtual void SetInputData(vtkTable*, const vtkStdString&, const vtkStdString&) { }

  // Description:
  // Get the input table used by the plot.
  vtkImageData * GetInputImageData();

  // Description:
  // Set the color transfer function that will be used to generate the 2D
  // histogram.
  void SetTransferFunction(vtkScalarsToColors *transfer);

  // Description:
  // Get the color transfer function that is used to generate the histogram.
  vtkScalarsToColors * GetTransferFunction();

  virtual void GetBounds(double bounds[4]);

  virtual void SetPosition(const vtkRectf& pos);
  virtual vtkRectf GetPosition();

//BTX
  // Description:
  // Generate and return the tooltip label string for this plot
  // The segmentIndex parameter is ignored.
  // The member variable TooltipLabelFormat can be set as a
  // printf-style string to build custom tooltip labels from,
  // and may contain:
  // An empty string generates the default tooltip labels.
  // The following case-sensitive format tags (without quotes) are recognized:
  //   '%x' The X position of the histogram cell
  //   '%y' The Y position of the histogram cell
  //   '%v' The scalar value of the histogram cell
  //   Note: the %i and %j tags are valid only if there is a 1:1 correspondence
  //         between individual histogram cells and axis tick marks
  //   '%i' The X axis tick label for the histogram cell
  //   '%j' The Y axis tick label for the histogram cell
  // Any other characters or unrecognized format tags are printed in the
  // tooltip label verbatim.
  virtual vtkStdString GetTooltipLabel(const vtkVector2d &plotPos,
                                       vtkIdType seriesIndex,
                                       vtkIdType segmentIndex);

  // Description:
  // Function to query a plot for the nearest point to the specified coordinate.
  // Returns an index between 0 and (number of histogram cells - 1), or -1.
  // The index 0 is at cell x=0, y=0 of the histogram, and the index increases
  // in a minor fashon with x and in a major fashon with y.
  // The referent of "location" is set to the x and y integer indices of the
  // histogram cell.
  virtual vtkIdType GetNearestPoint(const vtkVector2f& point,
                                    const vtkVector2f& tolerance,
                                    vtkVector2f* location);

protected:
  vtkPlotHistogram2D();
  ~vtkPlotHistogram2D();

  // Description:
  // Where all the magic happens...
  void GenerateHistogram();

  vtkSmartPointer<vtkImageData> Input;
  vtkSmartPointer<vtkImageData> Output;
  vtkSmartPointer<vtkScalarsToColors> TransferFunction;
  vtkRectf Position;

private:
  vtkPlotHistogram2D(const vtkPlotHistogram2D &); // Not implemented.
  void operator=(const vtkPlotHistogram2D &); // Not implemented.

//ETX
};

#endif //vtkPlotHistogram2D_h