text:
package server

import (
	"github.com/cri-o/cri-o/internal/log"
	"golang.org/x/net/context"
	pb "k8s.io/cri-api/pkg/apis/runtime/v1alpha2"
)

// StopPodSandbox stops the sandbox. If there are any running containers in the
// sandbox, they should be force terminated.
func (s *Server) StopPodSandbox(ctx context.Context, req *pb.StopPodSandboxRequest) (resp *pb.StopPodSandboxResponse, err error) {
	// platform dependent call
	return s.stopPodSandbox(ctx, req)
}

// stopAllPodSandboxes removes all pod sandboxes
func (s *Server) stopAllPodSandboxes(ctx context.Context) {
	log.Debugf(ctx, "stopAllPodSandboxes")
	for _, sb := range s.ContainerServer.ListSandboxes() {
		pod := &pb.StopPodSandboxRequest{
			PodSandboxId: sb.ID(),
		}
		if _, err := s.StopPodSandbox(ctx, pod); err != nil {
			log.Warnf(ctx, "could not StopPodSandbox %s: %v", sb.ID(), err)
		}
	}
}


text:
cask 'font-averia-libre' do
  version :latest
  sha256 :no_check

  # github.com/google/fonts was verified as official when first introduced to the cask
  url 'https://github.com/google/fonts/trunk/ofl/averialibre',
      using:      :svn,
      revision:   '50',
      trust_cert: true
  name 'Averia Libre'
  homepage 'http://www.google.com/fonts/specimen/Averia%20Libre'

  font 'AveriaLibre-Bold.ttf'
  font 'AveriaLibre-BoldItalic.ttf'
  font 'AveriaLibre-Italic.ttf'
  font 'AveriaLibre-Light.ttf'
  font 'AveriaLibre-LightItalic.ttf'
  font 'AveriaLibre-Regular.ttf'
end

redpajama_set_name: RedPajamaGithub


text:
#include "config.h"
#include "core/frame/DOMWindowTimers.h"

#include "bindings/core/v8/V8GCForContextDispose.h"
#include "core/dom/Document.h"
#include "core/dom/ExecutionContext.h"
#include "core/events/EventTarget.h"
#include "core/frame/DOMTimer.h"
#include "core/frame/csp/ContentSecurityPolicy.h"
#include "core/workers/WorkerGlobalScope.h"

namespace blink {

namespace DOMWindowTimers {

static bool isAllowed(ExecutionContext* executionContext, bool isEval)
{
    if (executionContext->isDocument()) {
        Document* document = static_cast<Document*>(executionContext);
        if (isEval && !document->contentSecurityPolicy()->allowEval())
            return false;
        return true;
    }
    if (executionContext->isWorkerGlobalScope()) {
        WorkerGlobalScope* workerGlobalScope = static_cast<WorkerGlobalScope*>(executionContext);
        if (!workerGlobalScope->script())
            return false;
        ContentSecurityPolicy* policy = workerGlobalScope->contentSecurityPolicy();
        if (isEval && policy && !policy->allowEval())
            return false;
        return true;
    }
    ASSERT_NOT_REACHED();
    return false;
}

int setTimeout(ScriptState* scriptState, EventTarget& eventTarget, const ScriptValue& handler, int timeout, const Vector<ScriptValue>& arguments)
{
    ExecutionContext* executionContext = eventTarget.executionContext();
    if (!isAllowed(executionContext, false))
        return 0;
    if (timeout >= 0 && executionContext->isDocument()) {
        // FIXME: Crude hack that attempts to pass idle time to V8. This should
        // be done using the scheduler instead.
        V8GCForContextDispose::instance().notifyIdle();
    }
    OwnPtrWillBeRawPtr<ScheduledAction> action = ScheduledAction::create(scriptState, handler, arguments);
    return DOMTimer::install(executionContext, action.release(), timeout, true);
}

int setTimeout(ScriptState* scriptState, EventTarget& eventTarget, const String& handler, int timeout, const Vector<ScriptValue>&)
{
    ExecutionContext* executionContext = eventTarget.executionContext();
    if (!isAllowed(executionContext, true))
        return 0;
    // Don't allow setting timeouts to run empty functions.  Was historically a
    // perfomance issue.
    if (handler.isEmpty())
        return 0;
    if (timeout >= 0 && executionContext->isDocument()) {
        // FIXME: Crude hack that attempts to pass idle time to V8. This should
        // be done using the scheduler instead.
        V8GCForContextDispose::instance().notifyIdle();
    }
    OwnPtrWillBeRawPtr<ScheduledAction> action = ScheduledAction::create(scriptState, handler);
    return DOMTimer::install(executionContext, action.release(), timeout, true);
}

int setInterval(ScriptState* scriptState, EventTarget& eventTarget, const ScriptValue& handler, int timeout, const Vector<ScriptValue>& arguments)
{
    ExecutionContext* executionContext = eventTarget.executionContext();
    if (!isAllowed(executionContext, false))
        return 0;
    OwnPtrWillBeRawPtr<ScheduledAction> action = ScheduledAction::create(scriptState, handler, arguments);
    return DOMTimer::install(executionContext, action.release(), timeout, false);
}

int setInterval(ScriptState* scriptState, EventTarget& eventTarget, const String& handler, int timeout, const Vector<ScriptValue>&)
{
    ExecutionContext* executionContext = eventTarget.executionContext();
    if (!isAllowed(executionContext, true))
        return 0;
    // Don't allow setting timeouts to run empty functions.  Was historically a
    // perfomance issue.
    if (handler.isEmpty())
        return 0;
    OwnPtrWillBeRawPtr<ScheduledAction> action = ScheduledAction::create(scriptState, handler);
    return DOMTimer::install(executionContext, action.release(), timeout, false);
}

void clearTimeout(EventTarget& eventTarget, int timeoutID)
{
    if (ExecutionContext* context = eventTarget.executionContext())
        DOMTimer::removeByID(context, timeoutID);
}

void clearInterval(EventTarget& eventTarget, int timeoutID)
{
    if (ExecutionContext* context = eventTarget.executionContext())
        DOMTimer::removeByID(context, timeoutID);
}

} // namespace DOMWindowTimers

} // namespace blink


text:
package io.werval.filters;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;

import io.werval.api.context.Context;
import io.werval.api.filters.FilterChain;
import io.werval.api.filters.FilterWith;
import io.werval.api.outcomes.Outcome;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static io.werval.util.Strings.EMPTY;
import static io.werval.util.Strings.isEmpty;

/**
 * Set Header Annotation.
 *
 * @navassoc 1 apply 1 Filter
 */
@FilterWith( SetHeader.Filter.class )
@Target( { ElementType.METHOD, ElementType.TYPE } )
@Retention( RetentionPolicy.RUNTIME )
@Inherited
@Documented
@Repeatable( SetHeader.Repeat.class )
public @interface SetHeader
{
    /**
     * @return Name of the header to set
     */
    String name();

    /**
     * @return Values to set for the header
     */
    String[] values();

    /**
     * Set Header Filter.
     */
    public static class Filter
        implements io.werval.api.filters.Filter<SetHeader>
    {
        private static final Logger LOG = LoggerFactory.getLogger( Filter.class );

        @Override
        public CompletableFuture<Outcome> filter( FilterChain chain, Context context, Optional<SetHeader> annotation )
        {
            return chain.next( context ).thenApply(
                (outcome) ->
                {
                    String name = annotation.map( annot -> annot.name() ).orElse( EMPTY );
                    String[] values = annotation.map( annot -> annot.values() ).orElse( new String[ 0 ] );
                    if( isEmpty( name ) )
                    {
                        LOG.warn( "@SetHeader name is not set, not setting any header." );
                        return outcome;
                    }
                    if( values.length < 1 )
                    {
                        LOG.warn( "@SetHeader has no values, not setting any header." );
                        return outcome;
                    }
                    outcome.responseHeader().headers().withAll( name, values );
                    return outcome;
                }
            );
        }
    }

    /**
     * SetHeader repeatable annotation support.
     *
     * @navassoc 1 repeat * SetHeader
     */
    @Retention( RetentionPolicy.RUNTIME )
    @Target( { ElementType.METHOD, ElementType.TYPE } )
    @Inherited
    @Documented
    public static @interface Repeat
    {
        SetHeader[] value();
    }
}


text:
class Game
{
public:
	Game(int width, int height);

	void init();

	void handleEvent(const SDL_Event& event);
	void update(Uint32 delta);
	void render();

private:
	void loadShaders();
	void loadTextures();
	void loadAudio();
	void setupDefaultMatrices();

	void handleKeyPress(SDL_Keycode key);
	void handleKeyRelease(SDL_Keycode key);

public:
	static int WIDTH;
	static int HEIGHT;
};

#endif


text:
<?php

namespace PersonApi\Service\Mapper;

use DvsaCommon\ApiClient\UserInbox\Dto\UserInboxDto;
use DvsaCommon\Enum\SpecialNoticeMessageTypeCode;
use PersonApi\Repository\UserMessage;

class UserInboxMessagesMapper
{
    /**
     * @param array $data
     *
     * @return UserInboxDto[]
     */
    public function mapMany(array $data, $isTradeUser){

        $userMessages = [];

        foreach ($data as $item ){
            $userMessages[] = $this->toDto($item, $isTradeUser);
        }

        return $userMessages;
    }

    /**
     * @param UserMessage $message
     *
     * @return UserInboxDto
     */
    private function toDto(UserMessage $message, $isTradeUser)
    {
        $messageDto = new UserInboxDto();

        $messageDto->setId($message->getId());
        $messageDto->setMessageType($message->getMessageType());
        $messageDto->setTitle($message->getTitle());
        $messageDto->setIsRead($message->getIsRead());
        $messageDto->setCreatedOn($message->getCreatedOn());

        if ($message->getMessageType() == SpecialNoticeMessageTypeCode::SPECIAL_NOTICE) {

            $messageDto->setIssueNumber($message->getIssueNumber() . '-' . $message->getIssueYear());

            if ($message->getDaysToAction() < 0) {
                $messageDto->setDaysToAction(0);
            }
            else {
                $messageDto->setDaysToAction($message->getDaysToAction());
            }

            if ($isTradeUser) {
                $messageDto->setIsActionRequired(!$message->getIsAcknowledged());
            }
            else {
                $messageDto->setIsActionRequired(false);
            }
        }
        else {
            $messageDto->setIsActionRequired($message->getIsActionRequired());
        }

        return $messageDto;
    }
}


text:
package net.sf.farrago.test;

import java.util.*;

import junit.framework.*;

import org.jgrapht.*;
import org.jgrapht.graph.*;

/**
 * Jdk15Test tests language features introduced in JDK 1.5. It is excluded from
 * compilation when src="1.4" is passed to javac.
 *
 * @author John V. Sichi
 * @version $Id$
 */
public class Jdk15Test
    extends TestCase
{
    //~ Constructors -----------------------------------------------------------

    public Jdk15Test(String testName)
    {
        super(testName);
    }

    //~ Methods ----------------------------------------------------------------

    public void testGenericCollections()
    {
        List<String> words = new ArrayList<String>();
        words.add("left");
        words.add("right");
        words.add("drat");

        // remove four-letter words
        Iterator<String> iter = words.iterator();
        while (iter.hasNext()) {
            String s = iter.next();
            if (s.length() == 4) {
                iter.remove();
            }
        }

        assertEquals(
            1,
            words.size());
        assertEquals(
            "right",
            words.get(0));
    }

    public void testForeach()
    {
        List<String> words = new ArrayList<String>();
        words.add("oingo");
        words.add("boingo");
        words.add("ringo");

        for (String s : words) {
            assertTrue(s.endsWith("ingo"));
        }
    }

    public void testGraphGenerics()
    {
        Graph<String, DefaultEdge> graph =
            new SimpleGraph<String, DefaultEdge>(DefaultEdge.class);
        graph.addVertex("Absalom");
        graph.addVertex("Achitophel");
        graph.addEdge("Absalom", "Achitophel");
        String s = graph.vertexSet().iterator().next();
        assertTrue(s.startsWith("A"));
    }
}

