text:
RSpec.describe RuboCop::ProcessedSource do
  include FileHelper

  subject(:processed_source) { described_class.new(source, ruby_version, path) }

  let(:ruby_version) { RuboCop::Config::KNOWN_RUBIES.last }

  let(:source) { <<-RUBY.strip_indent }
    # an awesome method
    def some_method
      puts 'foo'
    end
    some_method
  RUBY

  let(:path) { 'path/to/file.rb' }

  describe '.from_file', :isolated_environment do
    describe 'when the file exists' do
      before do
        create_file(path, 'foo')
      end

      let(:processed_source) { described_class.from_file(path, ruby_version) }

      it 'returns an instance of ProcessedSource' do
        expect(processed_source.is_a?(described_class)).to be(true)
      end

      it "sets the file path to the instance's #path" do
        expect(processed_source.path).to eq(path)
      end
    end

    it 'raises RuboCop::Error when the file does not exist' do
      expect do
        described_class.from_file('foo', ruby_version)
      end.to raise_error(RuboCop::Error)
        .with_message(/No such file or directory/)
    end
  end

  describe '#path' do
    it 'is the path passed to .new' do
      expect(processed_source.path).to eq(path)
    end
  end

  describe '#buffer' do
    it 'is a source buffer' do
      expect(processed_source.buffer.is_a?(Parser::Source::Buffer)).to be(true)
    end
  end

  describe '#ast' do
    it 'is the root node of AST' do
      expect(processed_source.ast.is_a?(RuboCop::AST::Node)).to be(true)
    end
  end

  describe '#comments' do
    it 'is an array of comments' do
      expect(processed_source.comments.is_a?(Array)).to be(true)
      expect(
        processed_source.comments.first.is_a?(Parser::Source::Comment)
      ).to be(true)
    end
  end

  describe '#tokens' do
    it 'has an array of tokens' do
      expect(processed_source.tokens.is_a?(Array)).to be(true)
      expect(processed_source.tokens.first.is_a?(RuboCop::Token)).to be(true)
    end
  end

  shared_context 'invalid encoding source' do
    let(:source) do
      [
        "# \xf9"
      ].join("\n")
    end
  end

  describe '#parser_error' do
    context 'when the source was properly parsed' do
      it 'is nil' do
        expect(processed_source.parser_error.nil?).to be(true)
      end
    end

    context 'when the source lacks encoding comment and is really utf-8 ' \
            'encoded but has been read as US-ASCII' do
      let(:source) do
        # When files are read into RuboCop, the encoding of source code
        # lacking an encoding comment will default to the external encoding,
        # which could for example be US-ASCII if the LC_ALL environment
        # variable is set to "C".
        '号码 = 3'.dup.force_encoding('US-ASCII')
      end

      it 'is nil' do
        # ProcessedSource#parse sets UTF-8 as default encoding, so no error.
        expect(processed_source.parser_error.nil?).to be(true)
      end
    end

    context 'when the source could not be parsed due to encoding error' do
      include_context 'invalid encoding source'

      it 'returns the error' do
        expect(processed_source.parser_error.is_a?(Exception)).to be(true)
        expect(processed_source.parser_error.message)
          .to include('invalid byte sequence')
      end
    end
  end

  describe '#lines' do
    it 'is an array' do
      expect(processed_source.lines.is_a?(Array)).to be(true)
    end

    it 'has same number of elements as line count' do
      # Since the source has a trailing newline, there is a final empty line
      expect(processed_source.lines.size).to eq(6)
    end

    it 'contains lines as string without linefeed' do
      first_line = processed_source.lines.first
      expect(first_line).to eq('# an awesome method')
    end
  end

  describe '#[]' do
    context 'when an index is passed' do
      it 'returns the line' do
        expect(processed_source[3]).to eq('end')
      end
    end

    context 'when a range is passed' do
      it 'returns the array of lines' do
        expect(processed_source[3..4]).to eq(%w[end some_method])
      end
    end

    context 'when start index and length are passed' do
      it 'returns the array of lines' do
        expect(processed_source[3, 2]).to eq(%w[end some_method])
      end
    end
  end

  describe 'valid_syntax?' do
    subject { processed_source.valid_syntax? }

    context 'when the source is completely valid' do
      let(:source) { 'def valid_code; end' }

      it 'returns true' do
        expect(processed_source.diagnostics.empty?).to be(true)
        expect(processed_source.valid_syntax?).to be(true)
      end
    end

    context 'when the source is invalid' do
      let(:source) { 'def invalid_code; en' }

      it 'returns false' do
        expect(processed_source.valid_syntax?).to be(false)
      end
    end

    context 'when the source is valid but has some warning diagnostics' do
      let(:source) { 'do_something *array' }

      it 'returns true' do
        expect(processed_source.diagnostics.empty?).to be(false)
        expect(processed_source.diagnostics.first.level).to eq(:warning)
        expect(processed_source.valid_syntax?).to be(true)
      end
    end

    context 'when the source could not be parsed due to encoding error' do
      include_context 'invalid encoding source'

      it 'returns false' do
        expect(processed_source.valid_syntax?).to be(false)
      end
    end

    # https://github.com/whitequark/parser/issues/283
    context 'when the source itself is valid encoding but includes strange ' \
            'encoding literals that are accepted by MRI' do
      let(:source) do
        'p "\xff"'
      end

      it 'returns true' do
        expect(processed_source.diagnostics.empty?).to be(true)
        expect(processed_source.valid_syntax?).to be(true)
      end
    end

    context 'when a line starts with an integer literal' do
      let(:source) { '1 + 1' }

      # regression test
      it 'tokenizes the source correctly' do
        expect(processed_source.tokens[0].text).to eq '1'
      end
    end
  end

  context 'with heavily commented source' do
    let(:source) { <<-RUBY.strip_indent }
      def foo # comment one
        bar # comment two
      end # comment three
      foo
    RUBY

    describe '#each_comment' do
      it 'yields all comments' do
        comments = []

        processed_source.each_comment do |item|
          expect(item.is_a?(Parser::Source::Comment)).to be true
          comments << item
        end

        expect(comments.size).to eq 3
      end
    end

    describe '#find_comment' do
      it 'yields correct comment' do
        comment = processed_source.find_comment do |item|
          item.text == '# comment three'
        end

        expect(comment.text).to eq '# comment three'
      end

      it 'yields nil when there is no match' do
        comment = processed_source.find_comment do |item|
          item.text == '# comment four'
        end

        expect(comment).to eq nil
      end
    end

    describe '#commented?' do
      let(:source) { <<-RUBY.strip_indent }
        # comment
        [ 1, 2 ]
      RUBY

      context 'provided source_range on line with comment' do
        it 'returns true' do
          bracket_range = processed_source.find_token(&:left_bracket?).pos
          expect(processed_source.commented?(bracket_range)).to be false
        end
      end

      context 'provided source_range on line without comment' do
        it 'returns false' do
          comment_range = processed_source.find_token(&:comment?).pos
          expect(processed_source.commented?(comment_range)).to be true
        end
      end
    end

    describe '#comments_before_line' do
      let(:source) { <<-RUBY.strip_indent }
        # comment one
        # comment two
        [ 1, 2 ]
        # comment three
      RUBY

      it 'returns comments on or before given line' do
        expect(processed_source.comments_before_line(1).size).to eq 1
        expect(processed_source.comments_before_line(2).size).to eq 2
        expect(processed_source.comments_before_line(3).size).to eq 2
        expect(processed_source.comments_before_line(4).size).to eq 3

        expect(processed_source.comments_before_line(1)
                               .first
                               .is_a?(Parser::Source::Comment)).to be true
      end
    end
  end

  context 'token enumerables' do
    let(:source) { <<-RUBY.strip_indent }
      foo(1, 2)
    RUBY

    describe '#each_token' do
      it 'yields all tokens' do
        tokens = []

        processed_source.each_token do |item|
          expect(item.is_a?(RuboCop::Token)).to be true
          tokens << item
        end

        expect(tokens.size).to eq 7
      end
    end

    describe '#find_token' do
      it 'yields correct token' do
        token = processed_source.find_token(&:comma?)

        expect(token.text).to eq ','
      end

      it 'yields nil when there is no match' do
        token = processed_source.find_token(&:right_bracket?)

        expect(token).to eq nil
      end
    end
  end

  describe '#file_path' do
    it 'returns file path' do
      expect(processed_source.file_path).to eq 'path/to/file.rb'
    end
  end

  describe '#blank?' do
    context 'with source of no content' do
      let(:source) { <<-RUBY.strip_indent }
      RUBY

      it 'returns true' do
        expect(processed_source.blank?).to eq true
      end
    end

    context 'with source with content' do
      let(:source) { <<-RUBY.strip_indent }
        foo
      RUBY

      it 'returns false' do
        expect(processed_source.blank?).to eq false
      end
    end
  end

  describe '#start_with?' do
    context 'with blank source' do
      let(:source) { <<-RUBY.strip_indent }
      RUBY

      it 'returns false' do
        expect(processed_source.start_with?('start')).to eq false
        expect(processed_source.start_with?('#')).to eq false
        expect(processed_source.start_with?('')).to eq false
      end
    end

    context 'with present source' do
      let(:source) { <<-RUBY.strip_indent }
        foo
      RUBY

      it 'returns true when passed string that starts source' do
        expect(processed_source.start_with?('foo')).to eq true
        expect(processed_source.start_with?('f')).to eq true
        expect(processed_source.start_with?('')).to eq true
      end

      it 'returns false when passed string that does not start source' do
        expect(processed_source.start_with?('bar')).to eq false
        expect(processed_source.start_with?('qux')).to eq false
        expect(processed_source.start_with?('1')).to eq false
      end
    end
  end

  describe '#preceding_line' do
    let(:source) { <<-RUBY.strip_indent }
      [ line, 1 ]
      { line: 2 }
      # line 3
    RUBY

    it 'returns source of line before token' do
      brace_token = processed_source.find_token(&:left_brace?)
      expect(processed_source.preceding_line(brace_token)).to eq '[ line, 1 ]'

      comment_token = processed_source.find_token(&:comment?)
      expect(processed_source.preceding_line(comment_token)).to eq '{ line: 2 }'
    end
  end

  describe '#following_line' do
    let(:source) { <<-RUBY.strip_indent }
      [ line, 1 ]
      { line: 2 }
      # line 3
    RUBY

    it 'returns source of line after token' do
      bracket_token = processed_source.find_token(&:right_bracket?)
      expect(processed_source.following_line(bracket_token)).to eq '{ line: 2 }'

      brace_token = processed_source.find_token(&:left_brace?)
      expect(processed_source.following_line(brace_token)).to eq '# line 3'
    end
  end
end


text:
function [params, names] = hsvargplvmExtractParam(model)

% HSVARGPLVMEXTRACTPARAM Extract a parameter vector from a hierarchical Var-GP-LVM model.
% FORMAT
% DESC extracts a parameter vector from a given SVARGPLVM model.
% ARG model : svargplvm model from which to extract parameters
% RETURN params : model parameter vector
%
%
% We assume a graphical model:
%
% X_H -> X_{H-1} -> ......... -> X_{1} -> {Y{1}, Y{2}, ..., Y{M} }
%  |_______|  |_____|         |____| |______________|
%  layer{H}   layer{H-1}    layer{2}     layer{1}
%
% Parameters are extracted as a vector in the following order (left to right)
% Imagine a stack where get extracts from the BOTTOM (not the top)
% - parameter | size :
%
% for h=1:H                     % h=1 is the very lower layer in the graphical model
%   get: varmeans_{q(X_h)}(:)'                     --> N x Q_h
%   get: varcovs_{q(X_h}(:)'                       --> N x Q_h
%   for i=1:M (for the M of the current layer h)
%       get: X_u(:)'_{h,i}    % inducing points    --> K_{h,i} x Q_{h}
%       get: \theta_{h,i}     % kernel hyperparameters --> ...
%       get: beta_{h,i}         ---> 1
%   end
% end
%
% If there is a non-(standard normal) prior on the parent node, then we
% have "dynamics", ie reparametrized variational means/variances plus
% hyperparameters of the "dynamics" kernel:
%
% for h=1:H-1                     % h=1 is the very lower layer in the graphical model
%   get: varmeans_{q(X_h)}(:)'                     --> N x Q_h
%   get: varcovs_{q(X_h}(:)'                       --> N x Q_h
%   for i=1:M (for the M of the current layer h)
%       get: X_u(:)'_{h,i}    % inducing points    --> K_{h,i} x Q_{h}
%       get: \theta_{h,i}     % kernel hyperparameters --> ...
%       get: beta_{h,i}         ---> 1
%   end
% end
% get: mubar_{q(X_H)}(:)'
% get: lambda_{q(X_H)}(:)'
% get: \theta_x{H}
% for i=1:M (for the M of the parent layer h)
%       get: X_u(:)'_{h,i}    % inducing points    --> K_{H,i} x Q_{H}
%       get: \theta_{h,i}     % kernel hyperparameters --> ...
%       get: beta_{H,i}         ---> 1
% end
%
% SEEALSO : svargplvmCreate, svargplvmExpandParam, modelExtractParam
%
% COPYRIGHT : Andreas C. Damianou, 2011

% SVARGPLVM

if nargout > 1
    returnNames = true;
else
    returnNames = false;
end

params = [];
names = {};

for h=1:model.H
    % Variational distribution
    if h==model.H & isfield(model.layer{h}, 'dynamics') & ~isempty(model.layer{h}.dynamics)
        % [VariationalParameters(reparam)   dynKernelParameters]
        if returnNames
            [dynParams, dynParamNames] = modelExtractParam(model.layer{h}.dynamics);
            names = {names{:} dynParamNames{:}};
        else
            dynParams = modelExtractParam(model.layer{h}.dynamics);
        end
        params = [params dynParams];
    else
        if returnNames
            [params_i, names_i] = modelExtractParam(model.layer{h}.vardist);
            params = [params params_i];
            names = {names{:} names_i{:}};
        else
            params = [params modelExtractParam(model.layer{h}.vardist)];
        end
    end
    % Now extract the "private" parameters of every sub-model. This is done by
    % just calling vargplvmExtractParam and then ignoring the parameter indices
    % that are shared for all models (because we want these parameters to be
    % included only once).
    for i = 1:model.layer{h}.M
        if returnNames
            [params_i,names_i] = vargplvmExtractParamNoVardist(model.layer{h}.comp{i});
        else
            params_i = vargplvmExtractParamNoVardist(model.layer{h}.comp{i});
        end

        params = [params params_i];

        if returnNames
            names = {names{:} names_i{:}};
        end
    end

end

% Make fixed indices to have an asterisk
if returnNames && isfield(model, 'fixParamIndices')
    for i = 1:length(model.fixParamIndices)
        j = model.fixParamIndices(i);
        names{j} = [names{j} '*'];
    end
end

redpajama_set_name: RedPajamaGithub


text:
package com.nms.ncms.web.flows;

import java.io.Serializable;
import javax.faces.flow.Flow;
import javax.faces.flow.builder.FlowBuilder;
import javax.faces.flow.builder.FlowBuilderParameter;

//@ApplicationScoped
public class FlowFactory implements Serializable {
    private static final long serialVersionUID = -1661000665063975947L;

//    @Produces @FlowDefinition
    public Flow gameFlow(@FlowBuilderParameter FlowBuilder f) {
        String flowId = "gameManagement";
        f.id("", flowId);
        f.viewNode("list", "/admin/contents/game/list.xhtml").markAsStartNode();
        f.viewNode("edit", "/admin/contents/game/edit.xhtml");
        f.returnNode("returnFlow").fromOutcome("/admin/index.xhtml");
        return f.getFlow();
    }

}


text:
CScriptEffector::~CScriptEffector	()
{
	Msg								("CScriptEffector::~CScriptEffector() called");
}

BOOL CScriptEffector::Process		(SPPInfo	&pp)
{
	return							(!!process(&pp));
}

bool CScriptEffector::process		(SPPInfo *pp)
{
	return							(!!inherited::Process(*pp));
}

void CScriptEffector::Add			()
{
	Actor()->Cameras().AddPPEffector		(this);
}

void CScriptEffector::Remove		()
{
	Actor()->Cameras().RemovePPEffector	(m_tEffectorType);
}


text:
.hsv-palette-modal .hsv-container {
    border: none;
}

.hsv-palette-modal .modal-body {
    padding-left: 5px;
}


text:
package net.toolab.roundtable.key;

import java.io.Serializable;

public interface SessionKeyGenerator<T extends Serializable> {
	T generateKey();
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _03.Printing_Triangle
{
    class PrintingTriangle
    {
        static void Main(string[] args)
        {
            int sizeOfTriangle = int.Parse(Console.ReadLine());
            for (int i = 1; i < sizeOfTriangle; i++)
            {
                PrintLine(1, i);

            }

                PrintLine(1, sizeOfTriangle);

            for (int i = sizeOfTriangle - 1; i >= 0; i--)
            {
                PrintLine(1,i);
            }

        }

        private static void PrintLine(int start, int end)
        {
            for (int i = start; i <= end; i++)
            {
                Console.Write(i + " ");
            }
            Console.WriteLine();
        }
    }
}


text:
<!DOCTYPE html>
<title>Test "video" as a source for "canvas".</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="media-file.js"></script>
<video></video>
<canvas width="160" height="120"></canvas>
<script>
async_test(function(t) {
    var ctx;
    var width;
    var height;
    var results = {
        current: 0,
        values: [
            { time: 0, r: 255, g: 255, b: 0 },
            { time: 2, r: 0, g: 9, b: 237 },
            { time: 4, r: 0, g: 32, b: 209 },
            { time: 6, r: 0, g: 54, b: 182 },
            { time: 8, r: 0, g: 77, b: 154 },
            { time: 10, r: 0, g: 97, b: 126 }
        ]
    };

    var video = document.querySelector("video");

    video.onloadedmetadata = t.step_func(function() {
        width = video.videoWidth / 2;
        height = video.videoHeight / 2;

        ctx = document.querySelector("canvas").getContext("2d");
        ctx.fillStyle = "yellow";
        ctx.fillRect(0, 0, width, height);
        testFrame();
    });

    video.onseeked = t.step_func(function() {
        ctx.drawImage(video, 0, 0, width, height);
        testFrame();
    });

    function testFrame() {
        var expected = results.values[results.current];
        var frame = ctx.getImageData(0, 0, width, height);
        var r = frame.data[4 * 2 * width + 16 + 0];
        var g = frame.data[4 * 2 * width + 16 + 1];
        var b = frame.data[4 * 2 * width + 16 + 2];

        assert_equals(r, expected.r);
        assert_equals(g, expected.g);
        assert_equals(b, expected.b);

        if (++results.current == results.values.length)
            t.done();
        else
            video.currentTime = results.values[results.current].time;
    }

    video.src = findMediaFile("video", "content/counting");
});
</script>


text:
require 'chef/knife/computenext_base'

class Chef
  class Knife
    class ComputenextKeypairRetrieve < Knife

      include Knife::ComputenextBase

      banner "knife computenext keypair retrieve [KeyPairId]"
	  category "computenext keypair"

      def run
		keypair_id = @name_args[0]
		data = connection.retrieve_key_pair(keypair_id).body
		puts JSON.pretty_generate(data)
	  end
    end
  end
end


text:
layout: storytime
body-class: storytime-2
---

<img src="{{ site.baseurl }}/downloads/storytime/7.png" alt="">


text:
class ChromeFrameDistribution : public BrowserDistribution {
 public:
  base::string16 GetBrowserProgIdPrefix() override;

  base::string16 GetBrowserProgIdDesc() override;

  base::string16 GetDisplayName() override;

  base::string16 GetShortcutName() override;

  int GetIconIndex() override;

  base::string16 GetBaseAppName() override;

  base::string16 GetInstallSubDir() override;

  base::string16 GetPublisherName() override;

  base::string16 GetAppDescription() override;

  base::string16 GetLongAppDescription() override;

  std::string GetSafeBrowsingName() override;

  base::string16 GetUninstallRegPath() override;

  base::string16 GetIconFilename() override;

  DefaultBrowserControlPolicy GetDefaultBrowserControlPolicy() override;

  bool CanCreateDesktopShortcuts() override;

  base::string16 GetCommandExecuteImplClsid() override;

  void UpdateInstallStatus(bool system_install,
                           installer::ArchiveType archive_type,
                           installer::InstallStatus install_status) override;

 protected:
  friend class BrowserDistribution;

  // Disallow construction from non-friends.
  ChromeFrameDistribution();
};

#endif  // CHROME_INSTALLER_UTIL_CHROME_FRAME_DISTRIBUTION_H_


text:
package rome.footstone.shiro.realm;

import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.SimpleAuthenticationInfo;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.authz.SimpleAuthorizationInfo;
import org.apache.shiro.realm.AuthorizingRealm;
import org.apache.shiro.subject.PrincipalCollection;
import rome.footstone.shiro.User;
import rome.footstone.shiro.service.AuthService;

import java.util.List;

/**
 * Created by niuqinghua on 2014/9/17.
 */
public class UserRealm extends AuthorizingRealm {

    private AuthService authService;

    @Override
    protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
        User user = (User)principals.getPrimaryPrincipal();
        List<String> codes = authService.getPermissionCodes(user.getName());
        SimpleAuthorizationInfo authorizationInfo = new SimpleAuthorizationInfo();
        authorizationInfo.addStringPermissions(codes);
        return authorizationInfo;
    }

    @Override
    protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {
        User user = (User)token.getPrincipal();
        return new SimpleAuthenticationInfo(user, user, user.getName());
    }
}


text:
package org.hcjf.layers.query.functions;

import org.hcjf.errors.HCJFRuntimeException;
import org.hcjf.properties.SystemProperties;

import java.util.HashSet;
import java.util.Set;

/**
 * @author javaito
 */
public abstract class BaseQueryFunctionLayer extends BaseFunctionLayer implements QueryFunctionLayerInterface {

    private final Set<String> aliases;

    public BaseQueryFunctionLayer(String implName) {
        super(SystemProperties.get(SystemProperties.Query.Function.NAME_PREFIX) + implName);
        aliases = new HashSet<>();
    }

    /**
     * Adds alias to internal store to deploy the layer with all the
     * aliases added with the expected format name.
     * @param alias Alias name.
     */
    protected final void addFunctionName(String alias) {
        aliases.add(SystemProperties.get(SystemProperties.Query.Function.NAME_PREFIX) + alias);
    }

    /**
     * Returns the set of the aliases of the layer.
     * @return Aliases of the layer.
     */
    @Override
    public final Set<String> getAliases() {
        return aliases;
    }

    /**
     * Check if the number of parameters and the type are the same that the incoming array.
     * @param functionName Name of the function that are testing.
     * @param parameters Incoming parameters array.
     * @param expectedLength Expected parameters array length.
     * @param types Excepted parameters type.
     */
    protected void checkNumberAndType(String functionName, Object[] parameters, Integer expectedLength, Class... types) {
        if(parameters.length == expectedLength) {
            for (int i = 0; i < parameters.length || i < types.length; i++) {
                if(!types[i].isAssignableFrom(parameters[i].getClass())) {
                    throw new HCJFRuntimeException("The query function '%s' expect something assignable to '%s' class " +
                            "and incoming an instance of '%s' in %d° place");
                }
            }
        } else {
            throw new HCJFRuntimeException("The query function '%s' expect %d number of arguments and incoming %d arguments",
                    functionName, expectedLength, parameters.length);
        }
    }
}


text:
<?php

/* powergenBundle:Transaction:index.html.twig */
class __TwigTemplate_cc1e9ee114a1ac13dc0cd08621ea012c extends Twig_Template
{
    public function __construct(Twig_Environment $env)
    {
        parent::__construct($env);

        $this->parent = false;

        $this->blocks = array(
        );
    }

    protected function doDisplay(array $context, array $blocks = array())
    {
        // line 1
        echo "
Transaction list

            Powerhouseid
            Transactiondate
            Businesstype
            Transactioncompletedate
            Transactionverifydate
            Iscertificate
            Isproxy
            Isidcard
            Ismap
            Ischartlocation
            Ischartcapacity
            Ispower
            Islatlong
            Islicense
            Id
            Actions

    ";
        // line 25
        $context['_parent'] = (array) $context;
        $context['_seq'] = twig_ensure_traversable((isset($context["entities"]) ? $context["entities"] : $this->getContext($context, "entities")));
        foreach ($context['_seq'] as $context["_key"] => $context["entity"]) {
            // line 26
            echo "

            env, $this->env->getExtension('routing')->getPath("transaction_show", array("id" => $this->getAttribute((isset($context["entity"]) ? $context["entity"] : $this->getContext($context, "entity")), "id"))), "html", null, true);
            echo "\">";
            echo twig_escape_filter($this->env, $this->getAttribute((isset($context["entity"]) ? $context["entity"] : $this->getContext($context, "entity")), "powerhouseId"), "html", null, true);
            echo "
            ";
            // line 28
            if ($this->getAttribute((isset($context["entity"]) ? $context["entity"] : $this->getContext($context, "entity")), "transactionDate")) {
                echo twig_escape_filter($this->env, twig_date_format_filter($this->env, $this->getAttribute((isset($context["entity"]) ? $context["entity"] : $this->getContext($context, "entity")), "transactionDate"), "Y-m-d H:i:s"), "html", null, true);
            }
            echo "
            ";
            // line 29
            echo twig_escape_filter($this->env, $this->getAttribute((isset($context["entity"]) ? $context["entity"] : $this->getContext($context, "entity")), "businessType"), "html", null, true);
            echo "
            ";
            // line 30
            if ($this->getAttribute((isset($context["entity"]) ? $context["entity"] : $this->getContext($context, "entity")), "transactionCompleteDate")) {
                echo twig_escape_filter($this->env, twig_date_format_filter($this->env, $this->getAttribute((isset($context["entity"]) ? $context["entity"] : $this->getContext($context, "entity")), "transactionCompleteDate"), "Y-m-d H:i:s"), "html", null, true);
            }
            echo "
            ";
            // line 31
            if ($this->getAttribute((isset($context["entity"]) ? $context["entity"] : $this->getContext($context, "entity")), "transactionVerifyDate")) {
                echo twig_escape_filter($this->env, twig_date_format_filter($this->env, $this->getAttribute((isset($context["entity"]) ? $context["entity"] : $this->getContext($context, "entity")), "transactionVerifyDate"), "Y-m-d H:i:s"), "html", null, true);
            }
            echo "
            ";
            // line 32
            echo twig_escape_filter($this->env, $this->getAttribute((isset($context["entity"]) ? $context["entity"] : $this->getContext($context, "entity")), "iscertificate"), "html", null, true);
            echo "
            ";
            // line 33
            echo twig_escape_filter($this->env, $this->getAttribute((isset($context["entity"]) ? $context["entity"] : $this->getContext($context, "entity")), "isproxy"), "html", null, true);
            echo "
            ";
            // line 34
            echo twig_escape_filter($this->env, $this->getAttribute((isset($context["entity"]) ? $context["entity"] : $this->getContext($context, "entity")), "isidcard"), "html", null, true);
            echo "
            ";
            // line 35
            echo twig_escape_filter($this->env, $this->getAttribute((isset($context["entity"]) ? $context["entity"] : $this->getContext($context, "entity")), "ismap"), "html", null, true);
            echo "
            ";
            // line 36
            echo twig_escape_filter($this->env, $this->getAttribute((isset($context["entity"]) ? $context["entity"] : $this->getContext($context, "entity")), "ischartlocation"), "html", null, true);
            echo "
            ";
            // line 37
            echo twig_escape_filter($this->env, $this->getAttribute((isset($context["entity"]) ? $context["entity"] : $this->getContext($context, "entity")), "ischartcapacity"), "html", null, true);
            echo "
            ";
            // line 38
            echo twig_escape_filter($this->env, $this->getAttribute((isset($context["entity"]) ? $context["entity"] : $this->getContext($context, "entity")), "ispower"), "html", null, true);
            echo "
            ";
            // line 39
            echo twig_escape_filter($this->env, $this->getAttribute((isset($context["entity"]) ? $context["entity"] : $this->getContext($context, "entity")), "islatlong"), "html", null, true);
            echo "
            ";
            // line 40
            echo twig_escape_filter($this->env, $this->getAttribute((isset($context["entity"]) ? $context["entity"] : $this->getContext($context, "entity")), "islicense"), "html", null, true);
            echo "
            ";
            // line 41
            echo twig_escape_filter($this->env, $this->getAttribute((isset($context["entity"]) ? $context["entity"] : $this->getContext($context, "entity")), "id"), "html", null, true);
            echo "

                        env, $this->env->getExtension('routing')->getPath("transaction_show", array("id" => $this->getAttribute((isset($context["entity"]) ? $context["entity"] : $this->getContext($context, "entity")), "id"))), "html", null, true);
            echo "\">show

                        env, $this->env->getExtension('routing')->getPath("transaction_edit", array("id" => $this->getAttribute((isset($context["entity"]) ? $context["entity"] : $this->getContext($context, "entity")), "id"))), "html", null, true);
            echo "\">edit

    ";
        }
        $_parent = $context['_parent'];
        unset($context['_seq'], $context['_iterated'], $context['_key'], $context['entity'], $context['_parent'], $context['loop']);
        $context = array_merge($_parent, array_intersect_key($context, $_parent));
        // line 54
        echo "

        env, $this->env->getExtension('routing')->getPath("transaction_new"), "html", null, true);
        echo "\">
            Create a new entry