// End Jdk15Test.java


text:
<?php

namespace MediaWiki\HttpClient;

interface HttpClientInterface
{
    /**
     * Constructor.
     *
     * @param array $cookies
     * @param array $headers
     */
    public function __construct(array $cookies = [], array $headers = []);

    /**
     * Makes a HTTP request to the specified URL with the specified parameters.
     *
     * @param string $method
     * @param string $url
     * @param array  $parameters
     * @param array  $headers
     * @param array  $cookies
     *
     * @return string
     */
    public function request($method, $url, array $parameters = [], array $headers = [], array $cookies = []);

    /**
     * Makes a GET HTTP request to the specified URL.
     *
     * @param string $url
     * @param array $parameters
     * @param array  $headers
     * @param array  $cookies
     *
     * @return string
     */
    public function get($url, array $parameters = [], array $headers = [], array $cookies = []);

    /**
     * Makes a POST HTTP request to the specified URL.
     *
     * @param string $url
     * @param array $parameters
     * @param array  $headers
     * @param array  $cookies
     *
     * @return string
     */
    public function post($url, array $parameters = [], array $headers = [], array $cookies = []);

    /**
     * Returns received cookies.
     *
     * @return array
     */
    public function getCookies();
}


text:
<?php

namespace AppBundle\Admin;

use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Form\FormMapper;

class BannerFeedbackAdmin extends Admin
{
    /**
     * Fields to be shown on create/edit forms
     */
    protected function configureFormFields(FormMapper $formMapper)
    {
        $formMapper->with('BannerFeedback');
        $formMapper->add('banner');
        $formMapper->add('rating');
        $formMapper->add('message');
        $formMapper->end();
    }

    /**
     * Fields to be shown on filter forms
     */
    protected function configureDatagridFilters(DatagridMapper $datagridMapper)
    {
        $datagridMapper->add('id');
        $datagridMapper->add('banner');
        $datagridMapper->add('rating');
    }

    /**
     * Fields to be shown on lists
     */
    protected function configureListFields(ListMapper $listMapper)
    {
        $listMapper->addIdentifier('id');
        $listMapper->addIdentifier('banner');
        $listMapper->addIdentifier('rating');
        $listMapper->addIdentifier('message');
        $listMapper->addIdentifier('created');
    }

}


text:
@interface UIButton (JFFramework_Private)

#pragma mark Methods

// User interface management (Actions)
- (void)	jf_buttonTapped:(UIButton*)button;

@end

#pragma mark

@implementation UIButton (JFFramework_Private)

#pragma mark User interface management (Actions)

- (void)jf_buttonTapped:(UIButton*)button
{
	JFButtonBlock block = self.jf_actionBlock;
	if(block)
		block(self);
}

@end

#pragma mark

@implementation UIButton (JFFramework)

#pragma mark Properties accessors (User interface)

- (JFButtonBlock)jf_actionBlock
{
	return objc_getAssociatedObject(self, @selector(jf_actionBlock));
}

- (void)jf_setActionBlock:(JFButtonBlock)block
{
	[self removeTarget:self action:@selector(jf_buttonTapped:) forControlEvents:UIControlEventTouchUpInside];
	[self addTarget:self action:@selector(jf_buttonTapped:) forControlEvents:UIControlEventTouchUpInside];
	objc_setAssociatedObject(self, @selector(jf_actionBlock), block, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}

@end


text:
Game Leaders

                Points
                Rebounds
                Assists

                        {{awayName}}
                        {{awayShortName}}

                         {{awayName}}

                        {{leaders[awayTeamSeasonId].points.displayName}}: {{leaders[awayTeamSeasonId].points.value}}

                        {{leaders[awayTeamSeasonId].rebounds.displayName}}: {{leaders[awayTeamSeasonId].rebounds.value}}

                        {{leaders[awayTeamSeasonId].assists.displayName}}: {{leaders[awayTeamSeasonId].assists.value}}

                        {{homeName}}
                        {{homeShortName}}

                         {{homeName}}

                        {{leaders[homeTeamSeasonId].points.displayName}}: {{leaders[homeTeamSeasonId].points.value}}

                        {{leaders[homeTeamSeasonId].rebounds.displayName}}: {{leaders[homeTeamSeasonId].rebounds.value}}

                        {{leaders[homeTeamSeasonId].assists.displayName}}: {{leaders[homeTeamSeasonId].assists.value}}

                        {{awayName}}
                        {{awayShortName}}

                         {{awayShortName}}

                    Pts:

                        {{leaders[awayTeamSeasonId].points.displayName}}: {{leaders[awayTeamSeasonId].points.value}}

                        Reb:

                            {{leaders[awayTeamSeasonId].rebounds.displayName}}: {{leaders[awayTeamSeasonId].rebounds.value}}

                        Ast:

                            {{leaders[awayTeamSeasonId].assists.displayName}}: {{leaders[awayTeamSeasonId].assists.value}}

                        {{homeName}}
                        {{homeShortName}}

                         {{homeShortName}}

                    Pts:

                        {{leaders[homeTeamSeasonId].points.displayName}}: {{leaders[homeTeamSeasonId].points.value}}

                    Reb:

                        {{leaders[homeTeamSeasonId].rebounds.displayName}}: {{leaders[homeTeamSeasonId].rebounds.value}}

                    Ast:

                        {{leaders[homeTeamSeasonId].assists.displayName}}: {{leaders[homeTeamSeasonId].assists.value}}


text:
import React from 'react';
import PropTypes from 'prop-types';

export default class NodeCountSetting extends React.Component {

  handleNodeCountChange = (event) => {
    this.props.onAlterNodeCount(event);
  };

  render() {
    return (

Number of nodes to be added to the cluster (including this one)

        <input
          className="setup-input-nodecount"
          value={this.props.nodeCount}
          onChange={this.handleNodeCountChange}
          placeholder="Value of cluster n"
          type="text"/>

    );
  }
}

NodeCountSetting.propTypes = {
  onAlterNodeCount: PropTypes.func.isRequired,
  nodeCount: PropTypes.number.isRequired
};


text:
<?php

/*
|--------------------------------------------------------------------------
| Nova Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used by
| the validator class. Some of these rules have multiple versions such
| as the size rules. Feel free to tweak each of these messages here.
|
*/

return [
    'attached'  => 'Ин майдон аллакай прикреплено.',
    'relatable' => 'Ин соҳа метавонад на вобаста ба маълумотҳои захираҳо.',
];


text:
// +build !ignore_autogenerated

// Code generated by controller-gen. DO NOT EDIT.

package v1alpha1

import (
	"k8s.io/apimachinery/pkg/runtime"
	"knative.dev/pkg/apis"
	"knative.dev/pkg/apis/duck/v1"
)

// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ModelSpec) DeepCopyInto(out *ModelSpec) {
	*out = *in
	out.Memory = in.Memory.DeepCopy()
}

// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModelSpec.
func (in *ModelSpec) DeepCopy() *ModelSpec {
	if in == nil {
		return nil
	}
	out := new(ModelSpec)
	in.DeepCopyInto(out)
	return out
}

// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *TrainedModel) DeepCopyInto(out *TrainedModel) {
	*out = *in
	out.TypeMeta = in.TypeMeta
	in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
	in.Spec.DeepCopyInto(&out.Spec)
	in.Status.DeepCopyInto(&out.Status)
}

// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrainedModel.
func (in *TrainedModel) DeepCopy() *TrainedModel {
	if in == nil {
		return nil
	}
	out := new(TrainedModel)
	in.DeepCopyInto(out)
	return out
}

// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *TrainedModel) DeepCopyObject() runtime.Object {
	if c := in.DeepCopy(); c != nil {
		return c
	}
	return nil
}

// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *TrainedModelList) DeepCopyInto(out *TrainedModelList) {
	*out = *in
	out.TypeMeta = in.TypeMeta
	in.ListMeta.DeepCopyInto(&out.ListMeta)
	if in.Items != nil {
		in, out := &in.Items, &out.Items
		*out = make([]TrainedModel, len(*in))
		for i := range *in {
			(*in)[i].DeepCopyInto(&(*out)[i])
		}
	}
}

// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrainedModelList.
func (in *TrainedModelList) DeepCopy() *TrainedModelList {
	if in == nil {
		return nil
	}
	out := new(TrainedModelList)
	in.DeepCopyInto(out)
	return out
}

// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *TrainedModelList) DeepCopyObject() runtime.Object {
	if c := in.DeepCopy(); c != nil {
		return c
	}
	return nil
}

// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *TrainedModelSpec) DeepCopyInto(out *TrainedModelSpec) {
	*out = *in
	in.Model.DeepCopyInto(&out.Model)
}

// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrainedModelSpec.
func (in *TrainedModelSpec) DeepCopy() *TrainedModelSpec {
	if in == nil {
		return nil
	}
	out := new(TrainedModelSpec)
	in.DeepCopyInto(out)
	return out
}

// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *TrainedModelStatus) DeepCopyInto(out *TrainedModelStatus) {
	*out = *in
	in.Status.DeepCopyInto(&out.Status)
	if in.URL != nil {
		in, out := &in.URL, &out.URL
		*out = new(apis.URL)
		(*in).DeepCopyInto(*out)
	}
	if in.Address != nil {
		in, out := &in.Address, &out.Address
		*out = new(v1.Addressable)
		(*in).DeepCopyInto(*out)
	}
}

// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrainedModelStatus.
func (in *TrainedModelStatus) DeepCopy() *TrainedModelStatus {
	if in == nil {
		return nil
	}
	out := new(TrainedModelStatus)
	in.DeepCopyInto(out)
	return out
}


text:
<title>OGRE: Ogre::Viewport Class Reference - OGRE Documentation</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link type="text/css" rel="stylesheet" href="doxygen.css">
<link type="text/css" rel="stylesheet" href="tabs.css">

Main Page

Related Pages

Modules

Namespaces

Classes

Files

Directories

Class List

Class Index

Class Hierarchy

Class Members

Ogre

Viewport

Public Member Functions |
Static Public Member Functions |
Protected Attributes |
Static Protected Attributes

Ogre::Viewport Class Reference
RenderSystem

An abstraction of a viewport, i.e.
 More...

#include <OgreViewport.h>

Inheritance diagram for Ogre::Viewport:

<map name="Ogre_1_1Viewport_inherit__map" id="Ogre_1_1Viewport_inherit__map">
<area shape="rect" id="node2" href="classOgre_1_1AllocatedObject.html" title="Superclass for all objects that wish to use custom memory allocators when their new / delete operator..." alt="" coords="9,5,111,35"/></map>
[legend]

List of all members.

Public Member Functions

 	Viewport (Camera *camera, RenderTarget *target, Real left, Real top, Real width, Real height, int ZOrder)

 	The usual constructor.

virtual 	~Viewport ()

 	Default destructor.

void 	_updateDimensions (void)

 	Notifies the viewport of a possible change in dimensions.

void 	update (void)

 	Instructs the viewport to updates its contents.

void 	clear (unsigned int buffers=FBT_COLOUR|FBT_DEPTH, const ColourValue &colour=ColourValue::Black, Real depth=1.0f, unsigned short stencil=0)

 	Instructs the viewport to clear itself, without performing an update.

RenderTarget * 	getTarget (void) const

 	Retrieves a pointer to the render target for this viewport.

Camera * 	getCamera (void) const

 	Retrieves a pointer to the camera for this viewport.

void 	setCamera (Camera *cam)

 	Sets the camera to use for rendering to this viewport.

int 	getZOrder (void) const

 	Gets the Z-Order of this viewport.

Real 	getLeft (void) const

 	Gets one of the relative dimensions of the viewport, a value between 0.0 and 1.0.

Real 	getTop (void) const

 	Gets one of the relative dimensions of the viewport, a value between 0.0 and 1.0.

Real 	getWidth (void) const

 	Gets one of the relative dimensions of the viewport, a value between 0.0 and 1.0.

Real 	getHeight (void) const

 	Gets one of the relative dimensions of the viewport, a value between 0.0 and 1.0.