";
    }

    public function getTemplateName()
    {
        return "powergenBundle:Transaction:index.html.twig";
    }

    public function isTraitable()
    {
        return false;
    }

    public function getDebugInfo()
    {
        return array (  148 => 59,  141 => 54,  129 => 48,  123 => 45,  116 => 41,  112 => 40,  108 => 39,  104 => 38,  100 => 37,  96 => 36,  92 => 35,  88 => 34,  84 => 33,  80 => 32,  74 => 31,  68 => 30,  64 => 29,  58 => 28,  52 => 27,  49 => 26,  45 => 25,  19 => 1,);
    }
}


text:
#region --- License ---

#endregion

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using Bind.Structures;

namespace Bind
{
    interface ISpecWriter
    {
    	void WriteBindings(DelegateCollection delegates, FunctionCollection functions,
    	               EnumCollection enums);
        void WriteDelegates(BindStreamWriter sw, DelegateCollection delegates);
        void WriteWrappers(BindStreamWriter sw, FunctionCollection wrappers, Dictionary<string, string> CSTypes);
        void WriteEnums(BindStreamWriter sw, EnumCollection enums);
        void WriteTypes(BindStreamWriter sw, Dictionary<string, string> CSTypes);
    }
}


text:
var container = this.container,
	button = this.button,
	devices = this.devices,
	log = this.log,
	subscribe = this.subscribe,
	publishState = this.publishState,
	widget = this.widget;

subscribe('activate', function(complete) {
	publishState(button.state);
	complete();
});


text:
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class PaymentTokenNullable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('orders', function(Blueprint $table) {
            $table->string('payment_token')->nullable()->change();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('orders', function(Blueprint $table) {
            $table->string('payment_token')->change();
        });
    }
}


text:
/*!
  \class SbDPViewVolume SbDPViewVolume.h Inventor/SbDPViewVolume.h
  \brief The SbDPViewVolume class is a double precision viewing volume in 3D space.
  \ingroup base

  This class contains the necessary information for storing a view
  volume.  It has methods for projection of primitives from or into
  the 3D volume, doing camera transforms, view volume transforms etc.

  \COIN_CLASS_EXTENSION

  \sa SbViewportRegion
  \since Coin 2.0
*/

#include <Inventor/SbDPViewVolume.h>
#include <Inventor/SbViewVolume.h>
#include <Inventor/SbDPRotation.h>
#include <Inventor/SbDPLine.h>
#include <Inventor/SbLine.h>
#include <Inventor/SbDPMatrix.h>
#include <Inventor/SbPlane.h>
#include <Inventor/SbBox2f.h>
#include <Inventor/SbBox3f.h>
#include <Inventor/SbVec2d.h>
#include <Inventor/SbVec3d.h>
#include <Inventor/SbDPPlane.h>
#if COIN_DEBUG
#include <Inventor/errors/SoDebugError.h>
#endif // COIN_DEBUG

#include <coindefs.h> // COIN_OBSOLETED()
#include <cassert>

/*!
  \enum SbDPViewVolume::ProjectionType

  An SbDPViewVolume instance can represent either an orthogonal projection
  volume or a perspective projection volume.

  \sa ortho(), perspective(), getProjectionType().
*/

/*!
  \var SbDPViewVolume::ProjectionType SbDPViewVolume::ORTHOGRAPHIC
  Orthographic projection.
*/

/*!
  \var SbDPViewVolume::ProjectionType SbDPViewVolume::PERSPECTIVE
  Perspective projection.
*/

/*!
  \var SbDPViewVolume::ProjectionType SbDPViewVolume::type
  \COININTERNAL
*/

/*!
  \var SbVec3d SbDPViewVolume::projPoint
  \COININTERNAL
*/

/*!
  \var SbVec3d SbDPViewVolume::projDir
  \COININTERNAL
*/

/*!
  \var double SbDPViewVolume::nearDist
  \COININTERNAL
*/

/*!
  \var double SbDPViewVolume::nearToFar
  \COININTERNAL
*/

/*!
  \var SbVec3d SbDPViewVolume::llf
  \COININTERNAL
*/

/*!
  \var SbVec3d SbDPViewVolume::lrf
  \COININTERNAL
*/

/*!
  \var SbVec3d SbDPViewVolume::ulf
  \COININTERNAL
*/

//
// some convenience function for converting between single precision
// and double precision classes.
//
static SbVec3f
dp_to_sbvec3f(const SbVec3d & v)
{
  return SbVec3f(static_cast<float>(v[0]), static_cast<float>(v[1]), static_cast<float>(v[2]));
}

static SbVec3d
dp_to_sbvec3d(const SbVec3f & v)
{
  return SbVec3d(static_cast<double>(v[0]), static_cast<double>(v[1]), static_cast<double>(v[2]));
}

/*!
  Constructor. Note that the SbDPViewVolume instance will be uninitialized
  until you explicitly call \a ortho() or \a perspective().

  \sa ortho(), perspective().
 */
SbDPViewVolume::SbDPViewVolume(void)
{
}

/*!
  Destructor.
 */
SbDPViewVolume::~SbDPViewVolume(void)
{
}

// Perspective projection matrix. From the "OpenGL Programming Guide,
// release 1", Appendix G (but with row-major mode).
static SbDPMatrix
get_perspective_projection(const double rightminusleft, const double rightplusleft,
                           const double topminusbottom, const double topplusbottom,
                           const double nearval, const double farval)
{
#if COIN_DEBUG
  if (nearval * farval <= 0.0) {
    SoDebugError::postWarning("SbDPViewVolume::get_perspective_projection",
                              "Projection frustrum crosses zero. Rendering is unpredicatable.");
  }
#endif // COIN_DEBUG
  SbDPMatrix proj;

  proj[0][0] = 2.0*nearval/rightminusleft;
  proj[0][1] = 0.0;
  proj[0][2] = 0.0;
  proj[0][3] = 0.0;
  proj[1][0] = 0.0;
  proj[1][1] = 2.0*nearval/topminusbottom;
  proj[1][2] = 0.0;
  proj[1][3] = 0.0;
  proj[2][0] = rightplusleft/rightminusleft;
  proj[2][1] = topplusbottom/topminusbottom;
  proj[2][2] = -(farval+nearval)/(farval-nearval);
  proj[2][3] = -1.0;
  proj[3][0] = 0.0;
  proj[3][1] = 0.0;
  proj[3][2] = -2.0*farval*nearval/(farval-nearval);
  proj[3][3] = 0.0;

  // special handling for reverse perspective projection (see SoPerspectiveCamera documentation)
  if (nearval < 0.0) {
    // OpenGL performs clipping in homogeneous space (before computing the perspective division).
    // i.e. instead of testing for -1 <= z/w <= +1, it checks for -w <= z <= +w. Both conditions
    // are only equivalent if w > 0.
    // In the reverse perspective case the projection matrix above leads to negative w values,
    // but this can be compensated by multiplying the whole matrix by -1.
    proj[0][0] *= -1.0;
    proj[1][1] *= -1.0;
    proj[2][0] *= -1.0;
    proj[2][1] *= -1.0;
    proj[2][2] *= -1.0;
    proj[2][3] *= -1.0;
    proj[3][2] *= -1.0;
  }

  return proj;
}

// Orthographic projection matrix. From the "OpenGL Programming Guide,
// release 1", Appendix G (but with row-major mode).
static SbDPMatrix
get_ortho_projection(const double rightminusleft, const double rightplusleft,
                     const double topminusbottom, const double topplusbottom,
                     const double nearval, const double farval)
{
  SbDPMatrix proj;
  proj[0][0] = 2.0/rightminusleft;
  proj[0][1] = 0.0;
  proj[0][2] = 0.0;
  proj[0][3] = 0.0;
  proj[1][0] = 0.0;
  proj[1][1] = 2.0/topminusbottom;
  proj[1][2] = 0.0;
  proj[1][3] = 0.0;
  proj[2][0] = 0.0;
  proj[2][1] = 0.0;
  proj[2][2] = -2.0/(farval-nearval);
  proj[2][3] = 0.0;
  proj[3][0] = -rightplusleft/rightminusleft;
  proj[3][1] = -topplusbottom/topminusbottom;
  proj[3][2] = -(farval+nearval)/(farval-nearval);
  proj[3][3] = 1.0;

  return proj;

}

/*!
  Returns the view volume's affine matrix and projection matrix.

  \sa getMatrix(), getCameraSpaceMatrix()
 */
void
SbDPViewVolume::getMatrices(SbDPMatrix& affine, SbDPMatrix& proj) const
{
  SbVec3d upvec = this->ulf - this->llf;
#if COIN_DEBUG
  if (upvec == SbVec3d(0.0, 0.0, 0.0)) {
    SoDebugError::postWarning("SbDPViewVolume::getMatrices",
                              "empty frustum!");
    affine = SbDPMatrix::identity();
    proj = SbDPMatrix::identity();
    return;
  }
#endif // COIN_DEBUG
  SbVec3d rightvec = this->lrf - this->llf;

#if COIN_DEBUG
  if (rightvec == SbVec3d(0.0, 0.0, 0.0)) {
    SoDebugError::postWarning("SbDPViewVolume::getMatrices",
                              "empty frustum!");
    affine = SbDPMatrix::identity();
    proj = SbDPMatrix::identity();
    return;
  }
#endif // COIN_DEBUG

  // we test vectors above, just normalize
  (void) upvec.normalize();
  (void) rightvec.normalize();

  // build matrix that will transform into camera coordinate system
  SbDPMatrix mat;
  mat[0][0] = rightvec[0];
  mat[0][1] = rightvec[1];
  mat[0][2] = rightvec[2];
  mat[0][3] = 0.0f;

  mat[1][0] = upvec[0];
  mat[1][1] = upvec[1];
  mat[1][2] = upvec[2];
  mat[1][3] = 0.0f;

  mat[2][0] = -this->projDir[0];
  mat[2][1] = -this->projDir[1];
  mat[2][2] = -this->projDir[2];
  mat[2][3] = 0.0f;

  mat[3][0] = this->projPoint[0];
  mat[3][1] = this->projPoint[1];
  mat[3][2] = this->projPoint[2];
  mat[3][3] = 1.0f;

  // the affine matrix is the inverse of the camera coordinate system
  affine = mat.inverse();

  // rotate frustum points back to an axis-aligned view volume to
  // calculate parameters for the projection matrix
  SbVec3d nlrf, nllf, nulf;

  affine.multDirMatrix(this->lrf, nlrf);
  affine.multDirMatrix(this->llf, nllf);
  affine.multDirMatrix(this->ulf, nulf);

  double rml = nlrf[0] - nllf[0];
  double rpl = nlrf[0] + nllf[0];
  double tmb = nulf[1] - nllf[1];
  double tpb = nulf[1] + nllf[1];
  double n = this->getNearDist();
  double f = n + this->getDepth();

#if COIN_DEBUG
  if (rml <= 0.0f || tmb <= 0.0f || n >= f) {
    SoDebugError::postWarning("SbDPViewVolume::getMatrices",
                              "invalid frustum");
    proj = SbDPMatrix::identity();
    return;
  }
#endif // COIN_DEBUG

  if(this->type == SbDPViewVolume::ORTHOGRAPHIC)
    proj = get_ortho_projection(rml, rpl, tmb, tpb, n, f);
  else
    proj = get_perspective_projection(rml, rpl, tmb, tpb, n, f);
}

/*!
  Returns the combined affine and projection matrix.

  \sa getMatrices(), getCameraSpaceMatrix()
 */
SbDPMatrix
SbDPViewVolume::getMatrix(void) const
{
  SbDPMatrix affine, proj;
  this->getMatrices(affine, proj);
  return affine.multRight(proj);
}

/*!
  Returns a matrix which will translate the view volume camera back to
  origo, and rotate the camera so it'll point along the negative z axis.

  Note that the matrix will \a not include the rotation necessary to
  make the camera up vector point along the positive y axis (i.e.
  camera roll is not accounted for).

  \sa getMatrices(), getMatrix()
 */
SbDPMatrix
SbDPViewVolume::getCameraSpaceMatrix(void) const
{
  // Find rotation of projection direction.
  SbDPRotation pdrot =
    SbDPRotation(this->projDir, SbVec3d(0.0f, 0.0f, -1.0f));

  // Combine transforms.
  SbDPMatrix mat, tmp;
  mat.setTranslate(-this->projPoint);
  tmp.setRotate(pdrot);
  mat.multRight(tmp);

  return mat;
}

/*!
  Project the given 2D point from the projection plane into a 3D line.

  \a pt coordinates should be normalized to be within [0, 1].
 */
void
SbDPViewVolume::projectPointToLine(const SbVec2d& pt, SbDPLine& line) const
{
  SbVec3d pt0, pt1;
  this->projectPointToLine(pt, pt0, pt1);
  line.setValue(pt0, pt1);
}

/*!
  Project the given 2D point from the projection plane into two points
  defining a 3D line. The first point, \a line0, will be the
  corresponding point for the projection on the near plane, while \a line1
  will be the line endpoint, lying in the far plane.
 */
void
SbDPViewVolume::projectPointToLine(const SbVec2d& pt,
                                   SbVec3d & line0, SbVec3d & line1) const
{
  SbVec3d dx = this->lrf - this->llf;
  SbVec3d dy = this->ulf - this->llf;

#if COIN_DEBUG
  if (dx.sqrLength() == 0.0f || dy.sqrLength() == 0.0f) {
    SoDebugError::postWarning("SbDPViewVolume::projectPointToLine",
                              "invalid frustum");
    return;
  }
#endif // COIN_DEBUG

  line0 = this->projPoint + this->llf + dx*pt[0] + dy*pt[1];
  SbVec3d dir;
  if (this->type == PERSPECTIVE) {
    dir = line0 - this->projPoint;
    // a null vector is ok here, just normalize
    (void) dir.normalize();
    line1 = line0 + dir * this->getDepth() / dir.dot(this->projDir);
  }
  else {
    dir = this->projDir;
    line1 = line0 + dir*this->getDepth();
  }
}

/*!
  Project the \a src point to a normalized set of screen coordinates in
  the projection plane and place the result in \a dst.

  It is safe to let \a src and \dst be the same SbVec3d instance.

  The z-coordinate of \a dst is monotonically increasing for points
  closer to the far plane. Note however that this is not a linear
  relationship, the \a dst z-coordinate is calculated as follows:

  Orthogonal view:  DSTz = (-2 * SRCz - far - near) / (far - near),
  Perspective view:  DSTz = (-SRCz * (far - near) - 2*far*near) / (far - near)

  The returned coordinates (\a dst) are normalized to be in range [0, 1].
*/
void
SbDPViewVolume::projectToScreen(const SbVec3d& src, SbVec3d& dst) const
{
  this->getMatrix().multVecMatrix(src, dst);

  // coordinates are in range [-1, 1], normalize to [0,1]
  dst *= 0.5f;
  dst += SbVec3d(0.5f, 0.5f, 0.5f);
}

/*!
  Returns an SbPlane instance which has a normal vector in the opposite
  direction of which the camera is pointing. This means the
  plane will be parallel to the near and far clipping planes.

  \sa getSightPoint()
 */
SbPlane
SbDPViewVolume::getPlane(const double distFromEye) const
{
  return SbPlane(dp_to_sbvec3f(-this->projDir),
                 dp_to_sbvec3f(this->projPoint + distFromEye * this->projDir));
}

/*!
  Returns the point on the center line-of-sight from the camera position
  with the given distance.

  \sa getPlane()
 */
SbVec3d
SbDPViewVolume::getSightPoint(const double distFromEye) const
{
  return this->projPoint + this->projDir * distFromEye;
}

/*!
  Return the 3D point which projects to \a normPoint and lies on the
  plane perpendicular to the camera direction and \a distFromEye
  distance away from the camera position.

  \a normPoint should be given in normalized coordinates, where the
  visible render canvas is covered by the range [0.0, 1.0].
 */
SbVec3d
SbDPViewVolume::getPlanePoint(const double distFromEye,
                              const SbVec2d & normPoint) const
{
  SbVec3d volpt;

  if(this->getProjectionType() == SbDPViewVolume::ORTHOGRAPHIC) {
    SbVec3d scr(normPoint[0], normPoint[1], -1.0f);

    scr[0] -= 0.5f;
    scr[1] -= 0.5f;
    scr[0] *= 2.0f;
    scr[1] *= 2.0f;

    SbDPMatrix m = this->getMatrix().inverse();
    m.multVecMatrix(scr, volpt);
    volpt += (distFromEye - this->getNearDist()) *
      this->getProjectionDirection();
  }
  else {
    // Find vector pointing in the direction of the normalized 2D
    // point.
    SbVec3d dvec =
      this->llf +
      (this->lrf - this->llf) * normPoint[0] +
      (this->ulf - this->llf) * normPoint[1];

    if (dvec.normalize() == 0.0) {
#if COIN_DEBUG
      SoDebugError::postWarning("SbDPViewVolume::getPlanePoint",
                                "Frustum is invalid, point set to the projection point.");
#endif // COIN_DEBUG
      // just set volpt to the projection point
      volpt = this->getProjectionPoint();
    }
    else {
      // Distance to point.
      double d = distFromEye/dvec.dot(this->getProjectionDirection());

      volpt = d * dvec + this->getProjectionPoint();
    }
  }

  return volpt;
}

/*!
  Returns a rotation that aligns an object so that its positive x-axis
  is to the right and its positive y-axis is up in the view volume.

  If rightangleonly is TRUE, it will create a rotation that aligns the
  x and y-axis with the closest orthogonal axes to right and up.
*/
SbDPRotation
SbDPViewVolume::getAlignRotation(SbBool rightangleonly) const
{
  SbVec3d x,y,z;
  if (rightangleonly) {
    y = this->ulf - this->llf;
    y = y.getClosestAxis();

    x = this->lrf - this->llf;
    x = x.getClosestAxis();

    z = x.cross(y);
    (void) z.normalize();
  }
  else {
    y = this->ulf - this->llf;
    (void) y.normalize();
    x = this->lrf - this->llf;
    (void) x.normalize();
    z = x.cross(y);
    (void) z.normalize();
  }

  SbDPMatrix m = SbDPMatrix::identity();
  m[0][0] = x[0];
  m[0][1] = x[1];
  m[0][2] = x[2];

  m[1][0] = y[0];
  m[1][1] = y[1];
  m[1][2] = y[2];

  m[2][0] = z[0];
  m[2][1] = z[1];
  m[2][2] = z[2];

  return SbDPRotation(m);
}

/*!
  Given a sphere with center in \a worldCenter and an initial radius of \a 1.0,
  return the scale factor needed to make this sphere have a \a normRadius
  radius when projected onto the near clipping plane.
 */
double
SbDPViewVolume::getWorldToScreenScale(const SbVec3d& worldCenter,
                                    double normRadius) const
{
#if COIN_DEBUG
  if (normRadius < 0.0f) {
    SoDebugError::postWarning("SbDPViewVolume::getWorldToScreenScale",
                              "normRadius (%f) should be >=0.0f.", normRadius);
    return 1.0f;
  }
  if (this->getWidth() == 0.0f || this->getHeight() == 0.0f) {
    SoDebugError::postWarning("SbDPViewVolume::getWorldToScreenScale",
                              "invalid frustum <%f, %f>",
                              this->getWidth(), this->getHeight());
    return 1.0f;
  }
#endif // COIN_DEBUG

  if(this->getProjectionType() == SbDPViewVolume::ORTHOGRAPHIC) {
    SbVec3d rightvec = this->lrf - this->llf;
    return (normRadius * rightvec).length();
  }
  else {
    // Find screen space coordinates of sphere center point and tangent
    // point.
    SbVec3d center_scr;
    this->projectToScreen(worldCenter, center_scr);
    center_scr[0] += normRadius;

    // Vectors spanning the projection plane.
    SbVec3d upvec = this->ulf - this->llf;
    SbVec3d rightvec = this->lrf - this->llf;

    // Find projection plane point for the sphere tangent touch point,
    // which is then used to define the sphere tangent line.
    SbVec3d ppp = this->projPoint +
      this->llf + center_scr[0] * rightvec + center_scr[1] * upvec;
    SbLine tl(dp_to_sbvec3f(this->getProjectionPoint()), dp_to_sbvec3f(ppp));

    // Define the plane which is cutting the sphere in half and is normal
    // to the camera direction.
    SbVec3d sphere_camera_vec = worldCenter - this->getProjectionPoint();
    SbPlane p = SbPlane(dp_to_sbvec3f(sphere_camera_vec), dp_to_sbvec3f(worldCenter));

    // Find tangent point of sphere.
    SbVec3f tangentpt;
    SbBool result = p.intersect(tl, tangentpt);
    assert(result != FALSE);

    // Return radius (which is equal to the scale factor, since we're
    // dealing with a unit sphere).
    return (dp_to_sbvec3d(tangentpt) - worldCenter).length();
  }
}