int 	getActualLeft (void) const

 	Gets one of the actual dimensions of the viewport, a value in pixels.

int 	getActualTop (void) const

 	Gets one of the actual dimensions of the viewport, a value in pixels.

int 	getActualWidth (void) const

 	Gets one of the actual dimensions of the viewport, a value in pixels.

int 	getActualHeight (void) const

 	Gets one of the actual dimensions of the viewport, a value in pixels.

void 	setDimensions (Real left, Real top, Real width, Real height)

 	Sets the dimensions (after creation).

void 	setOrientationMode (OrientationMode orientationMode, bool setDefault=true)

 	Set the orientation mode of the viewport.

OrientationMode 	getOrientationMode () const

 	Get the orientation mode of the viewport.

void 	setBackgroundColour (const ColourValue &colour)

 	Sets the initial background colour of the viewport (before rendering).

const ColourValue & 	getBackgroundColour (void) const

 	Gets the background colour.

void 	setClearEveryFrame (bool clear, unsigned int buffers=FBT_COLOUR|FBT_DEPTH)

 	Determines whether to clear the viewport before rendering.

bool 	getClearEveryFrame (void) const

 	Determines if the viewport is cleared before every frame.

unsigned int 	getClearBuffers (void) const

 	Gets which buffers are to be cleared each frame.

void 	setAutoUpdated (bool autoupdate)

 	Sets whether this viewport should be automatically updated if Ogre's rendering loop or RenderTarget::update is being used.

bool 	isAutoUpdated () const

 	Gets whether this viewport is automatically updated if Ogre's rendering loop or RenderTarget::update is being used.

void 	setMaterialScheme (const String &schemeName)

 	Set the material scheme which the viewport should use.

const String & 	getMaterialScheme (void) const

 	Get the material scheme which the viewport should use.

void 	getActualDimensions (int &left, int &top, int &width, int &height) const

 	Access to actual dimensions (based on target size).

bool 	_isUpdated (void) const

void 	_clearUpdatedFlag (void)

unsigned int 	_getNumRenderedFaces (void) const

 	Gets the number of rendered faces in the last update.

unsigned int 	_getNumRenderedBatches (void) const

 	Gets the number of rendered batches in the last update.

void 	setOverlaysEnabled (bool enabled)

 	Tells this viewport whether it should display Overlay objects.

bool 	getOverlaysEnabled (void) const

 	Returns whether or not Overlay objects (created in the SceneManager) are displayed in this viewport.

void 	setSkiesEnabled (bool enabled)

 	Tells this viewport whether it should display skies.

bool 	getSkiesEnabled (void) const

 	Returns whether or not skies (created in the SceneManager) are displayed in this viewport.

void 	setShadowsEnabled (bool enabled)

 	Tells this viewport whether it should display shadows.

bool 	getShadowsEnabled (void) const

 	Returns whether or not shadows (defined in the SceneManager) are displayed in this viewport.

void 	setVisibilityMask (uint32 mask)

 	Sets a per-viewport visibility mask.

uint 	getVisibilityMask (void) const

 	Gets a per-viewport visibility mask.

virtual void 	setRenderQueueInvocationSequenceName (const String &sequenceName)

 	Sets the use of a custom RenderQueueInvocationSequence for rendering this target.

virtual const String & 	getRenderQueueInvocationSequenceName (void) const

 	Gets the name of the render queue invocation sequence for this target.

RenderQueueInvocationSequence * 	_getRenderQueueInvocationSequence (void)

 	Get the invocation sequence - will return null if using standard.

void 	pointOrientedToScreen (const Vector2 &v, int orientationMode, Vector2 &outv)

 	Convert oriented input point coordinates to screen coordinates.

void 	pointOrientedToScreen (Real orientedX, Real orientedY, int orientationMode, Real &screenX, Real &screenY)

void * 	operator new (size_t sz, const char *file, int line, const char *func)

 	operator new, with debug line info

void * 	operator new (size_t sz)

void * 	operator new (size_t sz, void *ptr)

 	placement operator new

void * 	operator new[] (size_t sz, const char *file, int line, const char *func)

 	array operator new, with debug line info

void * 	operator new[] (size_t sz)

void 	operator delete (void *ptr)

void 	operator delete (void *ptr, void *)

void 	operator delete (void *ptr, const char *, int, const char *)

void 	operator delete[] (void *ptr)

void 	operator delete[] (void *ptr, const char *, int, const char *)

Static Public Member Functions

static void 	setDefaultOrientationMode (OrientationMode orientationMode)

 	Set the initial orientation mode of viewports.

static OrientationMode 	getDefaultOrientationMode ()

 	Get the initial orientation mode of viewports.

Protected Attributes

Camera * 	mCamera

RenderTarget * 	mTarget

float 	mRelLeft

float 	mRelTop

float 	mRelWidth

float 	mRelHeight

int 	mActLeft

int 	mActTop

int 	mActWidth

int 	mActHeight

int 	mZOrder

 	ZOrder.

ColourValue 	mBackColour

 	Background options.

bool 	mClearEveryFrame

unsigned int 	mClearBuffers

bool 	mUpdated

bool 	mShowOverlays

bool 	mShowSkies

bool 	mShowShadows

uint32 	mVisibilityMask

String 	mRQSequenceName

RenderQueueInvocationSequence * 	mRQSequence

String 	mMaterialSchemeName

 	Material scheme.

OrientationMode 	mOrientationMode

 	Viewport orientation mode.

bool 	mIsAutoUpdated

 	Automatic rendering on/off.

Static Protected Attributes

static OrientationMode 	mDefaultOrientationMode

Detailed Description

An abstraction of a viewport, i.e.

a rendering region on a render target.

Remarks:

A viewport is the meeting of a camera and a rendering surface - the camera renders the scene from a viewpoint, and places its results into some subset of a rendering target, which may be the whole surface or just a part of the surface. Each viewport has a single camera as source and a single target as destination. A camera only has 1 viewport, but a render target may have several. A viewport also has a Z-order, i.e. if there is more than one viewport on a single render target and they overlap, one must obscure the other in some predetermined way.

Definition at line 56 of file OgreViewport.h.

Constructor & Destructor Documentation

          Ogre::Viewport::Viewport
          (
          Camera *
          camera,

          RenderTarget *
          target,

          Real
          left,

          Real
          top,

          Real
          width,

          Real
          height,

          int
          ZOrder

          )

The usual constructor.

Parameters:

cam	Pointer to a camera to be the source for the image.

target	Pointer to the render target to be the destination for the rendering.

left

top

width

height	Dimensions of the viewport, expressed as a value between 0 and 1. This allows the dimensions to apply irrespective of changes in the target's size: e.g. to fill the whole area, values of 0,0,1,1 are appropriate.

ZOrder	Relative Z-order on the target. Lower = further to the front.

          virtual Ogre::Viewport::~Viewport
          (
          	)
           [virtual]

Default destructor.

Member Function Documentation

          void Ogre::Viewport::_clearUpdatedFlag
          (
          void
          	)

          unsigned int Ogre::Viewport::_getNumRenderedBatches
          (
          void
          	)
           const

Gets the number of rendered batches in the last update.

          unsigned int Ogre::Viewport::_getNumRenderedFaces
          (
          void
          	)
           const

Gets the number of rendered faces in the last update.

          RenderQueueInvocationSequence* Ogre::Viewport::_getRenderQueueInvocationSequence
          (
          void
          	)

Get the invocation sequence - will return null if using standard.

          bool Ogre::Viewport::_isUpdated
          (
          void
          	)
           const

          void Ogre::Viewport::_updateDimensions
          (
          void
          	)

Notifies the viewport of a possible change in dimensions.

Remarks:

Used by the target to update the viewport's dimensions (usually the result of a change in target size).

Note:

Internal use by Ogre only.

          void Ogre::Viewport::clear
          (
          unsigned int
          buffers = FBT_COLOUR|FBT_DEPTH,

          const ColourValue &
          colour = ColourValue::Black,

          Real
          depth = 1.0f,

          unsigned short
          stencil = 0

          )

Instructs the viewport to clear itself, without performing an update.

Remarks:

You would not normally call this method when updating the viewport, since the viewport usually clears itself when updating anyway (

See also:

Viewport::setClearEveryFrame). However, if you wish you have the option of manually clearing the frame buffer (or elements of it) using this method.

Parameters:

buffers	Bitmask identifying which buffer elements to clear

colour	The colour value to clear to, if FBT_COLOUR is included

depth	The depth value to clear to, if FBT_DEPTH is included

stencil	The stencil value to clear to, if FBT_STENCIL is included

          void Ogre::Viewport::getActualDimensions
          (
          int &
          left,

          int &
          top,

          int &
          width,

          int &
          height

          )
          	 const

Access to actual dimensions (based on target size).

          int Ogre::Viewport::getActualHeight
          (
          void
          	)
           const

Gets one of the actual dimensions of the viewport, a value in pixels.

          int Ogre::Viewport::getActualLeft
          (
          void
          	)
           const

Gets one of the actual dimensions of the viewport, a value in pixels.

          int Ogre::Viewport::getActualTop
          (
          void
          	)
           const

Gets one of the actual dimensions of the viewport, a value in pixels.

          int Ogre::Viewport::getActualWidth
          (
          void
          	)
           const

Gets one of the actual dimensions of the viewport, a value in pixels.

          const ColourValue& Ogre::Viewport::getBackgroundColour
          (
          void
          	)
           const

Gets the background colour.

          Camera* Ogre::Viewport::getCamera
          (
          void
          	)
           const

Retrieves a pointer to the camera for this viewport.

          unsigned int Ogre::Viewport::getClearBuffers
          (
          void
          	)
           const

Gets which buffers are to be cleared each frame.

          bool Ogre::Viewport::getClearEveryFrame
          (
          void
          	)
           const

Determines if the viewport is cleared before every frame.

          static OrientationMode Ogre::Viewport::getDefaultOrientationMode
          (
          	)
           [static]

Get the initial orientation mode of viewports.

          Real Ogre::Viewport::getHeight
          (
          void
          	)
           const

Gets one of the relative dimensions of the viewport, a value between 0.0 and 1.0.

          Real Ogre::Viewport::getLeft
          (
          void
          	)
           const

Gets one of the relative dimensions of the viewport, a value between 0.0 and 1.0.

          const String& Ogre::Viewport::getMaterialScheme
          (
          void
          	)
           const

Get the material scheme which the viewport should use.

Definition at line 260 of file OgreViewport.h.

          OrientationMode Ogre::Viewport::getOrientationMode
          (
          	)
           const

Get the orientation mode of the viewport.

          bool Ogre::Viewport::getOverlaysEnabled
          (
          void
          	)
           const

Returns whether or not Overlay objects (created in the SceneManager) are displayed in this viewport.

          virtual const String& Ogre::Viewport::getRenderQueueInvocationSequenceName
          (
          void
          	)
           const [virtual]

Gets the name of the render queue invocation sequence for this target.

          bool Ogre::Viewport::getShadowsEnabled
          (
          void
          	)
           const

Returns whether or not shadows (defined in the SceneManager) are displayed in this viewport.

          bool Ogre::Viewport::getSkiesEnabled
          (
          void
          	)
           const

Returns whether or not skies (created in the SceneManager) are displayed in this viewport.

          RenderTarget* Ogre::Viewport::getTarget
          (
          void
          	)
           const

Retrieves a pointer to the render target for this viewport.

          Real Ogre::Viewport::getTop
          (
          void
          	)
           const

Gets one of the relative dimensions of the viewport, a value between 0.0 and 1.0.

          uint Ogre::Viewport::getVisibilityMask
          (
          void
          	)
           const

Gets a per-viewport visibility mask.

See also:

Viewport::setVisibilityMask

Definition at line 339 of file OgreViewport.h.

          Real Ogre::Viewport::getWidth
          (
          void
          	)
           const

Gets one of the relative dimensions of the viewport, a value between 0.0 and 1.0.

          int Ogre::Viewport::getZOrder
          (
          void
          	)
           const

Gets the Z-Order of this viewport.

          bool Ogre::Viewport::isAutoUpdated
          (
          	)
           const

Gets whether this viewport is automatically updated if Ogre's rendering loop or RenderTarget::update is being used.

template<class Alloc >

          void Ogre::AllocatedObject< Alloc >::operator delete
          (
          void *
          ptr,

          void *

          )
          	 [inherited]

Definition at line 101 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

          void Ogre::AllocatedObject< Alloc >::operator delete
          (
          void *
          ptr,

          const char *
          ,

          int
          ,

          const char *

          )
          	 [inherited]

Definition at line 107 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

          void Ogre::AllocatedObject< Alloc >::operator delete
          (
          void *
          ptr	)
           [inherited]

Definition at line 95 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

          void Ogre::AllocatedObject< Alloc >::operator delete[]
          (
          void *
          ptr,

          const char *
          ,

          int
          ,

          const char *

          )
          	 [inherited]

Definition at line 118 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

          void Ogre::AllocatedObject< Alloc >::operator delete[]
          (
          void *
          ptr	)
           [inherited]

Definition at line 112 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

          void* Ogre::AllocatedObject< Alloc >::operator new
          (
          size_t
          sz,

          const char *
          file,

          int
          line,

          const char *
          func

          )
          	 [inherited]

operator new, with debug line info

Definition at line 67 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

          void* Ogre::AllocatedObject< Alloc >::operator new
          (
          size_t
          sz	)
           [inherited]

Definition at line 72 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

          void* Ogre::AllocatedObject< Alloc >::operator new
          (
          size_t
          sz,

          void *
          ptr

          )
          	 [inherited]

placement operator new

Definition at line 78 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

          void* Ogre::AllocatedObject< Alloc >::operator new[]
          (
          size_t
          sz	)
           [inherited]

Definition at line 90 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

          void* Ogre::AllocatedObject< Alloc >::operator new[]
          (
          size_t
          sz,

          const char *
          file,

          int
          line,

          const char *
          func

          )
          	 [inherited]

array operator new, with debug line info

Definition at line 85 of file OgreMemoryAllocatedObject.h.

          void Ogre::Viewport::pointOrientedToScreen
          (
          Real
          orientedX,

          Real
          orientedY,

          int
          orientationMode,

          Real &
          screenX,

          Real &
          screenY

          )

          void Ogre::Viewport::pointOrientedToScreen
          (
          const Vector2 &
          v,

          int
          orientationMode,

          Vector2 &
          outv

          )

Convert oriented input point coordinates to screen coordinates.

          void Ogre::Viewport::setAutoUpdated
          (
          bool
          autoupdate	)

Sets whether this viewport should be automatically updated if Ogre's rendering loop or RenderTarget::update is being used.

Remarks:

By default, if you use Ogre's own rendering loop (Root::startRendering) or call RenderTarget::update, all viewports are updated automatically. This method allows you to control that behaviour, if for example you have a viewport which you only want to update periodically.

Parameters:

autoupdate	If true, the viewport is updated during the automatic render loop or when RenderTarget::update() is called. If false, the viewport is only updated when its update() method is called explicitly.

          void Ogre::Viewport::setBackgroundColour
          (
          const ColourValue &
          colour	)

Sets the initial background colour of the viewport (before rendering).

          void Ogre::Viewport::setCamera
          (
          Camera *
          cam	)

Sets the camera to use for rendering to this viewport.

          void Ogre::Viewport::setClearEveryFrame
          (
          bool
          clear,

          unsigned int
          buffers = FBT_COLOUR|FBT_DEPTH

          )

Determines whether to clear the viewport before rendering.

Remarks:

You can use this method to set which buffers are cleared (if any) before rendering every frame.

Parameters:

clear	Whether or not to clear any buffers

buffers	One or more values from FrameBufferType denoting which buffers to clear, if clear is set to true. Note you should not clear the stencil buffer here unless you know what you're doing.

          static void Ogre::Viewport::setDefaultOrientationMode
          (
          OrientationMode
          orientationMode	)
           [static]

Set the initial orientation mode of viewports.

          void Ogre::Viewport::setDimensions
          (
          Real
          left,

          Real
          top,

          Real
          width,

          Real
          height

          )

Sets the dimensions (after creation).

Parameters:

left

top

width

height	Dimensions relative to the size of the target, represented as real values between 0 and 1. i.e. the full target area is 0, 0, 1, 1.

          void Ogre::Viewport::setMaterialScheme
          (
          const String &
          schemeName	)

Set the material scheme which the viewport should use.

Remarks:

This allows you to tell the system to use a particular material scheme when rendering this viewport, which can involve using different techniques to render your materials.

See also:

Technique::setSchemeName

Definition at line 255 of file OgreViewport.h.

          void Ogre::Viewport::setOrientationMode
          (
          OrientationMode
          orientationMode,

          bool
          setDefault = true

          )

Set the orientation mode of the viewport.

          void Ogre::Viewport::setOverlaysEnabled
          (
          bool
          enabled	)

Tells this viewport whether it should display Overlay objects.

Remarks:

Overlay objects are layers which appear on top of the scene. They are created via SceneManager::createOverlay and every viewport displays these by default. However, you probably don't want this if you're using multiple viewports, because one of them is probably a picture-in-picture which is not supposed to have overlays of it's own. In this case you can turn off overlays on this viewport by calling this method.

Parameters:

enabled	If true, any overlays are displayed, if false they are not.

          virtual void Ogre::Viewport::setRenderQueueInvocationSequenceName
          (
          const String &
          sequenceName	)
           [virtual]

Sets the use of a custom RenderQueueInvocationSequence for rendering this target.

Remarks:

RenderQueueInvocationSequence instances are managed through Root. By setting this, you are indicating that you wish this RenderTarget to be updated using a custom sequence of render queue invocations, with potentially customised ordering and render state options. You should create the named sequence through Root first, then set the name here.

Parameters:

The	name of the RenderQueueInvocationSequence to use. If you specify a blank string, behaviour will return to the default render queue management.

          void Ogre::Viewport::setShadowsEnabled
          (
          bool
          enabled	)

Tells this viewport whether it should display shadows.

Remarks:

This setting enables you to disable shadow rendering for a given viewport. The global shadow technique set on SceneManager still controls the type and nature of shadows, but this flag can override the setting so that no shadows are rendered for a given viewport to save processing time where they are not required.

Parameters:

enabled	If true, any shadows are displayed, if false they are not.

          void Ogre::Viewport::setSkiesEnabled
          (
          bool
          enabled	)

Tells this viewport whether it should display skies.

Remarks:

Skies are layers which appear on background of the scene. They are created via SceneManager::setSkyBox, SceneManager::setSkyPlane and SceneManager::setSkyDome and every viewport displays these by default. However, you probably don't want this if you're using multiple viewports, because one of them is probably a picture-in-picture which is not supposed to have skies of it's own. In this case you can turn off skies on this viewport by calling this method.

Parameters:

enabled	If true, any skies are displayed, if false they are not.

          void Ogre::Viewport::setVisibilityMask
          (
          uint32
          mask	)

Sets a per-viewport visibility mask.

Remarks:

The visibility mask is a way to exclude objects from rendering for a given viewport. For each object in the frustum, a check is made between this mask and the objects visibility flags (

See also:

MovableObject::setVisibilityFlags), and if a binary 'and' returns zero, the object will not be rendered.

Definition at line 334 of file OgreViewport.h.

          void Ogre::Viewport::update
          (
          void
          	)

Instructs the viewport to updates its contents.

Member Data Documentation

          int Ogre::Viewport::mActHeight [protected]

Definition at line 370 of file OgreViewport.h.

          int Ogre::Viewport::mActLeft [protected]

Definition at line 370 of file OgreViewport.h.

          int Ogre::Viewport::mActTop [protected]

Definition at line 370 of file OgreViewport.h.

          int Ogre::Viewport::mActWidth [protected]

Definition at line 370 of file OgreViewport.h.

          ColourValue Ogre::Viewport::mBackColour [protected]

Background options.

Definition at line 374 of file OgreViewport.h.

          Camera* Ogre::Viewport::mCamera [protected]

Definition at line 365 of file OgreViewport.h.

          unsigned int Ogre::Viewport::mClearBuffers [protected]

Definition at line 376 of file OgreViewport.h.

          bool Ogre::Viewport::mClearEveryFrame [protected]

Definition at line 375 of file OgreViewport.h.

          OrientationMode Ogre::Viewport::mDefaultOrientationMode [static, protected]

Definition at line 389 of file OgreViewport.h.

          bool Ogre::Viewport::mIsAutoUpdated [protected]

Automatic rendering on/off.

Definition at line 392 of file OgreViewport.h.

          String Ogre::Viewport::mMaterialSchemeName [protected]

Material scheme.

Definition at line 386 of file OgreViewport.h.

          OrientationMode Ogre::Viewport::mOrientationMode [protected]

Viewport orientation mode.

Definition at line 388 of file OgreViewport.h.

          float Ogre::Viewport::mRelHeight [protected]

Definition at line 368 of file OgreViewport.h.

          float Ogre::Viewport::mRelLeft [protected]

Definition at line 368 of file OgreViewport.h.

          float Ogre::Viewport::mRelTop [protected]

Definition at line 368 of file OgreViewport.h.

          float Ogre::Viewport::mRelWidth [protected]

Definition at line 368 of file OgreViewport.h.

          RenderQueueInvocationSequence* Ogre::Viewport::mRQSequence [protected]

Definition at line 384 of file OgreViewport.h.

          String Ogre::Viewport::mRQSequenceName [protected]

Definition at line 383 of file OgreViewport.h.

          bool Ogre::Viewport::mShowOverlays [protected]

Definition at line 378 of file OgreViewport.h.

          bool Ogre::Viewport::mShowShadows [protected]

Definition at line 380 of file OgreViewport.h.

          bool Ogre::Viewport::mShowSkies [protected]

Definition at line 379 of file OgreViewport.h.

          RenderTarget* Ogre::Viewport::mTarget [protected]

Definition at line 366 of file OgreViewport.h.

          bool Ogre::Viewport::mUpdated [protected]

Definition at line 377 of file OgreViewport.h.

          uint32 Ogre::Viewport::mVisibilityMask [protected]

Definition at line 381 of file OgreViewport.h.

          int Ogre::Viewport::mZOrder [protected]

ZOrder.

Definition at line 372 of file OgreViewport.h.

The documentation for this class was generated from the following file:

OgreViewport.h

Copyright © 2008 Torus Knot Software Ltd

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.

Last modified Sat Jan 14 2012 18:40:56


text:
using Microsoft.EntityFrameworkCore;
using System.Linq;
using System.Threading.Tasks;
using WordHunt.Base.Exceptions;
using WordHunt.Data;
using WordHunt.Models.Words.Creation;

namespace WordHunt.Services.Words
{
    public interface IWordCreatorValidator
    {
        Task ValidateCreateModel(WordCreate model);
    }

    public class WordCreatorValidator : IWordCreatorValidator
    {
        private readonly IAppDbContext context;

        public WordCreatorValidator(IAppDbContext context)
        {
            this.context = context;
        }

        public async Task ValidateCreateModel(WordCreate model)
        {
            if(model == null)
                throw new ValidationFailedException("No data to create word");
            if (model.LanguageId <= 0)
                throw new ValidationFailedException("Must specify word language");
            if (string.IsNullOrEmpty(model.Value))
                throw new ValidationFailedException("Word must have a value");
            if (await WordValueExists(model.LanguageId, model.Value))
                throw new ValidationFailedException("Word already exists");
        }

        private async Task<bool> WordValueExists(long languageId, string value)
        {
            return await context.Words.Where(x => x.LanguageId == languageId && x.Value.ToLower() == value.ToLower()).AnyAsync();
        }
    }
}


text:
//#preprocess

package rimx.location.simplelocation;

import java.util.Timer;
import java.util.TimerTask;

import javax.microedition.location.Location;
import javax.microedition.location.LocationException;
import javax.microedition.location.LocationListener;
import javax.microedition.location.LocationProvider;