/*!
  Projects the given box onto the projection plane and returns the
  normalized screen space it occupies.
 */
SbVec2d
SbDPViewVolume::projectBox(const SbBox3f& box) const
{
#if COIN_DEBUG
  if (box.isEmpty()) {
    SoDebugError::postWarning("SbDPViewVolume::projectBox",
                              "Box is empty.");
  }
#endif // COIN_DEBUG

  SbVec3d mincorner = dp_to_sbvec3d(box.getMin());
  SbVec3d maxcorner = dp_to_sbvec3d(box.getMax());
  SbBox2f span;

  for(int i=0; i < 2; i++) {
    for(int j=0; j < 2; j++) {
      for(int k=0; k < 2; k++) {
        SbVec3d corner(i ? mincorner[0] : maxcorner[0],
                       j ? mincorner[1] : maxcorner[1],
                       k ? mincorner[2] : maxcorner[2]);
        this->projectToScreen(corner, corner);
        span.extendBy(SbVec2f(static_cast<float>(corner[0]), static_cast<float>(corner[1])));
      }
    }
  }

  return SbVec2d(span.getMax()[0] - span.getMin()[0],
                 span.getMax()[1] - span.getMin()[1]);
}

/*!
  Returns a narrowed version of the view volume which is within the
  given [0, 1] normalized coordinates. The coordinates are taken to be
  corner points of a normalized "view window" on the near clipping
  plane.  I.e.:

  \code
  SbDPViewVolume view;
  view.ortho(0, 100, 0, 100, 0.1, 1000);
  view = view.narrow(0.25, 0.5, 0.75, 1.0);
  \endcode

  ..will give a view volume with corner points <25, 75> and <50, 100>.

  \sa scale(), scaleWidth(), scaleHeight()
 */
SbDPViewVolume
SbDPViewVolume::narrow(double left, double bottom,
                     double right, double top) const
{
#if COIN_DEBUG && 0 // debug test disabled, 2001-02-16, pederb
  if (left<0.0f) {
    SoDebugError::postWarning("SbDPViewVolume::narrow",
                              "left coordinate (%f) should be >=0.0f. "
                              "Clamping to 0.0f.",left);
    left=0.0f;
  }
  if (right>1.0f) {
    SoDebugError::postWarning("SbDPViewVolume::narrow",
                              "right coordinate (%f) should be <=1.0f. "
                              "Clamping to 1.0f.",right);
    right=1.0f;
  }
  if (bottom<0.0f) {
    SoDebugError::postWarning("SbDPViewVolume::narrow",
                              "bottom coordinate (%f) should be >=0.0f. "
                              "Clamping to 0.0f.",bottom);
    bottom=0.0f;
  }
  if (top>1.0f) {
    SoDebugError::postWarning("SbDPViewVolume::narrow",
                              "top coordinate (%f) should be <=1.0f. "
                              "Clamping to 1.0f.",top);
    top=1.0f;
  }
  if (left>right) {
    SoDebugError::postWarning("SbDPViewVolume::narrow",
                              "right coordinate (%f) should be larger than "
                              "left coordinate (%f). Swapping left/right.",
                              right,left);
    double tmp=right;
    right=left;
    left=tmp;
  }
  if (bottom>top) {
    SoDebugError::postWarning("SbDPViewVolume::narrow",
                              "top coordinate (%f) should be larger than "
                              "bottom coordinate (%f). Swapping top/bottom.",
                              top,bottom);
    double tmp=top;
    top=bottom;
    bottom=tmp;
  }
#endif // COIN_DEBUG

  SbDPViewVolume nvw = *this;

  double w = nvw.getWidth();
  double h = nvw.getHeight();

  SbVec3d xvec = this->lrf - this->llf;
  SbVec3d yvec = this->ulf - this->llf;

  if (yvec.normalize() == 0.0 || xvec.normalize() == 0.0) {
#if COIN_DEBUG
    SoDebugError::postWarning("SbDPViewVolume::narrow",
                              "View volume was empty before narrowing.");

#endif // COIN_DEBUG
  }

  nvw.ulf = nvw.llf + (xvec * left * w + yvec * top * h);
  nvw.lrf =
    nvw.llf + (xvec * right * w + yvec * bottom * h);
  nvw.llf += xvec * left * w + yvec * bottom * h;

  return nvw;
}

/*!

  Returns a narrowed version of the view volume which is within the
  given [0, 1] normalized coordinates. The box x and y coordinates are
  taken to be corner points of a normalized "view window" on the near
  clipping plane. The box z coordinates are used to adjust the near
  and far clipping planes, and should be relative to the current
  clipping planes. A value of 1.0 is at the current near plane. A
  value of 0.0 is at the current far plane.
*/
SbDPViewVolume
SbDPViewVolume::narrow(const SbBox3f & box) const
{
  SbVec3d bmin = dp_to_sbvec3d(box.getMin());
  SbVec3d bmax = dp_to_sbvec3d(box.getMax());
  return this->narrow(bmin[0], bmin[1], bmax[0], bmax[1]).zNarrow(bmax[2], bmin[2]);
}

// FIXME: bitmap-illustration for function doc which shows how the
// frustum is set up wrt the input arguments. 20010919 mortene.
/*!
  Set up the view volume as a rectangular box for orthographic
  parallel projections. The line of sight will be along the negative
  z axis, through the center of the plane defined by the point
  <(right+left)/2, (top+bottom)/2, 0>.

  \sa perspective().
*/
void
SbDPViewVolume::ortho(double left, double right,
                    double bottom, double top,
                    double nearval, double farval)
{
#if defined(COIN_DEBUG) && 0 // disabled 2002-08-30 pederb

  // These parameter tests are probably incorrect. It is possible to
  // set left > right etc. in SGI/TGS Inventor, and it should be
  // possible to do this in Coin also.  pederb.

  // (Yes, we've actually had user requests for making this possible
  // after first disallowing it. I don't know what kind of effects
  // they are using this for, and I'm not sure I want to know.. :-})
  // mortene.

  if (left>right) {
    SoDebugError::postWarning("SbDPViewVolume::ortho",
                              "right coordinate (%f) should be larger than "
                              "left coordinate (%f). Swapping left/right.",
                              right,left);
    double tmp=right;
    right=left;
    left=tmp;
  }
  if (bottom>top) {
    SoDebugError::postWarning("SbDPViewVolume::ortho",
                              "top coordinate (%f) should be larger than "
                              "bottom coordinate (%f). Swapping bottom/top.",
                              top,bottom);
    double tmp=top;
    top=bottom;
    bottom=tmp;
  }
  if (nearval>farval) {
    SoDebugError::postWarning("SbDPViewVolume::ortho",
                              "far coordinate (%f) should be larger than near "
                              "coordinate (%f). Swapping near/far.",farval,nearval);
    double tmp=farval;
    farval=nearval;
    nearval=tmp;
  }
#endif // disabled

  this->type = SbDPViewVolume::ORTHOGRAPHIC;
  this->projPoint.setValue(0.0f, 0.0f, 0.0f);
  this->projDir.setValue(0.0f, 0.0f, -1.0f);
  this->nearDist = nearval;
  this->nearToFar = farval - nearval;
  this->llf.setValue(left, bottom, -nearval);
  this->lrf.setValue(right, bottom, -nearval);
  this->ulf.setValue(left, top, -nearval);
}

// FIXME: bitmap-illustration for function doc which shows how the
// frustum is set up wrt the input arguments. 20010919 mortene.
/*!
  Set up the view volume for perspective projections. The line of
  sight will be through origo along the negative z axis.

  \sa ortho().
*/
void
SbDPViewVolume::perspective(double fovy, double aspect,
                            double nearval, double farval)
{
#if COIN_DEBUG
  if (fovy<0.0f || fovy > M_PI) {
    SoDebugError::postWarning("SbDPViewVolume::perspective",
                              "Field of View 'fovy' (%f) is out of bounds "
                              "[0,PI]. Clamping to be within bounds.",fovy);
    if (fovy<0.0f) fovy=0.0f;
    else if (fovy>M_PI) fovy=M_PI;
  }

#if 0 // obsoleted 2003-02-03 pederb. A negative aspect ratio is ok
  if (aspect<0.0f) {
    SoDebugError::postWarning("SbDPViewVolume::perspective",
                              "Aspect ratio 'aspect' (%d) should be >=0.0f. "
                              "Clamping to 0.0f.",aspect);
    aspect=0.0f;
  }
#endif // obsoleted

  if (nearval>farval) {
    SoDebugError::postWarning("SbDPViewVolume::perspective",
                              "far coordinate (%f) should be larger than "
                              "near coordinate (%f). Swapping near/far.",
                              farval,nearval);
    double tmp=farval;
    farval=nearval;
    nearval=tmp;
  }
#endif // COIN_DEBUG

  this->type = SbDPViewVolume::PERSPECTIVE;
  this->projPoint.setValue(0.0f, 0.0f, 0.0f);
  this->projDir.setValue(0.0f, 0.0f, -1.0f);
  this->nearDist = nearval;
  this->nearToFar = farval - nearval;

  double top = nearval * double(tan(fovy/2.0f));
  double bottom = -top;
  double left = bottom * aspect;
  double right = -left;

  this->llf.setValue(left, bottom, -nearval);
  this->lrf.setValue(right, bottom, -nearval);
  this->ulf.setValue(left, top, -nearval);
}

/*!
  Set up the frustum for perspective projection. This is an
  alternative to perspective() that lets you specify any kind of view
  volumes (e.g. off center volumes). It has the same arguments and
  functionality as the corresponding OpenGL glFrustum() function.

  \sa perspective()
*/
void
SbDPViewVolume::frustum(double left, double right,
                        double bottom, double top,
                        double nearval, double farval)
{
  this->type = SbDPViewVolume::PERSPECTIVE;
  this->projPoint.setValue(0.0f, 0.0f, 0.0f);
  this->projDir.setValue(0.0f, 0.0f, -1.0f);
  this->nearDist = nearval;
  this->nearToFar = farval - nearval;

  this->llf.setValue(left, bottom, -nearval);
  this->lrf.setValue(right, bottom, -nearval);
  this->ulf.setValue(left, top, -nearval);
}

/*!
  Rotate the direction which the camera is pointing in.

  \sa translateCamera().
 */
void
SbDPViewVolume::rotateCamera(const SbDPRotation& q)
{
  SbDPMatrix mat;
  mat.setRotate(q);

  mat.multDirMatrix(this->projDir, this->projDir);
  mat.multDirMatrix(this->llf, this->llf);
  mat.multDirMatrix(this->lrf, this->lrf);
  mat.multDirMatrix(this->ulf, this->ulf);
}

/*!
  Translate the camera position of the view volume.

  \sa rotateCamera().
 */
void
SbDPViewVolume::translateCamera(const SbVec3d & v)
{
  this->projPoint += v;
}

/*!
  Return the vector pointing from the center of the view volume towards
  the camera. This is just the vector pointing in the opposite direction
  of \a getProjectionDirection().

  \sa getProjectionDirection().
 */
SbVec3d
SbDPViewVolume::zVector(void) const
{
  return -this->projDir;
}

/*!
  Return a copy SbDPViewVolume with narrowed depth by supplying parameters
  for new near and far clipping planes.

  \a nearval and \farval should be relative to the current clipping
  planes. A value of 1.0 is at the current near plane. A value of
  0.0 is at the current far plane.

  \sa zVector().
*/
SbDPViewVolume
SbDPViewVolume::zNarrow(double nearval, double farval) const
{
  SbDPViewVolume narrowed = *this;

  narrowed.nearDist = this->nearDist + (1.0f - nearval) * this->nearToFar;
  narrowed.nearToFar = this->nearDist + this->nearToFar * (1.0f - farval);

  SbVec3d dummy;
  this->getPlaneRectangle(narrowed.nearDist - this->nearDist,
                          narrowed.llf,
                          narrowed.lrf,
                          narrowed.ulf,
                          dummy);
  return narrowed;
}