import net.rim.device.api.gps.BlackBerryCriteria;
import net.rim.device.api.gps.BlackBerryLocation;
import net.rim.device.api.gps.BlackBerryLocationProvider;
import net.rim.device.api.gps.GPSInfo;
//#ifdef BlackBerrySDK6.0.0 | BlackBerrySDK7.0.0
import net.rim.device.api.gps.LocationInfo;
//#endif
import net.rim.device.api.system.EventLogger;
import net.rim.device.api.ui.component.Dialog;

/**
 * This is the starting point for applications using the Simple Location API. An instance of this class must
 * be created in order to get a single location fix or to start a tracking session.
 *
 *
Simple Location API features:

 *

 *
 Simplified and worry-free location API that leverages on-device GPS and RIM's Geolocation services.
 *
 Dynamically detects availability of GPS and Geolocation on the device before trying them.
 *
 Chooses the best location mode based on the modes available on the device. (See {@link SimpleLocationProvider#MODE_OPTIMAL}).
 *
 Built-in retry mechanism with dynamic delay (to save battery) based on a retry factor set by the API user. (See {@link SimpleLocationProvider#setRetryFactor(int)}).
 *
 Performs both single or tracking location fixes.
 *
 Simplified events via {@link SimpleLocationListener} interface.
 *
 Capable of starting, stopping and restarting tracking session in a reliable thread-safe way.
 *
 Designed to eliminate/reduce misuse of location API
 *

 *
 *
Single location fix in default mode

 *

 * try{
 * 	simpleProvider = new SimpleLocationProvider();
 * } catch(LocationException le){ // thrown if the default mode {@link #MODE_OPTIMAL} is not available.
 * 	...
 * }
 * BlackBerryLocation location = simpleProvider.getLocation(120);	// 120 seconds timeout
 *

 *
 *
 *
Single location fix in a specified mode:

 *

 * try{
 * 	simpleProvider = new SimpleLocationProvider(SimpleLocationProvider.MODE_GPS);
 * } catch(LocationException le){ // thrown if the selected mode (in this case {@link #MODE_GPS}) is not available.
 * 	...
 * }
 * BlackBerryLocation location = simpleProvider.getLocation(120);	// 120 seconds timeout
 *

 *
 *
Tracking session in default mode

 *

 * try{
 * 	simpleProvider = new SimpleLocationProvider();
 * } catch(LocationException le){ // thrown if the default mode {@link #MODE_OPTIMAL} is not available.
 * 	...
 * }
 * // Location fixes will be delivered to simpleLocationListenerImpl (an implementation of {@link SimpleLocationListener}) every 6 seconds.
 * simpleProvider.addSimpleLocationListener(simpleLocationListenerImpl, 6);
 *

 *
 *
Tracking session in a specific mode

 *

 * try{
 * 	simpleProvider = new SimpleLocationProvider(SimpleLocationProvider.MODE_GPS);
 * } catch(LocationException le){ // thrown if the selected mode (in this case {@link #MODE_GPS}) is not available.
 * 	...
 * }
 * // Location fixes will be delivered to simpleLocationListenerImpl (an implementation of {@link SimpleLocationListener}) every 6 seconds.
 * simpleProvider.addSimpleLocationListener(simpleLocationListenerImpl, 6);
 *

 *
 * @author Shadid Haque
 *
 */
public class SimpleLocationProvider implements LocationListener{
	/**
	 * Operates in both Geolocation and GPS mode based on availability. First fix is computed in Geolocation mode, subsequent fixes in
	 * Standalone mode. However if Standalone mode fails, falls back to Geolocation mode temporarily until a retry is attempted in
	 * Standalone mode after a certain waiting period has passed. See {@link #setRetryFactor(int)}.
	 *

	 * For single fix calls to {@link #getLocation(int)}, Geolocation mode is used first with a fallback to
	 * Standalone mode if Geolocation mode fails.
	 *
	 **/
	public static final int MODE_OPTIMAL = 0;
	/**
	 * Operates strictly in GPS (aka Standalone/Autonomous) mode.
	 */
	public static final int MODE_GPS = 1;
	/**
	 * Operates strictly in Geolocation mode. One of WLAN and CELL based is attempted based on availability.
	 */
	public static final int MODE_GEOLOCATION = 2;

	//#ifdef BlackBerrySDK6.0.0 | BlackBerrySDK7.0.0
	/**
	 * Operates strictly in cell based Geolocation mode. BlackBerry 6.0 and above only.
	 */
	public static final int MODE_GEOLOCATION_CELL = 3;
	/**
	 * Operates strictly in WLAN based Geolocation mode. BlackBerry 6.0 and above only.
	 */
	public static final int MODE_GEOLOCATION_WLAN = 4;
	//#endif

	/********************** PRIVATE VARIABLES *********************************/
	/** Reference to the last location fix */
	private BlackBerryLocation location = null;
	/** A SimpleLocationListener where events should be sent for a tracking session */
	private SimpleLocationListener simpleLocationListener = null;
	/** A reference to the current SimpleLocationThread */
	private SimpleLocationThread locationThread;
	/** A reference to the BlackBerryLocationProvider of the current locationThread:SimpleLocationThread. Updated everytime startTracking is called */
	BlackBerryLocationProvider locationProviderReference;

	/** Interval between fixes for multiple fix session. Default is 5 seconds */
	private int trackingInterval = 5;
	/** Retry factor that determines the delay between retries. Default is 1. See setRetryFactor() */
	private int retryFactor = 1;
	/** Current mode. Set to MODE_OPTIMAL by default. */
	private int mode = MODE_OPTIMAL;
	/** Reference to the current BlackBerryCriteria object */
	private BlackBerryCriteria criteria;
	/** Flag to indicate whether the current optimal mode is geolocation. */
	private boolean currentOptimalModeIsGeolocation = true;
	/** Flag to indicate that optimal mode should switch to GPS next */
	private boolean switchToGPS = false;

	/** Flag to indicate whether a tracking session is in progress */
	private boolean trackingInProgress = false;

	/** Time of the last valid fix */
	private long lastValidFixTime = System.currentTimeMillis();
	/** Interval after which a GPS fix request should be considered a failure. After this interval the current tracking session is stopped and a retry is considered. */
	private int gpsTimeout = 30;
	/** Interval after which a Geolocation fix request should be considered a failure. After this interval the current tracking session is stopped and a retry is considered. */
	private int geolocationTimeout = 20;
	/** Maximum length of time this SimpleLocationProvider is allowed to wait (in seconds) before a retry is attempted. Default is 2 hours. */
	private int maxRetryDelay = 7200;
	/** Represents the number of retries since the last valid fix. Used in combination with retryFactor */
	private int retryAttempt = 0;
	/** A TimerTask that is used to restart/retry tracking */
	private Timer restartTimer = null;
	private TimerTask restartTask = null;

	private Dialog askUserPermission;
	private boolean userPermissionResult;
	/************************************************************************/

	/**
	 * Initializes the default SimpleLocationProvider in MODE_OPTIMAL.
	 *
	 * @throws	LocationException	If the default mode is not available.
	 * @throws	IllegalStateException	If Location Services is OFF in device options. BlackBerry 6.0 and above only.
	 */
	public SimpleLocationProvider() throws LocationException, IllegalStateException{
		EventLogger.register(0xf9768e659ebd0dfcL, "SimpleLocation", EventLogger.VIEWER_STRING);
		log("Initializing default SimpleLocationProvider..");
		//#ifdef BlackBerrySDK6.0.0 | BlackBerrySDK7.0.0
		if(!LocationInfo.isLocationOn()){
			throw new IllegalStateException("Location Services is OFF. Please turn on Location Services in device options.");
		}
		//#endif

		if(!isModeAvailable(mode)){
			throw new LocationException(getModeString(mode) + " is not currently available on this device.");
		}
	}

	/**
	 * Initializes a SimpleLocationProvider in the specified mode.
	 * @param mode	One of {@link #MODE_OPTIMAL}, {@link #MODE_GPS}, {@link #MODE_GEOLOCATION}, {@link #MODE_GEOLOCATION_CELL}, {@link #MODE_GEOLOCATION_WLAN}.
	 * @throws	IllegalArgumentException	If the specified mode is invalid.
	 * @throws	LocationException	If the specified mode is not available.
	 * @throws IllegalStateException	If Location Services is OFF in device options. BlackBerry 6.0 and above only.
	 */
	public SimpleLocationProvider(int mode) throws IllegalArgumentException, LocationException, IllegalStateException{
		EventLogger.register(0xf9768e659ebd0dfcL, "SimpleLocation", EventLogger.VIEWER_STRING);
		log("Initializing SimpleLocationProvider in " + getModeString(mode));
		//#ifdef BlackBerrySDK6.0.0 | BlackBerrySDK7.0.0
		if(!LocationInfo.isLocationOn()){
			throw new IllegalStateException("Location Services is OFF. Please turn on Location Services in device options.");
		}
		//#endif

		if(!isModeValid(mode)){
			throw new IllegalArgumentException("Mode: " + mode + " is invalid. Please use one of SimpleLocationProvider.MODE_*.");
		}

		if(!isModeAvailable(mode)){
			throw new LocationException(getModeString(mode) + " is not currently available on this device.");
		}
		setMode(mode);
	}

	/**
	 * Adds a {@link SimpleLocationListener} implementation to this {@link SimpleLocationProvider} and starts a tracking session.
	 * Once added, the implementation can expect to get location fixes at the specified interval via
	 * {@link SimpleLocationListener#locationEvent(int, Object)}. NOTE: The first fix may take longer than the interval.
	 *
	 * @param listener	A {@link SimpleLocationListener} implementation.
	 * @param interval	An interval in seconds - describing how often the implementation requires a fix. -1 represents the default interval value of 5.
	 * @throws	IllegalArgumentException	If listener is null.
	 */
	public void addSimpleLocationListener(SimpleLocationListener listener, int interval) throws IllegalArgumentException{
		if(listener == null){
			throw new IllegalArgumentException("null SimpleLocationListener");
		}
		stopTracking();
		retryAttempt = 0;
		lastValidFixTime = System.currentTimeMillis();
		currentOptimalModeIsGeolocation = true;
		switchToGPS = false;
		this.simpleLocationListener= listener;
		if(interval > 0){
			this.trackingInterval = interval;
		}
		log("SimpleLocationListener added.");
		startTracking();
	}

	/**
	 * Stops tracking and removes the current {@link SimpleLocationListener} implementation from this.
	 */
	public void removeSimpleLocationListener(){
		stopTracking();
		retryAttempt = 0;
		lastValidFixTime = System.currentTimeMillis();
		currentOptimalModeIsGeolocation = true;
		switchToGPS = false;
		simpleLocationListener = null;
		log("SimpleLocationListener removed.");
	}

	/**
	 * Triggers an immediate retry by restarting the current tracking session. Note that {@link SimpleLocationProvider} implements an optimal logic
	 * to decide when to retry for location fixes if location fixes fail or are not available at a given time (see {@link #setRetryFactor(int)}).
	 * However, if an application chooses to trigger an immediate retry at will, it can do so by simply calling this method.
	 * @throws IllegalStateException If no tracking session exists. Essentially you cannot restart a tracking session that was never started. See {@link #addSimpleLocationListener(SimpleLocationListener, int)}
	 *
	 */
	public void restart() throws IllegalStateException{
		if(simpleLocationListener!=null){
			log("Restarting SimpleLocationProvider..");
			retryAttempt = 0;
			lastValidFixTime = System.currentTimeMillis();
			currentOptimalModeIsGeolocation = true;
			switchToGPS = false;
			startTracking();
		} else{
			throw new IllegalStateException("No existing tracking session found.");
		}
	}

	/**
	 * Gets a single location fix and stops. Note that if this method is called in the middle of a tracking session, this method
	 * will stop the tracking session before attempting a single location fix. This is a blocking call.
	 * @param	timeout	Maximum time this method is allowed to spend to get a location. If a location could not be obtained in that time, returns a null Location object. Using -1 will force the default timeout value 120.
	 * @return	A Location object or null if it was unable to obtain a location within timeout many seconds.
	 */
	public BlackBerryLocation getLocation(int timeout) {
		stopTracking();
		retryAttempt = 0;
		lastValidFixTime = System.currentTimeMillis();
		currentOptimalModeIsGeolocation = true;
		switchToGPS = false;
		log("Acquiring single location fix.. timeout="+timeout);
		return getSingleFix(timeout);
	}

	/**
	 * Returns the last known location.
	 * @return	the last known location of this SimpleLocationProvider or null if no location is computed so far.
	 */
	public BlackBerryLocation getLastKnownLocation(){
		log("Acquiring last known location..");
		if(location==null){
			log("No location available. Returning null.");
		} else if(location.isValid() && (location.getQualifiedCoordinates().getLatitude()!=0 && location.getQualifiedCoordinates().getLongitude()!=0)){
			log("Returning " + location.getQualifiedCoordinates().getLatitude() + ", " + location.getQualifiedCoordinates().getLongitude());
		} else{
			log("No valid location available. Returning invalid location");
		}
		return location;
	}

	/**
	 * Sets/changes the current mode of this SimpleLocationProvider. This method can be used to dynamically change the current
	 * mode in the middle of a tracking session. All subsequent fixes after this call will be computed in the new mode.
	 * @param mode	One of {@link #MODE_OPTIMAL}, {@link #MODE_GPS}, {@link #MODE_GEOLOCATION}, {@link #MODE_GEOLOCATION_CELL}, {@link #MODE_GEOLOCATION_WLAN}.
	 * @throws IllegalArgumentException	If the specified mode is invalid.
	 * @throws	LocationException	If the specified mode is not available.
	 */
	public void setMode(int mode) throws IllegalArgumentException, LocationException{
		retryAttempt = 0;

		if(!isModeValid(mode)){
			throw new IllegalArgumentException("Mode: " + mode + " is invalid. Please use one of SimpleLocationProvider.MODE_*.");
		}
		if(!isModeAvailable(mode)){
			throw new LocationException(getModeString(mode) + " is not currently available on this device.");
		}
		lastValidFixTime = System.currentTimeMillis();
		currentOptimalModeIsGeolocation = true;
		switchToGPS = false;
		if(trackingInProgress){
			stopTracking();
			this.mode = mode;
			log("Mode set to " + getModeString(mode));
			startTracking();
		} else {
			this.mode = mode;
			log("Mode set to " + getModeString(mode));
		}
	}

	/**
	 * Returns the current mode of this SimpleLocationProvider
	 * @return	One of {@link #MODE_OPTIMAL}, {@link #MODE_GPS}, {@link #MODE_GEOLOCATION}, {@link #MODE_GEOLOCATION_CELL}, {@link #MODE_GEOLOCATION_WLAN}.
	 */
	public int getMode(){
		return mode;
	}

	/**
	 * Sets the retry factor to the specified value. Obtaining location fixes can fail for many reasons (e.g. out of gps coverage, network error etc.). In case of such
	 * failures we cannot afford to continuously retry until we get a fix since that will rapidly drain the battery.
	 * Instead a retryFactor is used that controls the delay (in seconds) between retries according to the following expression -
	 * (((5 << attempt) - 5) * retryFactor) seconds. Value of attempt is reset to 0 when a valid location fix is obtained. However, if the selected
	 * mode is {@link #MODE_OPTIMAL}, value of attempt is reset to 0 only when a valid GPS location fix is obtained.
	 *

	 * Setting a negative/zero value as the retry factor has no effect.
	 *
	 * @param retryFactor	A retry factor. Default is 1.
	 *
	 */
	public void setRetryFactor(int factor){
		if(factor<=0){
			log("Invalid retryFactor. Must be greater than 0");
			return;
		}
		this.retryFactor = factor;
		log("retryFactor set to " + retryFactor);
	}

	/**
	 * Gets the current retry factor.
	 * @return	Value of current retry factor. See {@link #setRetryFactor(int)}
	 */
	public int getRetryFactor(){
		return retryFactor;
	}

	/**
	 * Sets the maxRetryDelay value that dictates the maximum time this provider can wait until a
	 * retry is performed. This essentially overrides and sets a cap to the value computed by the
	 * expression documented in {@link #setRetryFactor(int)}. Default value is 7200 seconds.
	 *

	 * Setting a negative/zero value as the retry factor has no effect.
	 * @param maxRetryDelay	A value in seconds.
	 */
	public void setMaxRetryDelay(int delay){
		if(delay<=0){
			log("Invalid maxRetryDelay. Must be greater than 0");
			return;
		}
		this.maxRetryDelay = delay;
		log("maxRetryDelay set to " + maxRetryDelay);
	}

	/**
	 * Gets the current value of maxRetryDelay.
	 * @return	the current value of maxRetryDelay.
	 */
	public int getMaxRetryDelay(){
		return maxRetryDelay;
	}

	/**
	 * Sets the interval used between fixes in a tracking session. This method can be used to dynamically change the current
	 * interval in the middle of a tracking session. All subsequent fixes after this call will be delivered at the new interval.
	 *

	 * Setting a negative/zero value as the tracking interval has no effect.
	 * @param interval	Interval in seconds.
	 */
	public void setTrackignInterval(int interval) {
		if(interval<=0){
			log("Invalid trackingInterval. Must be greater than 0");
			return;
		}
		this.trackingInterval = interval;
		log("trackingInterval set to " + trackingInterval);
		retryAttempt = 0;
		lastValidFixTime = System.currentTimeMillis();
		currentOptimalModeIsGeolocation = true;
		switchToGPS = false;
		if(trackingInProgress){
			stopTracking();
			startTracking();
		}
	}

	/**
	 * Gets the current tracking interval.
	 * @return	Current value of tracking interval.
	 */
	public int getTrackingInterval(){
		return this.trackingInterval;
	}

	/**
	 * Sets the Geolocation timeout. This is how long SimpleLocationProvider can spend in trying to get a Geolocation fix in a tracking session.
	 * After this timeout, {@link SimpleLocationListener#EVENT_LOCATION_FAILED} is triggered and a retry is scheduled. Default value is 20.
	 *

	 * Setting this timeout to a negative/zero value has no effect.
	 *
	 * @param timeout	A value for Geolocation timeout in seconds.
	 */
	public void setGeolocationTimeout(int timeout){
		if(timeout<=0){
			log("Invalid geolocationTimeout. Must be greater than 0");
			return;
		}
		this.geolocationTimeout = timeout;
		log("geolocationTimeout set to " + geolocationTimeout);
	}
	/**
	 * Gets the current value of Geolocation timeout.
	 * @return	Current value of Geolocation timeout.
	 */
	public int getGeolocationTimeout(){
		return geolocationTimeout;
	}

	/**
	 * Sets the GPS timeout. This is how long SimpleLocationProvider can spend in trying to get a GPS fix in a tracking session.
	 * After this timeout, {@link SimpleLocationListener#EVENT_LOCATION_FAILED} is triggered and a retry is scheduled. Default value is 30.
	 *

	 * Setting this timeout to a negative/zero value has no effect.
	 *
	 * @param timeout	A value for GPS timeout in seconds.
	 */
	public void setGPSTimeout(int timeout){
		if(timeout<=0){
			log("Invalid gpsTimeout. Must be greater than 0");
			return;
		}
		this.gpsTimeout = timeout;
		log("gpsTimeout set to " + gpsTimeout);
	}

	/**
	 * Gets the current value of GPS timeout.
	 * @return	Current value of GPS timeout.
	 */
	public int getGPSTimeout(){
		return gpsTimeout;
	}

	/**
	 * Logs a message to standard output as well as to the device eventlog.
	 * @param msg	Message to log.
	 */
	public void log(String msg){
		//System.out.println(msg);
		EventLogger.logEvent(0xf9768e659ebd0dfcL, msg.getBytes(), EventLogger.ALWAYS_LOG);
		if(simpleLocationListener!=null){
			simpleLocationListener.debugLog(msg);
		}
	}

	/************** PRIVATE METHODS *************************/

	/**
	 * Starts a tracking session in a LocationThread.
	 */
	private void startTracking(){
		log("Starting tracking session..");
		if(trackingInProgress){
			log("Tracking session exists. Stopping..");
			stopTracking();
		}
		if(switchToGPS || !isModeAvailable(MODE_GEOLOCATION)){
			currentOptimalModeIsGeolocation = false;
		}
		setupCriteria();
		trackingInProgress = true;
		locationThread = new SimpleLocationThread(criteria, trackingInterval, this, this);
		locationThread.start();
		log("New tracking session started..");
		simpleLocationListener.locationEvent(SimpleLocationListener.EVENT_ACQUIRING_LOCATION, new Long(retryAttempt));
	}

	/**
	 * Stops the current tracking session.
	 */
	private void stopTracking(){
		if(trackingInProgress){
			locationProviderReference = null; //null location provider reference to stop unnecessary updated to LocationListener
			log("Stopping tracking session..");
			if(restartTimer!=null){
				restartTimer.cancel();
				restartTimer = null;
				log("TimerTask canceled.");
			}
			new Thread(){	// Doing this in a separate thread. If the provider is currently acquiring a location a reset may block.
				public void run(){
					if(locationThread!=null){
						locationThread.resetProvider();
					}
				}
			}.start();
		}

		trackingInProgress = false;
		log("Tracking session stopped");
	}

	/**
	 * Gets a single location fix. Will stop any tracking session that is currently active for this SimpleLocationProvider.
	 * This is a blocking call.
	 * @return
	 */
	private BlackBerryLocation getSingleFix(int timeout){
		if(timeout<0){
			timeout = 120;
		}
		if(trackingInProgress){
			log("Tracking session exists. Stopping..");
			stopTracking();
		}

		if( (mode!=MODE_OPTIMAL) || (mode==MODE_OPTIMAL && isModeAvailable(MODE_GEOLOCATION)) ){
			currentOptimalModeIsGeolocation = true;
			setupCriteria();
			locationThread = new SimpleLocationThread(criteria, trackingInterval, this, this);
			location = locationThread.getSingleFix(timeout);
		} else{
			log("Geolocation mode is not available, hence, not attempted.");
		}

		if(mode==MODE_OPTIMAL && isModeAvailable(MODE_GPS) && ((location==null) || (location!=null && !location.isValid()) || (location!=null && location.getQualifiedCoordinates().getLatitude()==0 && location.getQualifiedCoordinates().getLongitude()==0))){
			log("Single location fix failed/skipped in Geolocation mode!");
			log("Attempting GPS mode..");
			currentOptimalModeIsGeolocation = false;
			setupCriteria();
			locationThread = new SimpleLocationThread(criteria, trackingInterval, this, this);
			location = locationThread.getSingleFix(timeout);
			if(location==null || (location!=null && !location.isValid()) || (location!=null && location.getQualifiedCoordinates().getLatitude()==0 && location.getQualifiedCoordinates().getLongitude()==0)){
				log("Single location fix failed in GPS mode! Returning invalid or null location..");
			}  else if(location.isValid()){
				log("Got single fix in GPS mode");
				log("Returning " + location.getQualifiedCoordinates().getLatitude() + ", " + location.getQualifiedCoordinates().getLongitude());
			}
		} else if(location.isValid()){
			log("Got single fix in Geolocation mode");
			log("Returning " + location.getQualifiedCoordinates().getLatitude() + ", " + location.getQualifiedCoordinates().getLongitude());
		}
		return location;
	}