/*!
  Scale width and height of viewing frustum by the given ratio around the
  projection plane center axis.

  \sa scaleWidth(), scaleHeight().
 */
void
SbDPViewVolume::scale(double factor)
{
#if COIN_DEBUG
  if (factor<0.0f) {
    SoDebugError::postWarning("SbDPViewVolume::scale",
                              "Scale factor (%f) should be >=0.0f. Clamping "
                              "to 0.0f.",factor);
    factor=0.0f;
  }
#endif // COIN_DEBUG

  this->scaleWidth(factor);
  this->scaleHeight(factor);
}

/*!
  Scale width of viewing frustum by the given ratio around the vertical
  center axis in the projection plane.

  \sa scale(), scaleHeight().
 */
void
SbDPViewVolume::scaleWidth(double ratio)
{
#if COIN_DEBUG
  if (ratio<0.0f) {
    SoDebugError::postWarning("SbDPViewVolume::scaleWidth",
                              "Scale factor (%f) should be >=0.0f. "
                              "Clamping to 0.0f.",ratio);
    ratio=0.0f;
  }
#endif // COIN_DEBUG

  double w = this->getWidth();
  double neww = w * ratio;
  double wdiff = (neww - w)/2.0f;

  SbVec3d xvec = this->lrf - this->llf;
  if (xvec.normalize() == 0.0) {
#if COIN_DEBUG
    SoDebugError::postWarning("SbDPViewVolume::scaleWidth",
                              "View volume had no width before scaling.");
#endif // COIN_DEBUG
  }
  SbVec3d diffvec = xvec * wdiff;

  this->llf -= diffvec;
  this->ulf -= diffvec;
  this->lrf += diffvec;
}

/*!
  Scale height of viewing frustum by the given ratio around the horizontal
  center axis in the projection plane.

  \sa scale(), scaleWidth().
 */
void
SbDPViewVolume::scaleHeight(double ratio)
{
#if COIN_DEBUG
  if (ratio<0.0f) {
    SoDebugError::postWarning("SbDPViewVolume::scaleHeight",
                              "Scale factor (%f) should be >=0.0f. "
                              "Clamping to 0.0f.",ratio);
    ratio=0.0f;
  }
#endif // COIN_DEBUG

  double h = this->getHeight();
  double newh = h * ratio;
  double hdiff = (newh - h)/2.0f;

  SbVec3d upvec = this->ulf - this->llf;
  if (upvec.normalize() == 0.0) {
#if COIN_DEBUG
    SoDebugError::postWarning("SbDPViewVolume::scaleHeight",
                              "View volume had no height before scaling.");
#endif // COIN_DEBUG
  }
  SbVec3d diffvec = upvec * hdiff;

  this->llf -= diffvec;
  this->ulf += diffvec;
  this->lrf -= diffvec;
}

/*!
  Return current view volume projection type, which can be
  either \a ORTHOGRAPHIC or \a PERSPECTIVE.

  \sa SbDPViewVolume::ProjectionType
 */
SbDPViewVolume::ProjectionType
SbDPViewVolume::getProjectionType(void) const
{
  return this->type;
}

/*!
  Returns coordinates of center point in the projection plane.
 */
const SbVec3d&
SbDPViewVolume::getProjectionPoint(void) const
{
  return this->projPoint;
}

/*!
  Returns the direction of projection, i.e. the direction the camera is
  pointing.

  \sa getNearDist().
 */
const SbVec3d&
SbDPViewVolume::getProjectionDirection(void) const
{
  return this->projDir;
}

/*!
  Returns distance from projection plane to near clipping plane.

  \sa getProjectionDirection().
 */
double
SbDPViewVolume::getNearDist(void) const
{
  return this->nearDist;
}

/*!
  Returns width of viewing frustum in the projection plane.

  \sa getHeight(), getDepth().
*/
double
SbDPViewVolume::getWidth(void) const
{
  return (this->lrf - this->llf).length();
}

/*!
  Returns height of viewing frustum in the projection plane.

  \sa getWidth(), getDepth().
*/
double
SbDPViewVolume::getHeight(void) const
{
  return (this->ulf - this->llf).length();
}

/*!
  Returns depth of viewing frustum, i.e. the distance from the near clipping
  plane to the far clipping plane.

  \sa getWidth(), getHeight().
 */
double
SbDPViewVolume::getDepth(void) const
{
  return this->nearToFar;
}

/*!
  Dump the state of this object to the \a file stream. Only works in
  debug version of library, method does nothing in an optimized compile.
 */
void
SbDPViewVolume::print(FILE * fp) const
{
#if COIN_DEBUG
  fprintf( fp, "  projtype: %d\n", static_cast<int>(this->getProjectionType()) );
  fprintf( fp, "  projpt:   " );
  this->getProjectionPoint().print(fp);
  fprintf( fp, "\n" );
  fprintf( fp, "  projdir:  " );
  this->getProjectionDirection().print(fp);
  fprintf( fp, "\n" );
  fprintf( fp, "  neardist: %f\n", this->getNearDist() );
  fprintf( fp, "  width:    %f\n", this->getWidth() );
  fprintf( fp, "  height:   %f\n", this->getHeight() );
  fprintf( fp, "  depth:    %f\n", this->getDepth() );
  fprintf( fp, "    llf:    " );
  this->llf.print(fp);
  fprintf( fp, "\n" );
  fprintf( fp, "    lrf:    " );
  this->lrf.print(fp);
  fprintf( fp, "\n" );
  fprintf( fp, "    ulf:    " );
  this->ulf.print(fp);
  fprintf( fp, "\n" );
#endif // COIN_DEBUG
}

/*!
  Returns the six planes defining the view volume in the following
  order: left, bottom, right, top, near, far. Plane normals are
  directed into the view volume.

  This method is an extension for Coin, and is not available in the
  original Open Inventor.
*/
void
SbDPViewVolume::getViewVolumePlanes(SbPlane planes[6]) const
{
  SbVec3d far_ll;
  SbVec3d far_lr;
  SbVec3d far_ul;
  SbVec3d far_ur;

  this->getPlaneRectangle(this->nearToFar, far_ll, far_lr, far_ul, far_ur);
  SbVec3d near_ur = this->ulf + (this->lrf-this->llf);

  SbVec3f f_ulf = dp_to_sbvec3f(this->ulf + this->projPoint);
  SbVec3f f_llf = dp_to_sbvec3f(this->llf + this->projPoint);
  SbVec3f f_lrf = dp_to_sbvec3f(this->lrf + this->projPoint);
  SbVec3f f_near_ur = dp_to_sbvec3f(near_ur + this->projPoint);
  SbVec3f f_far_ll = dp_to_sbvec3f(far_ll + this->projPoint);
  SbVec3f f_far_lr = dp_to_sbvec3f(far_lr + this->projPoint);
  SbVec3f f_far_ul = dp_to_sbvec3f(far_ul + this->projPoint);
  SbVec3f f_far_ur = dp_to_sbvec3f(far_ur + this->projPoint);

  planes[0] = SbPlane(f_ulf, f_llf, f_far_ll);  // left
  planes[1] = SbPlane(f_llf, f_lrf, f_far_lr); // bottom
  planes[2] = SbPlane(f_lrf, f_near_ur, f_far_ur); // right
  planes[3] = SbPlane(f_near_ur, f_ulf, f_far_ul); // top
  planes[4] = SbPlane(f_ulf, f_near_ur, f_lrf); // near
  planes[5] = SbPlane(f_far_ll, f_far_lr, f_far_ur); // far

  // check for inverted view volume (negative aspectRatio)
  if (!planes[0].isInHalfSpace(f_lrf)) {
    SbVec3f n;
    float D;

    n = planes[0].getNormal();
    D = planes[0].getDistanceFromOrigin();
    planes[0] = SbPlane(-n, -D);

    n = planes[2].getNormal();
    D = planes[2].getDistanceFromOrigin();
    planes[2] = SbPlane(-n, -D);
  }
  if (!planes[1].isInHalfSpace(f_near_ur)) {
    SbVec3f n;
    float D;

    n = planes[1].getNormal();
    D = planes[1].getDistanceFromOrigin();
    planes[1] = SbPlane(-n, -D);

    n = planes[3].getNormal();
    D = planes[3].getDistanceFromOrigin();
    planes[3] = SbPlane(-n, -D);

  }

  if (!planes[4].isInHalfSpace(f_far_ll)) {
    SbVec3f n;
    float D;

    n = planes[4].getNormal();
    D = planes[4].getDistanceFromOrigin();
    planes[4] = SbPlane(-n, -D);

    n = planes[5].getNormal();
    D = planes[5].getDistanceFromOrigin();
    planes[5] = SbPlane(-n, -D);

  }

}

/*!
  Transform the viewing volume by \a matrix.
 */
void
SbDPViewVolume::transform(const SbDPMatrix & matrix)
{
  SbVec3d oldprojpt = this->projPoint;
  SbVec3d newprojpt;
  SbVec3d newllf;
  SbVec3d newlrf;
  SbVec3d newulf;
  matrix.multVecMatrix(oldprojpt, newprojpt);

  // need to translate frustum point with the projection point before
  // transforming, then translate back afterwards.
  matrix.multVecMatrix(this->llf+oldprojpt, newllf);
  newllf -= newprojpt;

  matrix.multVecMatrix(this->lrf+oldprojpt, newlrf);
  newlrf -= newprojpt;

  matrix.multVecMatrix(this->ulf+oldprojpt, newulf);
  newulf -= newprojpt;

  // Construct and tranform nearpt and farpt to find the new near and
  // far values.
  SbVec3d nearpt;
  SbVec3d farpt;
  matrix.multVecMatrix(oldprojpt + this->nearDist * this->projDir,
                       nearpt);

  double fardist = this->nearDist + this->nearToFar;
  matrix.multVecMatrix(oldprojpt + fardist * this->projDir, farpt);

  matrix.multDirMatrix(this->projDir, this->projDir);
  this->projPoint = newprojpt;
  this->llf = newllf;
  this->ulf = newulf;
  this->lrf = newlrf;
  SbDPPlane projPlane(this->projDir, this->projPoint);
  this->nearDist = projPlane.getDistance(nearpt);
  this->nearToFar = (farpt-nearpt).length();
}

/*!
  Returns the view up vector for this view volume. It's a vector
  which is perpendicular to the projection direction, and parallel and
  oriented in the same direction as the vector from the lower left
  corner to the upper left corner of the near plane.
*/
SbVec3d
SbDPViewVolume::getViewUp(void) const
{
  SbVec3d v = this->ulf - this->llf;
  if (v.normalize() == 0.0) {
#if COIN_DEBUG
    SoDebugError::postWarning("SbDPViewVolume::getViewUp",
                              "View volume is empty.");
#endif // COIN_DEBUG
  }
  return v;
}

//
// Returns the four points defining the view volume rectangle at the
// specified distance from the near plane, towards the far plane. The
// points are returned in normalized view volume coordinates
// (projPoint is not added).
void
SbDPViewVolume::getPlaneRectangle(const double distance, SbVec3d & lowerleft,
                                  SbVec3d & lowerright,
                                  SbVec3d & upperleft,
                                  SbVec3d & upperright) const
{
  SbVec3d near_ur = this->ulf + (this->lrf-this->llf);

#if COIN_DEBUG
  if (this->llf == SbVec3d(0.0, 0.0, 0.0) ||
      this->lrf == SbVec3d(0.0, 0.0, 0.0) ||
      this->ulf == SbVec3d(0.0, 0.0, 0.0) ||
      near_ur == SbVec3d(0.0, 0.0, 0.0)) {
    SoDebugError::postWarning("SbDPViewVolume::getPlaneRectangle",
                              "Invalid frustum.");

  }
#endif // COIN_DEBUG

  if (this->type == PERSPECTIVE) {
    double depth = this->nearDist + distance;
    SbVec3d dir;
    dir = this->llf;
    (void) dir.normalize(); // safe to normalize here
    lowerleft = dir * depth / dir.dot(this->projDir);

    dir = this->lrf;
    dir.normalize(); // safe to normalize here
    lowerright = dir * depth / dir.dot(this->projDir);

    dir = this->ulf;
    (void) dir.normalize(); // safe to normalize here
    upperleft = dir * depth / dir.dot(this->projDir);

    dir = near_ur;
    (void) dir.normalize(); // safe to normalize here
    upperright = dir * depth / dir.dot(this->projDir);
  }
  else {
    lowerleft = this->llf + this->projDir * distance;
    lowerright = this->lrf + this->projDir * distance;
    upperleft = this->ulf + this->projDir * distance;
    upperright = near_ur + this->projDir * distance;
  }
}