	/**
	 * Initializes an appropriate Criteria object based on the selected mode.
	 * @param mode	One of MODE_OPTIMAL, MODE_GPS, MODE_GEOLOCATION, MODE_GEOLOCATION_CELL, MODE_GEOLOCATION_WLAN
	 */
	private void setupCriteria(){
		if(mode==SimpleLocationProvider.MODE_GPS){
			criteria = new BlackBerryCriteria(GPSInfo.GPS_MODE_AUTONOMOUS);
			criteria.setSatelliteInfoRequired(true, false);
			log("Criteria set for GPS_MODE_AUTONOMOUS");
		}

		//#ifdef BlackBerrySDK5.0.0
		else if(mode==MODE_GEOLOCATION){
			criteria = new BlackBerryCriteria(GPSInfo.GPS_MODE_CELLSITE);
			log("Criteria set for GPS_MODE_CELLSITE");
		} else if(mode==MODE_OPTIMAL && currentOptimalModeIsGeolocation){
			criteria = new BlackBerryCriteria(GPSInfo.GPS_MODE_CELLSITE);
			log("Criteria set for GPS_MODE_CELLSITE");
		} else if(mode==MODE_OPTIMAL && !currentOptimalModeIsGeolocation){
			criteria = new BlackBerryCriteria(GPSInfo.GPS_MODE_AUTONOMOUS);
			log("Criteria set for GPS_MODE_AUTONOMOUS");
			criteria.setSatelliteInfoRequired(true, false);
		}
		//#endif

		//#ifdef BlackBerrySDK6.0.0 | BlackBerrySDK7.0.0
		else if(mode==MODE_GEOLOCATION){
			criteria = new BlackBerryCriteria(LocationInfo.GEOLOCATION_MODE);
			log("Criteria set for GEOLOCATION_MODE");
		} else if(mode==MODE_GEOLOCATION_CELL){
			criteria = new BlackBerryCriteria(LocationInfo.GEOLOCATION_MODE_CELL);
			log("Criteria set for GEOLOCATION_MODE_CELL");
		} else if(mode==MODE_GEOLOCATION_WLAN){
			criteria = new BlackBerryCriteria(LocationInfo.GEOLOCATION_MODE_WLAN);
			log("Criteria set for GEOLOCATION_MODE_WLAN");
		} else if(mode==MODE_OPTIMAL && currentOptimalModeIsGeolocation){
			criteria = new BlackBerryCriteria(LocationInfo.GEOLOCATION_MODE);
			log("Criteria set for GEOLOCATION_MODE");
		} else if(mode==MODE_OPTIMAL && !currentOptimalModeIsGeolocation){
			criteria = new BlackBerryCriteria(GPSInfo.GPS_MODE_AUTONOMOUS);
			log("Criteria set for GPS_MODE_AUTONOMOUS");
			criteria.setSatelliteInfoRequired(true, false);
		}
		//#endif
	}

	void updateLocationProviderReference(BlackBerryLocationProvider provider){
		this.locationProviderReference = provider;
	}

	/**
	 * Checks the validity of a given mode value. Also checks whether the selected mode is actually available on the device.
	 * @param mode	Mode to validate.
	 * @return	True if valid. False otherwise.
	 */
	private boolean isModeValid(int mode){
		//#ifdef BlackBerrySDK6.0.0 | BlackBerrySDK7.0.0
		if(mode>=0 && mode<=4){
			return true;
		} else {
			return false;
		}
		//#endif
		//#ifdef BlackBerrySDK5.0.0
		if(mode>=0 && mode<=2){
			return true;
		} else {
			return false;
		}
		//#endif

	}

	private boolean isModeAvailable(int mode){
		if(mode==MODE_GPS && !GPSInfo.isGPSModeAvailable(GPSInfo.GPS_MODE_AUTONOMOUS)){
			log("MODE_GPS is not available!");
			return false;
		}

		//#ifdef BlackBerrySDK5.0.0
		else if(mode==MODE_GEOLOCATION && !GPSInfo.isGPSModeAvailable(GPSInfo.GPS_MODE_CELLSITE)){
			log("MODE_GEOLOCATION is not available!");
			return false;
		} else if(mode==MODE_OPTIMAL && !GPSInfo.isGPSModeAvailable(GPSInfo.GPS_MODE_CELLSITE) && !GPSInfo.isGPSModeAvailable(GPSInfo.GPS_MODE_AUTONOMOUS)){
			log("MODE_OPTIMAL is not available!");
			return false;
		}
		//#endif

		//#ifdef BlackBerrySDK6.0.0 | BlackBerrySDK7.0.0
		else if(mode==MODE_GEOLOCATION && !LocationInfo.isModeAvailable(LocationInfo.GEOLOCATION_MODE)){
			log("MODE_GEOLOCATION is not available!");
			return false;
		} else if(mode==MODE_GEOLOCATION_CELL && !LocationInfo.isModeAvailable(LocationInfo.GEOLOCATION_MODE_CELL)){
			log("MODE_GEOLOCATION_CELL is not available!");
			return false;
		} else if(mode==MODE_GEOLOCATION_WLAN && !LocationInfo.isModeAvailable(LocationInfo.GEOLOCATION_MODE_WLAN)){
			log("MODE_GEOLOCATION_WLAN is not available!");
			return false;
		} else if(mode==MODE_OPTIMAL && !LocationInfo.isModeAvailable(LocationInfo.GEOLOCATION_MODE) && !GPSInfo.isGPSModeAvailable(GPSInfo.GPS_MODE_AUTONOMOUS)){
			log("MODE_OPTIMAL is not available!");
			return false;
		}
		//#endif
		return true;
	}

	private String getModeString(int mode){
		switch(mode){
			case MODE_OPTIMAL:
				return "MODE_OPTIMAL";
			case MODE_GPS:
				return "MODE_GPS";
			case MODE_GEOLOCATION:
				return "MODE_GEOLOCATION";
			//#ifdef BlackBerrySDK6.0.0 | BlackBerrySDK7.0.0
			case MODE_GEOLOCATION_CELL:
				return "MODE_GEOLOCATION_CELL";
			case MODE_GEOLOCATION_WLAN:
				return "MODE_GEOLOCATION_WLAN";
			//#endif
			default:
				return "UNKNOWN";
		}
	}
	/********************* END OF PRIVATE METHODS **********************/

	/******************************** LocationListener IMPLEMENTATION ***************************************/

	/**
	 * This is used by this API internally and must NOT be called.
	 */
	public void locationUpdated(LocationProvider provider, Location location) {
		if(provider != this.locationProviderReference){ // if this is an update from an old location provider that is in the process of being stopped, ignore the update.
			return;
		}

		BlackBerryLocation bbLocation = (BlackBerryLocation) location;

		if(bbLocation!=null && bbLocation.isValid() && (bbLocation.getQualifiedCoordinates().getLatitude()!=0 && bbLocation.getQualifiedCoordinates().getLongitude()!=0)){
			log("Tracking: Acquired valid location - " + location.getQualifiedCoordinates().getLatitude() + ", " + location.getQualifiedCoordinates().getLongitude());
			this.location = (BlackBerryLocation) location;
			/**
			 * retryAttempt should not be reset in MODE_OPTIMAL when currentOptimalModeIsGeolocation
			 * because last GPS fix might have failed and this is only a fall back to Geolocation that has passed.
			 * We still need to preserve the retryAttempt until a GPS fix works in MODE_OPTIMAL. Otherwise
			 * we will simply waste battery by trying GPS fixes too frequently when it is not available.
			 */
			if( mode!=MODE_OPTIMAL || (mode==MODE_OPTIMAL && !currentOptimalModeIsGeolocation) ){
				retryAttempt = 0;
				log("Tracking: retryAttempt reset to 0");
			}

			/** Update lastValidFixTime */
			lastValidFixTime = System.currentTimeMillis();
			log("Tracking: lastValidFixTime updated.");

			/** Trigger events via SimpleLocationListener */
			if(bbLocation.getGPSMode()==GPSInfo.GPS_MODE_AUTONOMOUS){
				simpleLocationListener.locationEvent(SimpleLocationListener.EVENT_GPS_LOCATION, bbLocation);
				log("Tracking: Location delivered to SimpleLocationListener as EVENT_GPS_LOCATION");
			}
			//#ifdef BlackBerrySDK5.0.0
			else if(bbLocation.getGPSMode()==GPSInfo.GPS_MODE_CELLSITE){
				simpleLocationListener.locationEvent(SimpleLocationListener.EVENT_CELL_GEOLOCATION, bbLocation);
				log("Tracking: Location delivered to SimpleLocationListener as EVENT_CELL_GEOLOCATION");
			}
			//#endif

			//#ifdef BlackBerrySDK6.0.0 | BlackBerrySDK7.0.0
			else if(bbLocation.getGPSMode()==LocationInfo.GEOLOCATION_MODE_CELL){
				simpleLocationListener.locationEvent(SimpleLocationListener.EVENT_CELL_GEOLOCATION, bbLocation);
				log("Tracking: Location delivered to SimpleLocationListener as EVENT_CELL_GEOLOCATION");
			} else if(bbLocation.getGPSMode()==LocationInfo.GEOLOCATION_MODE_WLAN){
				simpleLocationListener.locationEvent(SimpleLocationListener.EVENT_WLAN_GEOLOCATION, bbLocation);
				log("Tracking: Location delivered to SimpleLocationListener as EVENT_WLAN_GEOLOCATION");
			}
			//#endif
			else{ // This should not occur
				simpleLocationListener.locationEvent(SimpleLocationListener.EVENT_UNKNOWN_MODE, bbLocation);
				log("Tracking: Location delivered to SimpleLocationListener as EVENT_UNKNOWN_MODE");
			}

			/** Create a TimerTask to switch to MODE_GPS when appropriate */
			if(mode == MODE_OPTIMAL && currentOptimalModeIsGeolocation && isModeAvailable(MODE_GPS)){
				if(restartTimer == null){
					log("Tracking: Scheduling switch to GPS");
					switchToGPS = true;
					restartTimer = new Timer();
					restartTask = new RestartTask();
					long nextRetry = getNextRetryDelay();
					lastValidFixTime = System.currentTimeMillis() + nextRetry;
					restartTimer.schedule(restartTask, nextRetry);
					log("Tracking: GPS will be attempted after " + (nextRetry/1000) + " seconds.");
				}
			}
		} else{
			log("Tracking: Invalid fix.");
			/** If Geolocation fails in MODE_OPTIMAL, try GPS (if available) after waiting an appropriate interval */
			if( mode == MODE_OPTIMAL && currentOptimalModeIsGeolocation && (((System.currentTimeMillis() - lastValidFixTime) / 1000) > geolocationTimeout) ) {
				switchToGPS = false;
				retryAttempt++;
				stopTracking();
				if(!isModeAvailable(MODE_GPS)){
					currentOptimalModeIsGeolocation = true;
					log("Cannot switch to GPS because MODE_GPS is not available.");
				} else{
					currentOptimalModeIsGeolocation = false;
					log("Switching to GPS");
				}
				long nextRetry = getNextRetryDelay();
				simpleLocationListener.locationEvent(SimpleLocationListener.EVENT_LOCATION_FAILED, new Long(nextRetry));
				if(restartTimer!=null){
					restartTimer.cancel();
					restartTimer = null;
				}
				restartTimer = new Timer();
				restartTask = new RestartTask();
				lastValidFixTime = System.currentTimeMillis() + nextRetry;
				restartTimer.schedule(restartTask, nextRetry);
				log("Tracking: Next attempt after " + (nextRetry/1000) + " seconds.");
			}
			/** If GPS fails in MODE_OPTIMAL, try Geolocation (if available) immediately */
			else if( mode == MODE_OPTIMAL && !currentOptimalModeIsGeolocation && (((System.currentTimeMillis() - lastValidFixTime) / 1000) > gpsTimeout) ) {
				switchToGPS = false;
				retryAttempt++;
				stopTracking();
				long nextRetry = 0;
				if(!isModeAvailable(MODE_GEOLOCATION)){
					currentOptimalModeIsGeolocation = false;
					nextRetry = getNextRetryDelay();
					log("Cannot switch to Geolocation because MODE_GEOLOCATION is not available.");
				} else{
					currentOptimalModeIsGeolocation = true;
					nextRetry = 0;
					log("Switching to Geolocation.");
				}
				simpleLocationListener.locationEvent(SimpleLocationListener.EVENT_LOCATION_FAILED, new Long(nextRetry));
				if(restartTimer!=null){
					restartTimer.cancel();
					restartTimer = null;
				}
				restartTimer = new Timer();
				restartTask = new RestartTask();
				lastValidFixTime = System.currentTimeMillis() + nextRetry;
				restartTimer.schedule(restartTask, nextRetry);
				log("Tracking: Next attempt after " + (nextRetry/1000) + " seconds.");
			}
			/** If Geolocation fails, retry after waiting an appropriate interval */
			else if( (mode == MODE_GEOLOCATION
					//#ifdef BlackBerrySDK6.0.0 | BlackBerrySDK7.0.0
					|| mode == MODE_GEOLOCATION_CELL || mode == MODE_GEOLOCATION_WLAN
					//#endif
					) && (((System.currentTimeMillis() - lastValidFixTime) / 1000) > geolocationTimeout) ) {
				switchToGPS = false;
				retryAttempt++;
				stopTracking();
				long nextRetry = getNextRetryDelay();
				simpleLocationListener.locationEvent(SimpleLocationListener.EVENT_LOCATION_FAILED, new Long(nextRetry));
				if(restartTimer!=null){
					restartTimer.cancel();
					restartTimer = null;
				}
				restartTimer = new Timer();
				restartTask = new RestartTask();
				lastValidFixTime = System.currentTimeMillis() + nextRetry;
				restartTimer.schedule(restartTask, nextRetry);
				log("Tracking: Geolocation will be attempted after " + (nextRetry/1000) + " seconds.");
			}
			/** If GPS fails, retry after waiting an appropriate interval */
			else if( mode == MODE_GPS && (((System.currentTimeMillis() - lastValidFixTime) / 1000) > gpsTimeout) ) {
				switchToGPS = false;
				retryAttempt++;
				stopTracking();
				long nextRetry = getNextRetryDelay();
				simpleLocationListener.locationEvent(SimpleLocationListener.EVENT_LOCATION_FAILED, new Long(nextRetry));
				if(restartTimer!=null){
					restartTimer.cancel();
					restartTimer = null;
				}
				restartTimer = new Timer();
				restartTask = new RestartTask();
				lastValidFixTime = System.currentTimeMillis() + nextRetry;
				restartTimer.schedule(restartTask, nextRetry);
				log("Tracking: GPS will be attempted after " + (nextRetry/1000) + " seconds.");
			}
		}
	}

	/**
	 * This is used by this API internally and must NOT be called.
	 */
	public void providerStateChanged(LocationProvider provider, int newState) {
		if(newState == LocationProvider.TEMPORARILY_UNAVAILABLE){
			log("Tracking: Location temporarily unavailable");
			/** If Geolocation fails in MODE_OPTIMAL, try GPS after waiting an appropriate interval */
			if( mode == MODE_OPTIMAL && currentOptimalModeIsGeolocation ) {
				switchToGPS = false;
				retryAttempt++;
				stopTracking();
				if(!isModeAvailable(MODE_GPS)){
					currentOptimalModeIsGeolocation = true;
					log("Cannot switch to GPS because MODE_GPS is not available.");
				} else{
					currentOptimalModeIsGeolocation = false;
					log("Switching to GPS");
				}
				long nextRetry = getNextRetryDelay();
				simpleLocationListener.locationEvent(SimpleLocationListener.EVENT_LOCATION_FAILED, new Long(nextRetry));
				if(restartTimer!=null){
					restartTimer.cancel();
					restartTimer = null;
				}
				restartTimer = new Timer();
				restartTask = new RestartTask();
				lastValidFixTime = System.currentTimeMillis() + nextRetry;
				restartTimer.schedule(restartTask, nextRetry);
				log("Tracking: Next attempt after " + (nextRetry/1000) + " seconds.");
			}
			/** If GPS fails in MODE_OPTIMAL, try Geolocation immediately */
			else if( mode == MODE_OPTIMAL && !currentOptimalModeIsGeolocation ) {
				switchToGPS = false;
				retryAttempt++;
				stopTracking();
				long nextRetry = 0;
				if(!isModeAvailable(MODE_GEOLOCATION)){
					currentOptimalModeIsGeolocation = false;
					nextRetry = getNextRetryDelay();
					log("Cannot switch to Geolocation because MODE_GEOLOCATION is not available.");
				} else{
					currentOptimalModeIsGeolocation = true;
					nextRetry = 0;
					log("Switching to Geolocation.");
				}
				simpleLocationListener.locationEvent(SimpleLocationListener.EVENT_LOCATION_FAILED, new Long(nextRetry));
				if(restartTimer!=null){
					restartTimer.cancel();
					restartTimer = null;
				}
				restartTimer = new Timer();
				restartTask = new RestartTask();
				lastValidFixTime = System.currentTimeMillis() + nextRetry;
				restartTimer.schedule(restartTask, nextRetry);
				log("Tracking: Next attempt after " + (nextRetry/1000) + " seconds.");
			}
			/** If Geolocation fails, retry after waiting an appropriate interval */
			else if( mode == MODE_GEOLOCATION
					//#ifdef BlackBerrySDK6.0.0 | BlackBerrySDK7.0.0
					|| mode == MODE_GEOLOCATION_CELL || mode == MODE_GEOLOCATION_WLAN
					//#endif
					) {
				switchToGPS = false;
				retryAttempt++;
				stopTracking();
				long nextRetry = getNextRetryDelay();
				simpleLocationListener.locationEvent(SimpleLocationListener.EVENT_LOCATION_FAILED, new Long(nextRetry));
				if(restartTimer!=null){
					restartTimer.cancel();
					restartTimer = null;
				}
				restartTimer = new Timer();
				restartTask = new RestartTask();
				lastValidFixTime = System.currentTimeMillis() + nextRetry;
				restartTimer.schedule(restartTask, nextRetry);
				log("Tracking: Geolocation will be attempted after " + (nextRetry/1000) + " seconds.");
			}
			/** If GPS fails, retry after waiting an appropriate interval */
			else if( mode == MODE_GPS ) {
				switchToGPS = false;
				retryAttempt++;
				stopTracking();
				long nextRetry = getNextRetryDelay();
				simpleLocationListener.locationEvent(SimpleLocationListener.EVENT_LOCATION_FAILED, new Long(nextRetry));
				if(restartTimer!=null){
					restartTimer.cancel();
					restartTimer = null;
				}
				restartTimer = new Timer();
				restartTask = new RestartTask();
				lastValidFixTime = System.currentTimeMillis() + nextRetry;
				restartTimer.schedule(restartTask, nextRetry);
				log("Tracking: GPS will be attempted after " + (nextRetry/1000) + " seconds.");
			}
		}
	}
	/******************************** END OF LocationListener IMPLEMENTATION. ***************************************/

	private long getNextRetryDelay(){
		long nextRetry = ((5000 << retryAttempt) - 5000) * retryFactor;
		if(nextRetry > maxRetryDelay*1000){
			nextRetry = maxRetryDelay;
		}
		return nextRetry;
	}

	private class RestartTask extends TimerTask{
		public void run() {
			if(restartTimer != null){
				restartTimer.cancel();
				restartTimer=null;
			}
			startTracking();
		}
	}

}


text:
function [nrm] = lognrm(t,varargin)
% log10 of the Frobenius norm of the TT-matrix
%
% TT-Toolbox 2.2, 2009-2012
%
%This is TT Toolbox, written by Ivan Oseledets et al.
%Institute of Numerical Mathematics, Moscow, Russia
%webpage: http://spring.inm.ras.ru/osel
%
%For all questions, bugs and suggestions please mail
%ivan.oseledets@gmail.com
%---------------------------
if (nargin == 1)
    typ='F';
else
    typ=varargin{1};
end

switch typ
    case {'fro','F'} % Frobenius norm
        nrm = lognrm(t.tt); %More robust
    otherwise
        warning('unknown norm type');
        nrm=-1;
end
end


text:
package com.microsoft.azure.management.subscription.v2020_09_01;

import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * Put subscription properties.
 */
public class PutAliasRequestProperties {
    /**
     * The friendly name of the subscription.
     */
    @JsonProperty(value = "displayName", required = true)
    private String displayName;

    /**
     * The workload type of the subscription. It can be either Production or
     * DevTest. Possible values include: 'Production', 'DevTest'.
     */
    @JsonProperty(value = "workload", required = true)
    private Workload workload;

    /**
     * Determines whether subscription is fieldLed, partnerLed or LegacyEA.
     */
    @JsonProperty(value = "billingScope", required = true)
    private String billingScope;

    /**
     * This parameter can be used to create alias for existing subscription Id.
     */
    @JsonProperty(value = "subscriptionId")
    private String subscriptionId;

    /**
     * Get the friendly name of the subscription.
     *
     * @return the displayName value
     */
    public String displayName() {
        return this.displayName;
    }

    /**
     * Set the friendly name of the subscription.
     *
     * @param displayName the displayName value to set
     * @return the PutAliasRequestProperties object itself.
     */
    public PutAliasRequestProperties withDisplayName(String displayName) {
        this.displayName = displayName;
        return this;
    }

    /**
     * Get the workload type of the subscription. It can be either Production or DevTest. Possible values include: 'Production', 'DevTest'.
     *
     * @return the workload value
     */
    public Workload workload() {
        return this.workload;
    }

    /**
     * Set the workload type of the subscription. It can be either Production or DevTest. Possible values include: 'Production', 'DevTest'.
     *
     * @param workload the workload value to set
     * @return the PutAliasRequestProperties object itself.
     */
    public PutAliasRequestProperties withWorkload(Workload workload) {
        this.workload = workload;
        return this;
    }

    /**
     * Get determines whether subscription is fieldLed, partnerLed or LegacyEA.
     *
     * @return the billingScope value
     */
    public String billingScope() {
        return this.billingScope;
    }

    /**
     * Set determines whether subscription is fieldLed, partnerLed or LegacyEA.
     *
     * @param billingScope the billingScope value to set
     * @return the PutAliasRequestProperties object itself.
     */
    public PutAliasRequestProperties withBillingScope(String billingScope) {
        this.billingScope = billingScope;
        return this;
    }

    /**
     * Get this parameter can be used to create alias for existing subscription Id.
     *
     * @return the subscriptionId value
     */
    public String subscriptionId() {
        return this.subscriptionId;
    }

    /**
     * Set this parameter can be used to create alias for existing subscription Id.
     *
     * @param subscriptionId the subscriptionId value to set
     * @return the PutAliasRequestProperties object itself.
     */
    public PutAliasRequestProperties withSubscriptionId(String subscriptionId) {
        this.subscriptionId = subscriptionId;
        return this;
    }

}


text:
"use strict";

const serviceMgrNs = TopJs.useNamespace("TopJs.servicemanager");


text:
require([
    'underscore',
    'jquery',
    'splunkjs/mvc',
    'splunkjs/mvc/tableview',
    'splunkjs/mvc/simplexml/ready!'
], function(_, $, mvc, TableView, ignored) {
    // Translations from rangemap results to CSS class
    var ICONS = {
        severe: 'alert-circle',
        elevated: 'alert',
        low: 'check-circle'
    };

    var RangeMapIconRenderer = TableView.BaseCellRenderer.extend({
        canRender: function(cell) {
            // Only use the cell renderer for the range field
            return cell.field === 'range';
        },

        render: function($td, cell) {
            // Fetch the icon for the value
            var icon = 'question';
            if (ICONS.hasOwnProperty(cell.value)) {
                icon = ICONS[cell.value];
            }

            // Create the icon element and add it to the table cell
            $td.addClass('icon').html(_.template('<i class="icon-<%-icon%> <%- range %>" title="<%- range %>"></i>', {
                icon: icon,
                range: cell.value
            }));
        }
    });

    mvc.Components.get('activity_log').getVisualization(function(tableView) {
        // Register custom cell renderer
        tableView.table.addCellRenderer(new RangeMapIconRenderer());
        // Force the table to re-render
        tableView.table.render();
    });
});


text:
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require jquery-ui
//= require turbolinks
//= require_tree .
//= require bootstrap
//= require wice_grid
//= require best_in_place
//= require best_in_place.purr
//= require adminlte
//= require Chart.bundle
//= require chartkick

$(document).ready(function() {
  /* Activating Best In Place */
  jQuery(".best_in_place").best_in_place();
});