void
SbDPViewVolume::copyValues(SbViewVolume & vv)
{
  vv.type = static_cast<SbViewVolume::ProjectionType>(this->type);
  vv.projPoint = dp_to_sbvec3f(this->projPoint);
  vv.projDir = dp_to_sbvec3f(this->projDir);
  vv.nearDist = static_cast<float>(this->nearDist);
  vv.nearToFar = static_cast<float>(this->nearToFar);
  vv.llf = dp_to_sbvec3f(this->llf + this->projPoint);
  vv.lrf = dp_to_sbvec3f(this->lrf + this->projPoint);
  vv.ulf = dp_to_sbvec3f(this->ulf + this->projPoint);
}


text:
<?php

declare(strict_types=1);

namespace Zephir\Console\Command;

use Symfony\Component\Console\Command\ListCommand as Command;

/**
 * List Command
 *
 * Displays the list of all available commands for the application.
 */
final class ListCommand extends Command
{
    use RemoveOptionsTrait;

    /**
     * {@inheritdoc}
     */
    protected function configure()
    {
        parent::configure();

        $this->setHidden(true);
    }

    /**
     * {@inheritdoc}
     *
     * @param bool $mergeArgs
     */
    public function mergeApplicationDefinition($mergeArgs = true)
    {
        parent::mergeApplicationDefinition($mergeArgs);

        $this->removeOptions(['dumpversion', 'version']);
    }
}


text:
<?php

namespace gries\Pokemath\Numbers;

use gries\Pokemath\PokeNumber;

class Suicune extends PokeNumber
{
    public function __construct()
    {
        parent::__construct('suicune');
    }
}


text:
FactorialComaprer
=================

Comparing time on my machine for factorial of 50000 for each language
Machine Spec :
6GB Ram
2.1GHz

SML : 1min 22s consuming 25% of Ram for fact 50000
      3min 45s consuming 25% of Ram for fact 75000
Sml tail recursion optimization

Python interpreter crashed at 26186 stating Segmentation fault core
dumped

Julia 3.8s for fact 50000!!!!! Wow
      1min 0.1s fact 60000
      Ubuntu crash at 75000 Memory issue

Haskell

Factorial By recursion

fact 2,00,000 => 33.389s
fact 1,00,000=> 7.78s
fact 50,000=>1.559s

Factorial using in-built product
fact 2,00,000=>30.49s


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Eccilia mordax G.F. Atk.

### Remarks
null


text:
FROM nginx
ONBUILD COPY . /usr/share/nginx/html


text:
package org.apache.airavata.gfac.monitor;

import org.apache.airavata.gfac.monitor.exception.AiravataMonitorException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.List;

/**
 * This is the datastructure to keep the user centric job data, rather keeping
 * the individual jobs we keep the jobs based on the each user
 */
public class UserMonitorData {
    private final static Logger logger = LoggerFactory.getLogger(UserMonitorData.class);

    private String  userName;

    private List<HostMonitorData> hostMonitorData;

    public UserMonitorData(String userName) {
        this.userName = userName;
        hostMonitorData = new ArrayList<HostMonitorData>();
    }

    public UserMonitorData(String userName, List<HostMonitorData> hostMonitorDataList) {
        this.hostMonitorData = hostMonitorDataList;
        this.userName = userName;
    }

    public List<HostMonitorData> getHostMonitorData() {
        return hostMonitorData;
    }

    public void setHostMonitorData(List<HostMonitorData> hostMonitorData) {
        this.hostMonitorData = hostMonitorData;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    /*
    This method will add element to the MonitorID list, user should not
    duplicate it, we do not check it because its going to be used by airavata
    so we have to use carefully and this method will add a host if its a new host
     */
    public void addHostMonitorData(HostMonitorData hostMonitorData) throws AiravataMonitorException {
        this.hostMonitorData.add(hostMonitorData);
    }
}


text:
using System;
using System.Collections.Generic;
using System.Data.Entity;
using Hopnscotch.Portal.Contracts;

namespace Hopnscotch.Portal.Data.Helpers
{
    internal sealed class RepositoryProvider : IRepositoryProvider
    {
        private readonly IRepositoryFactories repositoryFactories;

        public RepositoryProvider(IRepositoryFactories repositoryFactories)
        {
            this.repositoryFactories = repositoryFactories;
            Repositories = new Dictionary<Type, object>();
        }

        public DbContext DbContext { get; set; }

        public IRepository<T> GetRepositoryForEntityType<T>() where T : class
        {
            return GetRepository<IRepository<T>>(repositoryFactories.GetRepositoryFactoryForEntityType<T>());
        }

        public T GetRepository<T>(Func<DbContext, object> factory = null) where T : class
        {
            object repoObj;
            Repositories.TryGetValue(typeof(T), out repoObj);
            if (repoObj != null)
            {
                return (T)repoObj;
            }

            return MakeRepository<T>(factory, DbContext);
        }

        private Dictionary<Type, object> Repositories { get; set; }

        private T MakeRepository<T>(Func<DbContext, object> factory, DbContext dbContext)
        {
            var f = factory ?? repositoryFactories.GetRepositoryFactory<T>();
            if (f == null)
            {
                throw new NotImplementedException("No factory for repository type, " + typeof(T).FullName);
            }

            var repo = (T)f(dbContext);
            Repositories[typeof(T)] = repo;

            return repo;
        }

        public void SetRepository<T>(T repository)
        {
            Repositories[typeof(T)] = repository;
        }
    }
}


text:
from Houdini.Handlers import Handlers, XT

@Handlers.Handle(XT.OpenBook)
@Handlers.Throttle()
def handleOpenPlayerBook(self, data):
    self.room.sendXt("at", self.user.ID)

@Handlers.Handle(XT.CloseBook)
@Handlers.Throttle()
def handleClosePlayerBook(self, data):
    self.room.sendXt("rt", self.user.ID)


text:
package com.test.arduinosocket.activity.adapters;

import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.TextView;

import com.test.arduinosocket.R;
import com.test.arduinosocket.common.Constants;
import com.test.arduinosocket.core.CommandData;
import com.test.arduinosocket.core.Device;
import com.test.arduinosocket.core.DeviceManager;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 15-04-2017.
 */

public class AvailableDeviceListAdapter extends ArrayAdapter<Device> {
    private final Context context;
    private final List<Device> values;
    private int selectedPosition = 0;
    private DeviceManager deviceManager;

    public AvailableDeviceListAdapter(Context context, List<Device> values) {
        super(context, R.layout.list_item_available_devices, values);
        this.context = context;
        this.values = values;

        if(values == null) {
            values = new ArrayList<Device>();
        }
        deviceManager=DeviceManager.getInstance();
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View view = convertView;
        if (view == null) {
            LayoutInflater vi = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            view = vi.inflate(R.layout.list_item_available_devices, parent, false);
            final TextView mainText = (TextView)view.findViewById(R.id.textViewAvailableLockName);
            mainText.setText(values.get(position).getDeviceId());
            final Device tempDevice=deviceManager.getTempPairingDeviceMap().get(values.get(position).getDeviceId());
            if(tempDevice!=null){
                TextView ipText = (TextView) view.findViewById(R.id.textViewAvailableDevicesIP);
                ipText.setText(tempDevice.getDeviceIp().getHostAddress());
                ImageView pairImageView=(ImageView)view.findViewById(R.id.imageViewPair);
                pairImageView.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {

                        final String responseMessage=new CommandData().setCommand(Constants.UDP_PAIR_BROADCAST)
                                .setData(tempDevice.getDeviceKey())
                                .setDeviceId(deviceManager.getPhoneId())
                                .setDeviceKey(deviceManager.getPhoneKey())
                                .setResponse(true)
                                .setError(false)
                                .setData(tempDevice.getDeviceKey())
                                .buildCommandString();
                        new Thread(new Runnable() {
                            @Override
                            public void run() {
                                deviceManager.getBroadcastCommandProcessor().sendMessage(responseMessage, tempDevice);
                            }
                        }).start();
                    }
                });
            }
        }
        return view;
    }
}


text:
import React, { Component } from 'react'
import { bindActionCreators } from 'redux'
import { connect } from 'react-redux'

import { setFilter, setType, setCluster } from './filter.actions'
import FilterComponent from './filter.component'

class FilterContainer extends Component {
  render() {
    return (
      <FilterComponent {... this.props}/>
    )
  }
}

export default connect(
  state => ({ filter: state.filter.query, routes: state.routes }),
  dispatch => bindActionCreators({ setFilter, setType, setCluster }, dispatch)
)(FilterContainer)


text:
/**
 * wave_tables.h
 *
 * Definition of wave table structure and data tables.
 *
 */
#ifndef _WAVE_TABLES__H
#define _WAVE_TABLES__H

#include <stdint.h>

// Wave table constants
const size_t WAVE_NAME_LEN = 17; // 16 Chars
const size_t WAVE_TABLE_MAX = 0xFF;
const size_t WAVE_TABLE_LEN = WAVE_TABLE_MAX + 1;
const uint8_t WAVE_DYNAMIC_RANGE = 0xFF;

// Result code defines
#define WAVE_FILE_OK                   0
#define WAVE_FILE_NOT_FOUND            1
#define WAVE_FILE_INVALID_HEADER       2
#define WAVE_FILE_UNKNOWN_VERSION      3
#define WAVE_FILE_CHECKSUM_FAILED      4
#define WAVE_FILE_ERROR_WRITING_HEADER 5
#define WAVE_FILE_ERROR_WRITING_DATA   6
#define WAVE_FILE_MAX_ERROR WAVE_FILE_ERROR_WRITING_DATA

/**
 * Wave table definition
 */
typedef struct WaveTable {
  char name[WAVE_NAME_LEN];
  uint8_t data[WAVE_TABLE_LEN];
} WaveTable;

/**
 * Get an error message string from an error code.
 *
 * @param error - Error code
 * @return Return pointer to message.
 */
const char* wt_errorMessage(uint8_t error);

/**
 * Load a wave table from ESP8266 filesystem.
 *
 * @param wave - Pointer to a wavetable to load wave data into.
 * @param path - Path to file.
 * @return Result of load see WAVE_FILE_* for details.
 */
uint8_t wt_load(WaveTable* wave, char* path);

/**
 * Save a wave table to ESP8266 filesystem.
 *
 * @param wave - Pointer to a wavetable to save.
 * @param path - Path to file.
 * @return Result of load see WAVE_FILE_* for details.
 */
uint8_t wt_save(WaveTable* wave, char* path);

/**
 * Set wave table to zero.
 */
void wt_zero(WaveTable* wave);

/**
 * Mirror the waveform
 */
void wt_mirror(WaveTable* wave);

/**
 * Invert the waveform
 */
void wt_invert(WaveTable* wave);

#endif //!_WAVE_TABLES__H


text:
//Problem 10.* Beer Time

//A beer time is after 1:00 PM and before 3:00 AM.
//Write a program that enters a time in format "hh:mm tt" (an hour in range [01...12], a minute
//in range [00…59]and AM/PM designator) and prints beer time or non-beer time according to the definition
//above or invalid time if the time cannot be parsed. Note: You may need to learn how to parse dates and times.

using System;
using System.IO;
using System.Globalization;
class DateAndTime
{
    static void Main()
    {
        Console.WriteLine(@"Enter time in format ""hh:mm tt""
(an hour in range [01...12], a minute in range [00…59]and AM/PM designator):");
        var timeChek = DateTime.Parse(Console.ReadLine());

        TimeSpan timespan1 = new TimeSpan(03, 00, 00);
        DateTime time1 = DateTime.Today.Add(timespan1);

        TimeSpan timespan2 = new TimeSpan(13, 00, 00);
        DateTime time2 = DateTime.Today.Add(timespan2);

        if (timeChek.TimeOfDay < time1.TimeOfDay || timeChek.TimeOfDay >= time2.TimeOfDay)
        {
            Console.WriteLine("Beer time!");
        }
        else
        {
            Console.WriteLine("non-beer time");
        }
    }
}


text:
"""
Count the occurrence of motifs in a genbank file
"""

import os
import sys
import argparse
from roblib import genbank_seqio, rc

__author__ = 'Rob Edwards'

if __name__ == "__main__":
    parser = argparse.ArgumentParser(description='Count the motif and its occurrence in a sequence')
    parser.add_argument('-f', help='input genbank file', required=True)
    parser.add_argument('-m', help='motif to look for', type=str)
    parser.add_argument('-v', help='verbose output', action='store_true')
    args = parser.parse_args()

    motif = args.m.upper()

    print("File\tContig\tLength\tNumber matches")
    for seq in genbank_seqio(args.f, args.v):
        dna = seq.seq.upper()
        count = dna.count(motif)
        count += dna.count(rc(motif))
        print(f"{args.f}\t{seq.id}\t{len(dna)}\t{count}")


text:
package com.google.android.accessibility.talkback.speech;

import android.content.Context;
import android.content.SharedPreferences;
import androidx.annotation.VisibleForTesting;
import com.google.android.accessibility.compositor.GlobalVariables;
import com.google.android.accessibility.talkback.R;
import com.google.android.accessibility.utils.SharedPreferencesUtils;
import com.google.android.accessibility.utils.monitor.HeadphoneStateMonitor;
import com.google.android.accessibility.utils.monitor.HeadphoneStateMonitor.Listener;

/**
 * Manages whether passwords should be spoken on Android O and above by telling the GlobalVariables
 * what to do. This should only be used on API 23+ because it depends on HeadphoneStateMonitor which
 * uses methods added in 23. This is alright because we are using this to support an O feature.
 */
public class SpeakPasswordsManager {

  private final Context context;
  private final HeadphoneStateMonitor headphoneStateMonitor;
  private final GlobalVariables globalVariables;

  private boolean headphonesConnected;

  public SpeakPasswordsManager(
      Context context,
      HeadphoneStateMonitor headphoneStateMonitor,
      GlobalVariables globalVariables) {
    this.context = context;
    this.headphoneStateMonitor = headphoneStateMonitor;
    this.globalVariables = globalVariables;

    headphonesConnected = HeadphoneStateMonitor.isHeadphoneOn(context);

    // Register a listener with the headphone state to keep global variables updated with changes.
    this.headphoneStateMonitor.setHeadphoneListener(headphoneChangeListener);
  }

  /** Handles headphone connection state changes, by updating speak policy in global variables. */
  @VisibleForTesting
  HeadphoneStateMonitor.Listener headphoneChangeListener =
      new Listener() {
        @Override
        public void onHeadphoneStateChanged(boolean isConnected) {
          headphonesConnected = isConnected;
          globalVariables.setSpeakPasswords(shouldSpeakPasswords());
        }
      };

  /**
   * Whether passwords should be spoken out loud, based on the user's set preference and the
   * headphone state if applicable.
   */
  private boolean shouldSpeakPasswords() {
    if (getAlwaysSpeakPasswordsPref(context)) {
      // If the setting is on then the user has selected speaking passwords even without headphones.
      return true;
    } else {
      // Only speak if headphones are present
      return headphonesConnected;
    }
  }

  /** Notify this class that preferences have changed. */
  public void onPreferencesChanged() {
    headphonesConnected = headphoneStateMonitor.hasHeadphones();
    boolean shouldSpeakPasswords = shouldSpeakPasswords();
    globalVariables.setSpeakPasswords(shouldSpeakPasswords);
  }
  /**
   * Gets the current value of the Should Speak Passwords Always (or only with headphones) setting.
   */
  public static boolean getAlwaysSpeakPasswordsPref(Context context) {
    SharedPreferences prefs = SharedPreferencesUtils.getSharedPreferences(context);
    return SharedPreferencesUtils.getBooleanPref(
        prefs,
        context.getResources(),
        R.string.pref_speak_passwords_without_headphones,
        R.bool.pref_speak_passwords_without_headphones_default);
  }
}


text:
@interface UIViewController (firstAppear)
@property (assign, nonatomic, readonly) BOOL firstAppear;
@end


text:
/**
 * A GeoPoint models a point on the earth.

 *
 * @specfield  latitude : double          // measured in degrees
 * @specfield  longitude : double         // measured in degrees
 * @endspec
 *
 *
GeoPoints are immutable.
 *
 *
 *
South latitudes and west longitudes are represented by negative numbers.
 *
 *
The code may assume that the represented points are nearby Boston.
 *
 *
Implementation hint:

 * Boston is at approximately 42 deg. 21 min. 30 sec. N latitude and 71
 * deg. 03 min. 37 sec. W longitude.  At that location, there are
 * approximately 69.023 miles per degree of latitude and 51.075 miles per
 * degree of longitude.  An implementation may use these values when
 * determining distances and headings.
 **/
namespace GeoPoint
{
    public class GeoPoint
    {
        private static double REP_SCALE_FACTOR = 1000000.0;

        private int latitude;
        private int longitude;

        // Constructors

        /**
         * @requires the point given by (latitude, longitude) is near Boston
         * @effects constructs a GeoPoint from a latitude and longitude given in degrees East and North.
         **/
        public GeoPoint(int latitude, int longitude)
        {
            Assert.assertTrue((41000000 <= latitude) && (latitude <= 43000000));
            Assert.assertTrue((-72000000 <= longitude) && (longitude <= -70000000));

            this.latitude = latitude;
            this.longitude = longitude;
        }
        // Observers

        public override string ToString()
        {
            return "Pt{" +
              (latitude / REP_SCALE_FACTOR) +
              "," +
              (longitude / REP_SCALE_FACTOR) +
              "}";
        }

        /**
         * Compares the specified object with this GeoPoint for equality.
         * @return    gp != null && (gp is GeoPoint)
         *         && gp.latitude == this.latitude && gp.longitude == this.longitude
         **/
        public bool equals(object o)
        {
            if (!(o is GeoPoint))
                return false;

            GeoPoint other = (GeoPoint)o;
            return
              (this.latitude == other.latitude) &&
              (this.longitude == other.longitude);
        }

        // specified by superclass (object)
        public int hashCode()
        {
            return latitude * 7 + longitude * 41;
        }

        /** Computes the distance between GeoPoints.
         * @requires gp != null
         * @return a close approximation of as-the-crow-flies distance, in
         *         miles, from this to gp
         **/
        public double distanceTo(GeoPoint gp)
        {
            Assert.assertNotNull(gp);

            double x = (gp.latitude - this.latitude) * 69.023 / REP_SCALE_FACTOR;
            double y = (gp.longitude - this.longitude) * 51.075 / REP_SCALE_FACTOR;
            return System.Math.Sqrt(x * x + y * y);
        }

        /** Computes the compass heading between GeoPoints.
         * @requires gp != null && !this.equals(gp)
         * @return a close approximation of compass heading h from this to
         *         gp, in degrees, such that 0 <= h < 360.  In compass
         *         headings, * north = 0, east = 90, south = 180, and west =
         *         270.
         **/
        public double headingTo(GeoPoint gp)
        {
            Assert.assertNotNull(gp);
            Assert.assertTrue(!equals(gp));

            double x = (gp.latitude - this.latitude) * 69.023 / REP_SCALE_FACTOR;
            double y = (gp.longitude - this.longitude) * 51.075 / REP_SCALE_FACTOR;

            double angle = (System.Math.Atan2(y, x)) * 180.0 / System.Math.PI;
            if (angle < 0)
            {
                angle += 360.0;
            }
            return angle;
        }

    } // GeoPoint
}


text:
Sequel.migration do

  change do
    alter_table :instances do
      add_column :logo, String
    end
  end

end


text:
package com.jarvanmo.exoplayerview.media;

import android.net.Uri;

import java.util.List;

/**
 * Created by mo on 18-1-11.
 * 剑气纵横三万里 一剑光寒十九洲
 */

public interface ExoMediaSource {

    interface Quality {
        CharSequence getDisplayName();

        Uri getUri();

        void setUri(Uri uri);

        void setDisplayName(CharSequence displayName);

        void setQuality(String quality);

        String getQuality();

    }

    Uri uri();

    String name();

    List<Quality> qualities();

    String extension();
}


text:
package org.camunda.bpm.model.bpmn.instance.bpmndi;

import org.camunda.bpm.model.bpmn.instance.di.Diagram;

import java.util.Collection;

/**
 * The BPMNDI BPMNDiagram element
 *
 * @author Sebastian Menski
 */
public interface BpmnDiagram extends Diagram {

  BpmnPlane getBpmnPlane();

  void setBpmnPlane(BpmnPlane bpmnPlane);

  Collection<BpmnLabelStyle> getBpmnLabelStyles();

}


text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Stormancer.Core
{
    public enum ConnectionState
    {
        Disconnected,
        Connecting,
        Connected
    }

    public interface IConnection
    {
        /// <summary>
        /// Unique id in the node for the connection.
        /// </summary>
        long Id { get; }

        /// <summary>
        /// Ip address of the remote peer.
        /// </summary>
        string IpAddress { get; }

        /// <summary>
        /// Connection date.
        /// </summary>
        DateTime ConnectionDate { get; }

        /// <summary>
        /// Metadata associated with the connection.
        /// </summary>
        Dictionary<string, string> Metadata { get; }

        /// <summary>
        /// Register components.
        /// </summary>
        void RegisterComponent<T>(T component);

        /// <summary>
        /// Gets a service from the object.
        /// </summary>
        /// <typeparam name="T">Type of the service to fetch.</typeparam>
        /// <param name="key">A string containing the service key.</param>
        /// <returns>A service object.</returns>
        T GetComponent<T>();

        /// <summary>
        /// Account of the application which the peer is connected to.
        /// </summary>
        string Account { get; }

        /// <summary>
        /// Name of the application to which the peer is connected.
        /// </summary>
        string Application { get; }

        /// <summary>
        /// State of the connection.
        /// </summary>
        ConnectionState State { get; }

        /// <summary>
        /// Closes the connection.
        /// </summary>
        void Close();

        /// <summary>
        /// Sends a system message to the peer.
        /// </summary>
        /// <param name="msgId">Id of the system message.</param>
        /// <param name="writer"></param>
        void SendSystem(byte msgId, Action<Stream> writer);

        /// <summary>
        /// Sends a system message to the peer.
        /// </summary>
        /// <param name="msgId">Id of the system message.</param>
        /// <param name="writer"></param>
        /// <param name="priority">The priority of the message to send.</param>
        void SendSystem(byte msgId, Action<Stream> writer, PacketPriority priority);

        //void SendRaw(Action<Stream> writer, Stormancer.Core.PacketPriority priority, Stormancer.Core.PacketReliability reliability, char channel);

        /// <summary>
        /// Sends a packet to the target remote scene.
        /// </summary>
        /// <param name="sceneIndex"></param>
        /// <param name="route"></param>
        /// <param name="writer"></param>
        /// <param name="priority"></param>
        /// <param name="reliability"></param>
        /// <param name="channel"></param>
        void SendToScene(byte sceneIndex,
            ushort route,
            Action<Stream> writer,
            PacketPriority priority,
            PacketReliability reliability);

        /// <summary>
        /// Event fired when the connection has been closed.
        /// </summary>
        Action<string> ConnectionClosed { get; set; }

        void SetApplication(string account, string application);

        /// <summary>
        /// The connection's Ping in milliseconds.
        /// </summary>
        int Ping { get; }

        /// <summary>
        /// Returns advanced statistics about the connection.
        /// </summary>
        /// <returns>The required statistics.</returns>
        IConnectionStatistics GetConnectionStatistics();
    }
}


text:
package org.apache.hadoop.hdfs;

import java.io.IOException;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import junit.extensions.TestSetup;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.TestTrash;

/**
 * This class tests commands from Trash.
 */
public class TestHDFSTrash extends TestTrash {

  private static MiniDFSCluster cluster = null;
  public static Test suite() {
    TestSetup setup = new TestSetup(new TestSuite(TestHDFSTrash.class)) {
      protected void setUp() throws Exception {
        Configuration conf = new Configuration();
        cluster = new MiniDFSCluster(conf, 2, true, null);
      }
      protected void tearDown() throws Exception {
        if (cluster != null) { cluster.shutdown(); }
      }
    };
    return setup;
  }

  /**
   * Tests Trash on HDFS
   */
  public void testTrash() throws IOException {
    trashShell(cluster.getFileSystem(), new Path("/"));
  }

  public void testNonDefaultFS() throws IOException {
    FileSystem fs = cluster.getFileSystem();
    Configuration conf = fs.getConf();
    conf.set("fs.default.name", fs.getUri().toString());
    trashNonDefaultFS(conf);
  }

}