text:
package com.springsource.greenhouse.invite.mail;

import java.util.List;

import javax.inject.Inject;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.ClassPathResource;
import org.springframework.mail.MailSender;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.scheduling.annotation.Async;
import org.springframework.security.crypto.keygen.KeyGenerators;
import org.springframework.security.crypto.keygen.StringKeyGenerator;
import org.springframework.stereotype.Service;
import org.springframework.templating.LocalStringTemplate;
import org.springframework.templating.ResourceStringTemplateFactory;
import org.springframework.templating.StringTemplate;
import org.springframework.templating.StringTemplateFactory;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.util.UriTemplate;

import com.springsource.greenhouse.account.Account;
import com.springsource.greenhouse.invite.InviteRepository;
import com.springsource.greenhouse.invite.Invitee;

/**
 * A MailInviteService implementation that sends email invites asynchronously in a separate thread.
 * Relies on Spring's @Async support enabled by AspectJ for the asynchronous behavior.
 * Uses a StringTemplate to generate the invitation mail text from a template.
 * The text will contain a link to the invite accept page and instruct the invitee to activate it.
 * @author Keith Donald
 */
@Service
public class AsyncMailInviteService implements MailInviteService {

	private final MailSender mailSender;

	private final InviteRepository inviteRepository;

	private final UriTemplate acceptUriTemplate;

	/**
	 * Creates the AsyncMailInviteService.
	 * @param mailSender the object that actually does the mail delivery using the JavaMail API.
	 * @param inviteRepository the interface for saving the invite for retrieval later
	 * @param acceptUriTemplate a template for generating the URL the invitee should visit to accept the invite; defaults to a secure application URL e.g. https://host/invite/accept?token={token}
	 */
	@Inject
	public AsyncMailInviteService(MailSender mailSender, InviteRepository inviteRepository, @Value("#{environment['application.secureUrl']}/invite/accept?token={token}") String acceptUriTemplate) {
		this.mailSender = mailSender;
		this.inviteRepository = inviteRepository;
		this.acceptUriTemplate = new UriTemplate(acceptUriTemplate);
	}

	public void sendInvite(Account from, List<Invitee> to, String invitationBody) {
		StringTemplate textTemplate = textTemplateFactory.getStringTemplate();
		textTemplate.put("account", from);
		StringTemplate bodyTemplate = new LocalStringTemplate(invitationBody);
		for (Invitee invitee : to) {
			bodyTemplate.put("invitee", invitee);
			textTemplate.put("body",  bodyTemplate.render());
			String token = tokenGenerator.generateKey();
			textTemplate.put("acceptUrl", acceptUriTemplate.expand(token));
			send(from, invitee, textTemplate.render(), token);
		}
	}

	// internal helpers

	@Async
	@Transactional
	private void send(Account from, Invitee to, String text, String token) {
		SimpleMailMessage mailMessage = createInviteMailMessage(to, text);
		if (!inviteRepository.alreadyInvited(to.getEmail())) {
			inviteRepository.saveInvite(token, to, text, from.getId());
			mailSender.send(mailMessage);
		}
	}

	private SimpleMailMessage createInviteMailMessage(Invitee to, String text) {
		SimpleMailMessage mailMessage = new SimpleMailMessage();
		mailMessage.setFrom("Greenhouse <noreply@springsource.com>");
		mailMessage.setTo(to.getEmail());
		mailMessage.setSubject("Your Greenhouse Invitation");
		mailMessage.setText(text);
		return mailMessage;
	}

	private final StringTemplateFactory textTemplateFactory = new ResourceStringTemplateFactory(new ClassPathResource("invite-text.st", getClass()));

	private final StringKeyGenerator tokenGenerator = KeyGenerators.string();

}


text:
{% extends "base.html" %}

{% block content %}

{{post.title}}

Created on {{post.timestamp}}

{{post.body}}

Comments:

{% for comment in post.comments %}

{{comment.body}}

    {% endfor %}

Comment Form

<form action="" method="post" name="comment">
    {{comment_form.hidden_tag()}}
    {{comment_form.body}}
    {% for error in comment_form.errors.body %}

{{error}}

    {% endfor %}

    <input type="submit" value="Comment">
</form>

{% endblock %}

redpajama_set_name: RedPajamaGithub


text:
body {
    background-image: url("../img/moreico.gif");
    background-size: 70% auto;
    background-position: left top;
    background-repeat: no-repeat;
    background-color: #181818;

}

header{
    overflow: hidden;
}

#moreIco {
    width: 100%;
    height: auto;
    max-width: 484px;
    max-height: 170px;
    float: left;

}

#textDiv{
    margin-top: 30%;
    border-top: thick solid #00a8ff;
    color: #ffa300;
    font-size: medium;
    font-family: "Arial";
    border-bottom: thick solid #00a8ff;
    padding-bottom: 15px;
    vertical-align: middle;
    background-color: #202020;
}

footer {
    color: darkgoldenrod;
    vertical-align: bottom;
    overflow: hidden;
}


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Syll. fung. (Abellini) 17: 34 (1905)

#### Original name
Cantharellus cibarius var. neglectus (M. Souché) Sacc., 1905

### Remarks
null


text:
<?php

declare(strict_types=1);

namespace phpDocumentor\Guides\RestructuredText\HTML\Directives;

use phpDocumentor\Guides\Nodes\Node;
use phpDocumentor\Guides\RestructuredText\Directives\SubDirective;
use phpDocumentor\Guides\RestructuredText\Parser;

/**
 * Divs a sub document in a div with a given class
 */
class Div extends SubDirective
{
    public function getName() : string
    {
        return 'div';
    }

    /**
     * @param string[] $options
     */
    public function processSub(
        Parser $parser,
        ?Node $document,
        string $variable,
        string $data,
        array $options
    ) : ?Node {
        $divOpen = $document->getEnvironment()->getRenderer()->render(
            'div-open.html.twig',
            ['class' => $data]
        );

        return $parser->getNodeFactory()->createWrapperNode($document, $divOpen, '</div>');
    }
}


text:
package com.kevinquan.cwa.model.creatures.plains;

public class WoadicChief extends AbstractPlainsCreature {

    @SuppressWarnings("unused")
    private static final String TAG = WoadicChief.class.getSimpleName();

    public WoadicChief() {
        super("Woadic Chief", 5, Rarity.AlgebraicRare);
        mDescription = "No Creature or Building may be summoned on the opposing lane next turn"; // Check
    }

    @Override public int getBaseAttack() { return 18; }
    @Override public int getBaseDefense() { return 30; }
    @Override public int getFloopCost() { return 3; }

    @Override public int getBaseGoldAttack() { return 27; }
    @Override public int getBaseGoldDefense() { return 45; }
}


text:
namespace Trovo.Base.Models.Users
{
    /// <summary>
    /// Private information about a user.
    /// </summary>
    public class PrivateUserModel
    {
        /// <summary>
        /// The ID of the user.
        /// </summary>
        public string userId { get; set; }
        /// <summary>
        /// The name of the user.
        /// </summary>
        public string userName { get; set; }
        /// <summary>
        /// The display name of the user.
        /// </summary>
        public string nickName { get; set; }
        /// <summary>
        /// The email of the user.
        /// </summary>
        public string email { get; set; }
        /// <summary>
        /// The profile picture of the user.
        /// </summary>
        public string profilePic { get; set; }
        /// <summary>
        /// The display information for the user.
        /// </summary>
        public string info { get; set; }
        /// <summary>
        /// The ID of the channel for the user.
        /// </summary>
        public string channelId { get; set; }
    }
}


text:
CREATE TABLE tx_tevglossary_domain_model_entry (
    uid int(11) unsigned NOT NULL auto_increment,
    pid int(11) unsigned DEFAULT '0' NOT NULL,
    crdate int(11) unsigned DEFAULT '0' NOT NULL,
    tstamp int(11) unsigned DEFAULT '0' NOT NULL,
    cruser_id int(11) unsigned DEFAULT '0' NOT NULL,
    deleted tinyint(4) unsigned DEFAULT '0' NOT NULL,
    hidden tinyint(4) unsigned DEFAULT '0' NOT NULL,
    term varchar(255) DEFAULT '' NOT NULL,
    definition text NOT NULL,

    PRIMARY KEY (uid),
    KEY parent (pid),
    KEY deleted (deleted),
    KEY hidden (hidden)
);


text:
<title>CreateTerrain</title>

CreateTerrain()

Syntax

Result = CreateTerrain(#Terrain, Size, WorldSize, Scale, NbLayers, Filename$, Extension$)

Description

Creates a new terrain. SetupTerrains() has to be called before to set the default parameter
for the new terrain. After the terrain creation, new tiles can be defined with
DefineTerrainTile() and textures applied with AddTerrainTexture(). Once the terrain definition
is finished, BuildTerrain() needs to be called to build the final terrain.

Parameters

#Terrain

The number to identify the new terrain. #PB_Any can
be used to auto-generate this number.

Size

The size of the new terrain down one edge in vertices.

WorldSize

The world size of the new terrain.

Scale

The scale factor to apply to the new terrain.

NbLayers

The number of texture layers the new terrain will have. To add a texture layer, use AddTerrainTexture().

Filename$

The filename (without the extension) to store the precomputed terrain data. As the terrain can be complex
and take a lot of time to create, a cache will be written to disk and reloaded automatically if present (and not outdated).

Extension$

The extension used by the data files.

Return value

Returns zero if the #Terrain can't be created. If #PB_Any is used
as '#Terrain' parameter, the new terrain number is returned.

See Also

FreeTerrain(), SetupTerrains(), BuildTerrain(), DefineTerrainTile(), AddTerrainTexture()

Supported OS
All

<- BuildTerrain() - Terrain Index - CreateTerrainBody() ->


text:
using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;

namespace NUnitTestDemo
{
    public class ParameterizedTests
    {
        [TestCase(2, 2, 4)]
        [TestCase(0, 5, 5)]
        [TestCase(31, 11, 42)]
        public void TestCaseSucceeds(int a, int b, int sum)
        {
            Assert.That(a + b, Is.EqualTo(sum));
        }

        [TestCase(2, 2, Result = 4)]
        [TestCase(0, 5, Result = 5)]
        [TestCase(31, 11, Result = 42)]
        public int TestCaseSucceeds_Result(int a, int b)
        {
            return a + b;
        }

        [TestCase(31, 11, ExpectedException=typeof(Exception))]
        public void TestCaseSucceeds_ExpectedException(int a, int b)
        {
            throw new Exception("Expected");
        }

        [TestCase(31, 11, 99)]
        public void TestCaseFails(int a, int b, int sum)
        {
            Assert.That(a + b, Is.EqualTo(sum));
        }

        [TestCase(31, 11, Result = 99)]
        public int TestCaseFails_Result(int a, int b)
        {
            return a + b;
        }

        [TestCase(31, 11)]
        public void TestCaseIsInconclusive(int a, int b)
        {
            Assert.Inconclusive("Inconclusive test case");
        }

        [Ignore("Ignored test")]
        [TestCase(31, 11)]
        public void TestCaseIsIgnored_Attribute(int a, int b)
        {
        }

        [TestCase(31, 11, Ignore = true, Reason = "Ignoring this")]
        public void TestCaseIsIgnored_Property(int a, int b)
        {
        }

        [TestCase(31, 11)]
        public void TestCaseIsIgnored_Assert(int a, int b)
        {
            Assert.Ignore("Ignoring this test case");
        }

        [Explicit]
        [TestCase(31, 11)]
        public void TestCaseIsExplicit(int a, int b)
        {
        }

        [TestCase(31, 11)]
        public void TestCaseThrowsException(int a, int b)
        {
            throw new Exception("Exception from test case");
        }

        [TestCase(42, TestName="AlternateTestName")]
        public void TestCaseWithAlternateName(int x)
        {
        }
    }
}


text:
<!DOCTYPE html>
<title>Canvas test: 2d.text.baseline.default</title>

<link rel="stylesheet" href="../tests.css">
<link rel="prev" href="2d.text.baseline.invalid.html" title="2d.text.baseline.invalid">
<link rel="next" href="2d.text.draw.fill.basic.html" title="2d.text.draw.fill.basic">

 <
 [index]
 >

2d.text.baseline.default

References:

2d.text.baseline.default

Actual output:

<canvas id="c" class="output" width="100" height="50">
FAIL (fallback content)
</canvas>


text:
package tsunagi.example.processModel.node.infomational;

import java.util.ArrayList;

import tsunagi.core.domain.MetaTaskAssigned;
import tsunagi.core.info.InitialInfo;
import tsunagi.core.info.PageInfo;
import tsunagi.core.node.NodeUserInformationalTask;
import tsunagi.core.security.UserManager;

public class NodeInformational extends NodeUserInformationalTask {
	public NodeInformational() {
		this.setName("NodeInformational");
		this.setDescription("Read Information");
		this.setTaskTitle("Read Information");
	}

	@Override
	protected ArrayList<MetaTaskAssigned> buildAssignment(InitialInfo initInfo) {
		return UserManager.INSTANCE.getUserProcessor().getMetaTaskAssigned("userTester5");
	}

	@Override
	protected void setPageInfoForOpenTask(PageInfo pageInfo) {
		pageInfo.setPageName("info.jsp");
	}

	@Override
	protected void setPageInfoForProcessTask(PageInfo pageInfo) {
		pageInfo.setPageName("index.jsp");
	}

}


text:
import path from "path";
import { PluginLogger, WorkingDirectoryInfo } from "reg-suit-interface";

import { lookup } from "mime-types";
import glob from "glob";
import _ from "lodash";

export type FileItem = {
  path: string;
  absPath: string;
  mimeType: string;
};

export type RemoteFileItem = {
  key: string;
  remotePath: string;
};

export type ObjectMetadata = {
  key: string;
};

export type ObjectListResult = {
  isTruncated: boolean;
  contents: ObjectMetadata[];
  nextMarker?: string;
};

const CONCURRENCY_SIZE = 50;
const DEFAULT_PATTERN = "**/*.{html,js,wasm,png,json,jpeg,jpg,tiff,bmp,gif}";

export abstract class AbstractPublisher {
  protected noEmit = false;
  protected logger!: PluginLogger;

  protected abstract uploadItem(key: string, item: FileItem): Promise<FileItem>;
  protected abstract downloadItem(remoteItem: RemoteFileItem, item: FileItem): Promise<FileItem>;
  protected abstract listItems(lastKey: string, prefix: string): Promise<ObjectListResult>;
  protected abstract getWorkingDirs(): WorkingDirectoryInfo;
  protected abstract getLocalGlobPattern(): string | undefined;
  protected abstract getBucketName(): string;
  protected abstract getBucketRootDir(): string | undefined;

  protected createList(): Promise<FileItem[]> {
    return new Promise<string[]>((resolve, reject) => {
      glob(
        this.getLocalGlobPattern() || DEFAULT_PATTERN,
        {
          cwd: this.getWorkingDirs().base,
          nodir: true,
        },
        (err, list) => {
          if (err) {
            return reject(err);
          }
          resolve(list);
        },
      );
    }).then(files => {
      return files
        .map(f => {
          const mimeType = lookup(f) || "unknown";
          return {
            path: f,
            absPath: path.resolve(this.getWorkingDirs().base, f),
            mimeType,
          };
        })
        .filter(item => !!item.mimeType);
    });
  }

  protected resolveInBucket(key: string) {
    if (this.getBucketRootDir()) {
      return this.getBucketRootDir() + "/" + key;
    } else {
      return key;
    }
  }

  protected fetchInternal(key: string): Promise<any> {
    if (this.noEmit) return Promise.resolve();
    const actualPrefix = `${this.resolveInBucket(key)}/${path.basename(this.getWorkingDirs().actualDir)}`;
    const progress = this.logger.getProgressBar();
    return new Promise<ObjectMetadata[]>(async (resolve, reject) => {
      const contents = [] as ObjectMetadata[];
      let nextMarker: string | undefined = "";

      do {
        let result: ObjectListResult;

        try {
          result = await this.listItems(nextMarker, actualPrefix);
          const curContents = result.contents || [];
          if (curContents.length > 0) {
            Array.prototype.push.apply(contents, curContents);
          }

          nextMarker = result.nextMarker;
        } catch (e) {
          nextMarker = "";
          reject(e);
        }
      } while (nextMarker);

      resolve(contents);
    })
      .then(contents => {
        if (contents.length) {
          progress.start(contents.length, 0);
          this.logger.info(
            `Download ${contents.length} files from ${this.logger.colors.magenta(this.getBucketName())}.`,
          );
        }
        return contents.map(c => {
          const suffix = c.key ? c.key.replace(new RegExp(`^${actualPrefix}\/`), "") : "";
          return {
            path: suffix,
            absPath: path.join(this.getWorkingDirs().expectedDir, suffix),
            mimeType: lookup(suffix),
          } as FileItem;
        });
      })
      .then(items => _.chunk(items, CONCURRENCY_SIZE))
      .then(chunks => {
        return chunks.reduce((acc, chunk) => {
          return acc.then(list => {
            return Promise.all(
              chunk.map(item => {
                const remotePath = `${this.resolveInBucket(key)}/${path.basename(this.getWorkingDirs().actualDir)}/${
                  item.path
                }`;
                return this.downloadItem({ remotePath, key }, item).then(fi => {
                  progress.increment(1);
                  return fi;
                });
              }),
            ).then(items => [...list, ...items]);
          });
        }, Promise.resolve([] as FileItem[]));
      })
      .then(result => {
        progress.stop();
        return result;
      });
  }

  protected publishInternal(key: string) {
    const progress = this.logger.getProgressBar();
    return this.createList()
      .then(list => {
        if (list.length) {
          progress.start(list.length, 0);
          if (!this.noEmit) {
            this.logger.info(`Upload ${list.length} files to ${this.logger.colors.magenta(this.getBucketName())}.`);
          } else {
            this.logger.info(`There are ${list.length} files to publish`);
          }
        }
        return _.chunk(list, CONCURRENCY_SIZE);
      })
      .then(chunks => {
        return chunks.reduce((acc, chunk) => {
          return acc.then(list => {
            return Promise.all(
              chunk.map(item => {
                if (this.noEmit) return Promise.resolve(item);
                return this.uploadItem(this.resolveInBucket(key), item).then(fi => {
                  progress.increment(1);
                  return fi;
                });
              }),
            ).then(items => [...list, ...items]);
          });
        }, Promise.resolve([] as FileItem[]));
      })
      .then(items => {
        const indexFile = items.find(item => item.path.endsWith("index.html"));
        return { items, indexFile };
      })
      .then(result => {
        progress.stop();
        return result;
      });
  }
}


text:
package ec2

import "github.com/timob/javabind"

type ServicesEc2ModelVolumeStatusNameInterface interface {

	// public static com.amazonaws.services.ec2.model.VolumeStatusName[] values()
	Values() []*ServicesEc2ModelVolumeStatusName

	// public static com.amazonaws.services.ec2.model.VolumeStatusName valueOf(java.lang.String)
	ValueOf(a string) *ServicesEc2ModelVolumeStatusName

	// public java.lang.String toString()
	ToString() string

	// public static com.amazonaws.services.ec2.model.VolumeStatusName fromValue(java.lang.String)
	FromValue(a string) *ServicesEc2ModelVolumeStatusName
}

type ServicesEc2ModelVolumeStatusName struct {
	*javabind.Callable
}

// public static com.amazonaws.services.ec2.model.VolumeStatusName[] values()
func (jbobject *ServicesEc2ModelVolumeStatusName) Values() []*ServicesEc2ModelVolumeStatusName {
	jret, err := javabind.GetEnv().CallStaticMethod("com/amazonaws/services/ec2/model/VolumeStatusName", "values", javabind.ObjectArrayType("com/amazonaws/services/ec2/model/VolumeStatusName"))
	if err != nil {
		panic(err)
	}
	retconv := javabind.NewJavaToGoObjectArray(javabind.NewJavaToGoCallable(), "com/amazonaws/services/ec2/model/VolumeStatusName")
	dst := new([]*ServicesEc2ModelVolumeStatusName)
	retconv.Dest(dst)
	if err := retconv.Convert(javabind.ObjectRef(jret)); err != nil {
		panic(err)
	}
	retconv.CleanUp()
	return *dst
}

// public static com.amazonaws.services.ec2.model.VolumeStatusName valueOf(java.lang.String)
func (jbobject *ServicesEc2ModelVolumeStatusName) ValueOf(a string) *ServicesEc2ModelVolumeStatusName {
	conv_a := javabind.NewGoToJavaString()
	if err := conv_a.Convert(a); err != nil {
		panic(err)
	}
	jret, err := javabind.GetEnv().CallStaticMethod("com/amazonaws/services/ec2/model/VolumeStatusName", "valueOf", "com/amazonaws/services/ec2/model/VolumeStatusName", conv_a.Value().Cast("java/lang/String"))
	if err != nil {
		panic(err)
	}
	conv_a.CleanUp()
	retconv := javabind.NewJavaToGoCallable()
	dst := &javabind.Callable{}
	retconv.Dest(dst)
	if err := retconv.Convert(javabind.ObjectRef(jret)); err != nil {
		panic(err)
	}
	retconv.CleanUp()
	unique_x := &ServicesEc2ModelVolumeStatusName{}
	unique_x.Callable = dst
	return unique_x
}

// public java.lang.String toString()
func (jbobject *ServicesEc2ModelVolumeStatusName) ToString() string {
	jret, err := jbobject.CallMethod(javabind.GetEnv(), "toString", "java/lang/String")
	if err != nil {
		panic(err)
	}
	retconv := javabind.NewJavaToGoString()
	dst := new(string)
	retconv.Dest(dst)
	if err := retconv.Convert(javabind.ObjectRef(jret)); err != nil {
		panic(err)
	}
	retconv.CleanUp()
	return *dst
}

// public static com.amazonaws.services.ec2.model.VolumeStatusName fromValue(java.lang.String)
func (jbobject *ServicesEc2ModelVolumeStatusName) FromValue(a string) *ServicesEc2ModelVolumeStatusName {
	conv_a := javabind.NewGoToJavaString()
	if err := conv_a.Convert(a); err != nil {
		panic(err)
	}
	jret, err := javabind.GetEnv().CallStaticMethod("com/amazonaws/services/ec2/model/VolumeStatusName", "fromValue", "com/amazonaws/services/ec2/model/VolumeStatusName", conv_a.Value().Cast("java/lang/String"))
	if err != nil {
		panic(err)
	}
	conv_a.CleanUp()
	retconv := javabind.NewJavaToGoCallable()
	dst := &javabind.Callable{}
	retconv.Dest(dst)
	if err := retconv.Convert(javabind.ObjectRef(jret)); err != nil {
		panic(err)
	}
	retconv.CleanUp()
	unique_x := &ServicesEc2ModelVolumeStatusName{}
	unique_x.Callable = dst
	return unique_x
}

func (jbobject *ServicesEc2ModelVolumeStatusName) IoEnabled() *ServicesEc2ModelVolumeStatusName {
	jret, err := javabind.GetEnv().GetStaticField("com/amazonaws/services/ec2/model/VolumeStatusName", "IoEnabled", "com/amazonaws/services/ec2/model/VolumeStatusName")
	if err != nil {
		panic(err)
	}
	retconv := javabind.NewJavaToGoCallable()
	dst := &javabind.Callable{}
	retconv.Dest(dst)
	if err := retconv.Convert(javabind.ObjectRef(jret)); err != nil {
		panic(err)
	}
	retconv.CleanUp()
	unique_x := &ServicesEc2ModelVolumeStatusName{}
	unique_x.Callable = dst
	return unique_x
}

func (jbobject *ServicesEc2ModelVolumeStatusName) SetFieldIoEnabled(val ServicesEc2ModelVolumeStatusNameInterface) {
	conv_val := javabind.NewGoToJavaCallable()
	if err := conv_val.Convert(val); err != nil {
		panic(err)
	}
	err := javabind.GetEnv().SetStaticField("com/amazonaws/services/ec2/model/VolumeStatusName", "IoEnabled", conv_val.Value())
	if err != nil {
		panic(err)
	}
	conv_val.CleanUp()

}

func (jbobject *ServicesEc2ModelVolumeStatusName) IoPerformance() *ServicesEc2ModelVolumeStatusName {
	jret, err := javabind.GetEnv().GetStaticField("com/amazonaws/services/ec2/model/VolumeStatusName", "IoPerformance", "com/amazonaws/services/ec2/model/VolumeStatusName")
	if err != nil {
		panic(err)
	}
	retconv := javabind.NewJavaToGoCallable()
	dst := &javabind.Callable{}
	retconv.Dest(dst)
	if err := retconv.Convert(javabind.ObjectRef(jret)); err != nil {
		panic(err)
	}
	retconv.CleanUp()
	unique_x := &ServicesEc2ModelVolumeStatusName{}
	unique_x.Callable = dst
	return unique_x
}

func (jbobject *ServicesEc2ModelVolumeStatusName) SetFieldIoPerformance(val ServicesEc2ModelVolumeStatusNameInterface) {
	conv_val := javabind.NewGoToJavaCallable()
	if err := conv_val.Convert(val); err != nil {
		panic(err)
	}
	err := javabind.GetEnv().SetStaticField("com/amazonaws/services/ec2/model/VolumeStatusName", "IoPerformance", conv_val.Value())
	if err != nil {
		panic(err)
	}
	conv_val.CleanUp()

}


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

public class TessNet : Tesseract {

    bool isUnfolded = true;

    public override void OnClickCube(TessCube cube) {
        isUnfolded = !isUnfolded;
        ToggleCubes ();
    }

    void ToggleCubes() {
        for (int i = 1; i < cubes.Length; ++i) {
            cubes [i].SetVisible (isUnfolded);
        }
    }
}


text:
param([string]$root=$PSScriptRoot,
      [string]$packageType="preview")

################################################# Functions ############################################################

function WriteSectionHeader($sectionName)
{
    $startTime = Get-Date -DisplayHint Time
    Write-Host ""
    Write-Host "============================"
    Write-Host $sectionName
    Write-Host "Start Time:     "  $startTime
    Write-Host ""
}

function WriteSectionFooter($sectionName)
{
    $startTime = Get-Date -DisplayHint Time
    Write-Host ""
    Write-Host $sectionName
    Write-Host "End Time:     "  $startTime
    Write-Host "============================"
    Write-Host ""
}

################################################# Functions ############################################################

WriteSectionHeader("updateAssemblyInfo.ps1");
Write-Host "root:           " $root;
Write-Host "PSScriptRoot:   " $PSScriptRoot;

$date = Get-Date
$dateTimeStamp = ($date.ToString("yy")-19).ToString() + $date.ToString("MMddHHmmss")
[xml]$buildConfiguration = Get-Content $PSScriptRoot\buildConfiguration.xml

$assemblyVersion = [string]$buildConfiguration.SelectSingleNode("root/assemblyVersion").InnerText
$assemblyFileVersion = $assemblyVersion + "." + ($date.ToString("yy")-19).ToString() + $date.ToString("MMdd")
$assemblyInformationalVersion = $assemblyVersion + "." + $dateTimeStamp + "." + (git rev-parse HEAD)
Write-Host "assemblyVersion: "  $assemblyVersion
Write-Host "assemblyFileVersion: " $assemblyFileVersion
Write-Host "assemblyInformationalVersion: "  $assemblyInformationalVersion

$nugetSuffix = [string]$buildConfiguration.SelectSingleNode("root/nugetSuffix").InnerText
if ( $packageType -eq "release")
{
    $versionSuffix = ""
}
else
{
    $versionSuffix = $nugetSuffix + "-" + $dateTimeStamp
}

Write-Host "nugetSuffix: " $nugetSuffix
Write-Host "versionSuffix: " $versionSuffix

$versionPath = $PSScriptRoot + "/build/version.props"
$version = Get-Content $versionPath
$version = $version -replace "<VersionPrefix>(.*)</VersionPrefix>", "<VersionPrefix>$assemblyVersion</VersionPrefix>"
$version = $version -replace "<VersionSuffix>(.*)</VersionSuffix>", "<VersionSuffix>$versionSuffix</VersionSuffix>"
Set-Content $versionPath $version

foreach($project in $buildConfiguration.SelectNodes("root/projects/src/project"))
{
    $name = $project.name
    $assemblyInfoPath = "$root\src\$name\properties\AssemblyInfo.cs"
    Write-Host "assemblyInfoPath: " $assemblyInfoPath

    $assemblyInfo = Get-Content $assemblyInfoPath
    $assemblyInfo = $assemblyInfo -replace "AssemblyVersion(.*)", "AssemblyVersion(""$assemblyVersion"")]"
    $assemblyInfo = $assemblyInfo -replace "AssemblyFileVersion(.*)", "AssemblyFileVersion(""$assemblyFileVersion"")]"
    $assemblyInfo = $assemblyInfo -replace "AssemblyInformationalVersion(.*)", "AssemblyInformationalVersion(""$assemblyInformationalVersion"")]"
    Set-Content $assemblyInfoPath $assemblyInfo
}

WriteSectionFooter("updateAssemblyInfo.ps1")

return "$assemblyVersion-$versionSuffix"


text:
package org.wso2.carbon.ei.tests.connectors;

import org.json.JSONObject;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.wso2.connector.integration.test.base.ConnectorIntegrationTestBase;
import org.wso2.connector.integration.test.base.RestResponse;

import java.io.File;
import java.util.HashMap;
import java.util.Map;

/**
 * Integration test class for file connector
 */
public class FileConnectorIntegrationTest extends ConnectorIntegrationTestBase {

    private final Map<String, String> esbRequestHeadersMap = new HashMap<String, String>();

    /**
     * Set up the environment for test cases
     */
    @BeforeClass(alwaysRun = true)
    public void setEnvironment() throws Exception {
        String connectorName = System.getProperty("connector_name") + "-connector-" +
                System.getProperty("connector_version") + ".zip";
        init(connectorName);

        FtpsProvider.startFtpsServer();
        String connectionUri = FtpsProvider.getConnectionUri();

        String keystorePath = System.getProperty("carbon.home") + "/repository/resources/security/wso2carbon.jks";
        String truststorePath = System.getProperty("carbon.home") + "/repository/resources/security/client-truststore.jks";
        String source = connectionUri + File.separator + "in/?vfs.protection=P&vfs.ssl.keystore=" + keystorePath +
                        "&vfs.ssl.truststore=" + truststorePath +
                        "&vfs.ssl.kspassword=" + Constants.KEYSTORE_PASSWORD +
                        "&vfs.ssl.tspassword=" + Constants.TRUSTSTORE_PASSWORD +
                        "&vfs.ssl.keypassword=" + Constants.KEY_PASSWORD + "&vfs.passive=true";

        connectorProperties.put("source", source);
        connectorProperties.put("destination", System.getProperty("user.dir") + File.separator + "test-classes"
                                               + File.separator + "samples" + File.separator + "out");

        esbRequestHeadersMap.put("Accept-Charset", "UTF-8");
        esbRequestHeadersMap.put("Content-Type", "application/json");
        esbRequestHeadersMap.put("Accept", "application/json");
    }

    /**
     * Positive test case for copy file method using FTPS connection
     */
    @Test(groups = {"wso2.esb"}, description = "FileConnector copy file integration test using FTPS")
    public void testCopyFile() throws Exception {
        esbRequestHeadersMap.put("Action", "urn:copy");
        RestResponse<JSONObject> esbRestResponse = sendJsonRestRequest(proxyUrl, "POST", esbRequestHeadersMap,
                                                                       "FileCopyRequest.json");
        Assert.assertEquals(esbRestResponse.getHttpStatusCode(), 200);
        Assert.assertTrue(esbRestResponse.getBody().toString().contains("true"));
    }

    @AfterClass(description = "Shut down FTPS Server", alwaysRun = true)
    public void stopFtpsServer() {
        FtpsProvider.shutdownFtpsServer();
    }
}


text:
<?php

namespace Koine\AssetDownloader;

use GuzzleHttp\Client;
use League\Flysystem\Adapter\Local;
use League\Flysystem\Filesystem;
use Psr\Http\Message\UriInterface;

class AssetDownloader
{
    /**
     * @var string
     */
    private $from;

    /**
     * @var Filesystem
     */
    private $fileSystem;

    /**
     * @var Client
     */
    private $httpClient;

    /**
     * @param array $config
     *                      Allowed keys:
     *                      - from type: Sting
     *                      - destination type: Sting
     *                      - httpClient type: @see Client
     */
    public function __construct(array $config = [])
    {
        if (isset($config['fileSystem'])) {
            $this->setFilesystem($config['fileSystem']);
        }

        if (!isset($config['httpClient'])) {
            $config['httpClient'] = new Client();
        }

        if (isset($config['from'])) {
            $this->from($config['from']);
        }

        if (isset($config['destination'])) {
            $this->to($config['destination']);
        }

        $this->setHttpClient($config['httpClient']);
    }

    public function download(UriInterface $uri)
    {
        $path = $uri->getPath();
        $source = $this->from . $path;
        $contents = $this->httpClient->request('GET', $source)->getBody();
        $this->getFilesystem()->write($path, $contents);
    }

    /**
     * @param string $from
     *
     * @return self
     */
    public function from($from)
    {
        $this->from = rtrim($from, '/');

        return $this;
    }

    /**
     * @param string $to path to save the assets
     *
     * @return self
     */
    public function to($to)
    {
        $filesystem = new Filesystem(new Local($to));
        $this->setFilesystem($filesystem);

        return $this;
    }

    private function getFilesystem()
    {
        if ($this->fileSystem === null) {
            throw new \LocalException('Destination was not set');
        }

        return $this->fileSystem;
    }

    private function setHttpClient(Client $client)
    {
        $this->httpClient = $client;
    }

    private function setFilesystem(Filesystem $fileSystem)
    {
        $this->fileSystem = $fileSystem;
    }
}


text:
#include <windows.h>

extern void __enable_execute_stack (void *);

void
__enable_execute_stack (void *addr)
{
  MEMORY_BASIC_INFORMATION b;

  if (!VirtualQuery (addr, &b, sizeof(b)))
    abort ();
  VirtualProtect (b.BaseAddress, b.RegionSize, PAGE_EXECUTE_READWRITE,
		  &b.Protect);
}


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

namespace Kinect.Helper.Controller.Body
{
    public enum HandEventType
    {
        None,
        Press,
        Grip,
        GripRelease
    }
}


text:
namespace draco {

// A basic implementation of an attribute encoder that can be used to encode
// an arbitrary set of attributes. The encoder creates a sequential attribute
// encoder for each encoded attribute (see sequential_attribute_encoder.h) and
// then it encodes all attribute values in an order defined by a point sequence
// generated in the GeneratePointSequence() method. The default implementation
// generates a linear sequence of all points, but derived classes can generate
// any custom sequence.
class SequentialAttributeEncodersController : public AttributesEncoder {
 public:
  explicit SequentialAttributeEncodersController(
      std::unique_ptr<PointsSequencer> sequencer);
  SequentialAttributeEncodersController(
      std::unique_ptr<PointsSequencer> sequencer, int point_attrib_id);

  bool Init(PointCloudEncoder *encoder, const PointCloud *pc) override;
  bool EncodeAttributesEncoderData(EncoderBuffer *out_buffer) override;
  bool EncodeAttributes(EncoderBuffer *buffer) override;
  uint8_t GetUniqueId() const override { return BASIC_ATTRIBUTE_ENCODER; }

  int NumParentAttributes(int32_t point_attribute_id) const override {
    const int32_t loc_id = GetLocalIdForPointAttribute(point_attribute_id);
    if (loc_id < 0) {
      return 0;
    }
    return sequential_encoders_[loc_id]->NumParentAttributes();
  }

  int GetParentAttributeId(int32_t point_attribute_id,
                           int32_t parent_i) const override {
    const int32_t loc_id = GetLocalIdForPointAttribute(point_attribute_id);
    if (loc_id < 0) {
      return -1;
    }
    return sequential_encoders_[loc_id]->GetParentAttributeId(parent_i);
  }

  bool MarkParentAttribute(int32_t point_attribute_id) override {
    const int32_t loc_id = GetLocalIdForPointAttribute(point_attribute_id);
    if (loc_id < 0) {
      return false;
    }
    // Mark the attribute encoder as parent (even when if it is not created
    // yet).
    if (sequential_encoder_marked_as_parent_.size() <= loc_id) {
      sequential_encoder_marked_as_parent_.resize(loc_id + 1, false);
    }
    sequential_encoder_marked_as_parent_[loc_id] = true;

    if (sequential_encoders_.size() <= loc_id) {
      return true;  // Sequential encoders not generated yet.
    }
    sequential_encoders_[loc_id]->MarkParentAttribute();
    return true;
  }

  const PointAttribute *GetPortableAttribute(
      int32_t point_attribute_id) override {
    const int32_t loc_id = GetLocalIdForPointAttribute(point_attribute_id);
    if (loc_id < 0) {
      return nullptr;
    }
    return sequential_encoders_[loc_id]->GetPortableAttribute();
  }

 protected:
  bool TransformAttributesToPortableFormat() override;
  bool EncodePortableAttributes(EncoderBuffer *out_buffer) override;
  bool EncodeDataNeededByPortableTransforms(EncoderBuffer *out_buffer) override;

  // Creates all sequential encoders (one for each attribute associated with the
  // encoder).
  virtual bool CreateSequentialEncoders();

  // Create a sequential encoder for a given attribute based on the attribute
  // type
  // and the provided encoder options.
  virtual std::unique_ptr<SequentialAttributeEncoder> CreateSequentialEncoder(
      int i);

 private:
  std::vector<std::unique_ptr<SequentialAttributeEncoder>> sequential_encoders_;

  // Flag for each sequential attribute encoder indicating whether it was marked
  // as parent attribute or not.
  std::vector<bool> sequential_encoder_marked_as_parent_;
  std::vector<PointIndex> point_ids_;
  std::unique_ptr<PointsSequencer> sequencer_;
};

}  // namespace draco

#endif  // DRACO_COMPRESSION_ATTRIBUTES_SEQUENTIAL_ATTRIBUTE_ENCODERS_CONTROLLER_H_


text:
package org.lambda4j.function.tri.conversion;

import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.DoubleToLongFunction;
import java.util.function.IntConsumer;
import java.util.function.IntFunction;
import java.util.function.IntPredicate;
import java.util.function.IntToDoubleFunction;
import java.util.function.IntToLongFunction;
import java.util.function.IntUnaryOperator;
import java.util.function.LongToIntFunction;
import java.util.function.LongUnaryOperator;
import java.util.function.ToLongFunction;

import javax.annotation.CheckForNull;
import javax.annotation.Nonnegative;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import org.apache.commons.lang3.tuple.Triple;

import org.lambda4j.Lambda;
import org.lambda4j.consumer.tri.TriLongConsumer;
import org.lambda4j.function.bi.conversion.BiLongToIntFunction;
import org.lambda4j.function.conversion.BooleanToLongFunction;
import org.lambda4j.function.conversion.ByteToLongFunction;
import org.lambda4j.function.conversion.CharToLongFunction;
import org.lambda4j.function.conversion.FloatToLongFunction;
import org.lambda4j.function.conversion.IntToByteFunction;
import org.lambda4j.function.conversion.IntToCharFunction;
import org.lambda4j.function.conversion.IntToFloatFunction;
import org.lambda4j.function.conversion.IntToShortFunction;
import org.lambda4j.function.conversion.LongToIntFunction2;
import org.lambda4j.function.conversion.ShortToLongFunction;
import org.lambda4j.function.tri.TriFunction;
import org.lambda4j.function.tri.TriLongFunction;
import org.lambda4j.function.tri.to.ToIntTriFunction;
import org.lambda4j.operator.ternary.IntTernaryOperator;
import org.lambda4j.operator.ternary.LongTernaryOperator;
import org.lambda4j.predicate.tri.TriLongPredicate;

/**
 * Represents an operation that accepts three {@code long}-valued input arguments and produces a {@code int}-valued
 * result. This is a primitive specialization of {@link TriFunction}.
 *

 * This is a {@link FunctionalInterface} whose functional method is {@link #applyAsInt(long, long, long)}.
 *
 * @see TriFunction
 */
@SuppressWarnings("unused")
@FunctionalInterface
public interface TriLongToIntFunction extends Lambda {

    /**
     * Constructs a {@link TriLongToIntFunction} based on a lambda expression or a method reference. Thereby the given
     * lambda expression or method reference is returned on an as-is basis to implicitly transform it to the desired
     * type. With this method, it is possible to ensure that correct type is used from lambda expression or method
     * reference.
     *
     * @param expression A lambda expression or (typically) a method reference, e.g. {@code this::method}
     * @return A {@code TriLongToIntFunction} from given lambda expression or method reference.
     * @implNote This implementation allows the given argument to be {@code null}, but only if {@code null} given,
     * {@code null} will be returned.
     * @see Lambda
     * Expression
     * @see Method Reference
     */
    @CheckForNull
    @Nullable
    static TriLongToIntFunction of(@Nullable TriLongToIntFunction expression) {
        return expression;
    }

    /**
     * Calls the given {@link TriLongToIntFunction} with the given arguments and returns its result.
     *
     * @param function The function to be called
     * @param value1 The first argument to the function
     * @param value2 The second argument to the function
     * @param value3 The third argument to the function
     * @return The result from the given {@code TriLongToIntFunction}.
     * @throws NullPointerException If given argument is {@code null}
     */
    static int call(@Nonnull TriLongToIntFunction function, long value1, long value2, long value3) {
        Objects.requireNonNull(function);
        return function.applyAsInt(value1, value2, value3);
    }

    /**
     * Creates a {@link TriLongToIntFunction} which uses the {@code first} parameter of this one as argument for the
     * given {@link LongToIntFunction}.
     *
     * @param function The function which accepts the {@code first} parameter of this one
     * @return Creates a {@code TriLongToIntFunction} which uses the {@code first} parameter of this one as argument for
     * the given {@code LongToIntFunction}.
     * @throws NullPointerException If given argument is {@code null}
     */
    @Nonnull
    static TriLongToIntFunction onlyFirst(@Nonnull LongToIntFunction function) {
        Objects.requireNonNull(function);
        return (value1, value2, value3) -> function.applyAsInt(value1);
    }

    /**
     * Creates a {@link TriLongToIntFunction} which uses the {@code second} parameter of this one as argument for the
     * given {@link LongToIntFunction}.
     *
     * @param function The function which accepts the {@code second} parameter of this one
     * @return Creates a {@code TriLongToIntFunction} which uses the {@code second} parameter of this one as argument
     * for the given {@code LongToIntFunction}.
     * @throws NullPointerException If given argument is {@code null}
     */
    @Nonnull
    static TriLongToIntFunction onlySecond(@Nonnull LongToIntFunction function) {
        Objects.requireNonNull(function);
        return (value1, value2, value3) -> function.applyAsInt(value2);
    }

    /**
     * Creates a {@link TriLongToIntFunction} which uses the {@code third} parameter of this one as argument for the
     * given {@link LongToIntFunction}.
     *
     * @param function The function which accepts the {@code third} parameter of this one
     * @return Creates a {@code TriLongToIntFunction} which uses the {@code third} parameter of this one as argument for
     * the given {@code LongToIntFunction}.
     * @throws NullPointerException If given argument is {@code null}
     */
    @Nonnull
    static TriLongToIntFunction onlyThird(@Nonnull LongToIntFunction function) {
        Objects.requireNonNull(function);
        return (value1, value2, value3) -> function.applyAsInt(value3);
    }

    /**
     * Creates a {@link TriLongToIntFunction} which always returns a given value.
     *
     * @param ret The return value for the constant
     * @return A {@code TriLongToIntFunction} which always returns a given value.
     */
    @Nonnull
    static TriLongToIntFunction constant(int ret) {
        return (value1, value2, value3) -> ret;
    }

    /**
     * Applies this function to the given arguments.
     *
     * @param value1 The first argument to the function
     * @param value2 The second argument to the function
     * @param value3 The third argument to the function
     * @return The return value from the function, which is its result.
     */
    int applyAsInt(long value1, long value2, long value3);

    /**
     * Applies this function partially to some arguments of this one, producing a {@link BiLongToIntFunction} as
     * result.
     *
     * @param value1 The first argument to this function used to partially apply this function
     * @return A {@code BiLongToIntFunction} that represents this function partially applied the some arguments.
     */
    @Nonnull
    default BiLongToIntFunction applyAsIntPartially(long value1) {
        return (value2, value3) -> applyAsInt(value1, value2, value3);
    }

    /**
     * Applies this function partially to some arguments of this one, producing a {@link LongToIntFunction2} as result.
     *
     * @param value1 The first argument to this function used to partially apply this function
     * @param value2 The second argument to this function used to partially apply this function
     * @return A {@code LongToIntFunction2} that represents this function partially applied the some arguments.
     */
    @Nonnull
    default LongToIntFunction2 applyAsIntPartially(long value1, long value2) {
        return value3 -> applyAsInt(value1, value2, value3);
    }

    /**
     * Returns the number of arguments for this function.
     *
     * @return The number of arguments for this function.
     * @implSpec The default implementation always returns {@code 3}.
     */
    @Nonnegative
    default int arity() {
        return 3;
    }

    /**
     * Returns a composed {@link ToIntTriFunction} that first applies the {@code before} functions to its input, and
     * then applies this function to the result. If evaluation of either operation throws an exception, it is relayed to
     * the caller of the composed operation.
     *
     * @param  The type of the argument to the first given function, and of composed function
     * @param  The type of the argument to the second given function, and of composed function
     * @param <C> The type of the argument to the third given function, and of composed function
     * @param before1 The first function to apply before this function is applied
     * @param before2 The second function to apply before this function is applied
     * @param before3 The third function to apply before this function is applied
     * @return A composed {@code ToIntTriFunction} that first applies the {@code before} functions to its input, and
     * then applies this function to the result.
     * @throws NullPointerException If given argument is {@code null}
     * @implSpec The input argument of this method is able to handle every type.
     */
    @Nonnull
    default  ToIntTriFunction compose(@Nonnull ToLongFunction<? super A> before1,
            @Nonnull ToLongFunction<? super B> before2, @Nonnull ToLongFunction<? super C> before3) {
        Objects.requireNonNull(before1);
        Objects.requireNonNull(before2);
        Objects.requireNonNull(before3);
        return (a, b, c) -> applyAsInt(before1.applyAsLong(a), before2.applyAsLong(b), before3.applyAsLong(c));
    }

    /**
     * Returns a composed {@link TriBooleanToIntFunction} that first applies the {@code before} functions to its input,
     * and then applies this function to the result. If evaluation of either operation throws an exception, it is
     * relayed to the caller of the composed operation. This method is just convenience, to provide the ability to
     * execute an operation which accepts {@code boolean} input, before this primitive function is executed.
     *
     * @param before1 The first function to apply before this function is applied
     * @param before2 The second function to apply before this function is applied
     * @param before3 The third function to apply before this function is applied
     * @return A composed {@code TriBooleanToIntFunction} that first applies the {@code before} functions to its input,
     * and then applies this function to the result.
     * @throws NullPointerException If given argument is {@code null}
     * @implSpec The input argument of this method is able to handle primitive values. In this case this is {@code
     * boolean}.
     */
    @Nonnull
    default TriBooleanToIntFunction composeFromBoolean(@Nonnull BooleanToLongFunction before1,
            @Nonnull BooleanToLongFunction before2, @Nonnull BooleanToLongFunction before3) {
        Objects.requireNonNull(before1);
        Objects.requireNonNull(before2);
        Objects.requireNonNull(before3);
        return (value1, value2, value3) -> applyAsInt(before1.applyAsLong(value1), before2.applyAsLong(value2),
                before3.applyAsLong(value3));
    }

    /**
     * Returns a composed {@link TriByteToIntFunction} that first applies the {@code before} functions to its input, and
     * then applies this function to the result. If evaluation of either operation throws an exception, it is relayed to
     * the caller of the composed operation. This method is just convenience, to provide the ability to execute an
     * operation which accepts {@code byte} input, before this primitive function is executed.
     *
     * @param before1 The first function to apply before this function is applied
     * @param before2 The second function to apply before this function is applied
     * @param before3 The third function to apply before this function is applied
     * @return A composed {@code TriByteToIntFunction} that first applies the {@code before} functions to its input, and
     * then applies this function to the result.
     * @throws NullPointerException If given argument is {@code null}
     * @implSpec The input argument of this method is able to handle primitive values. In this case this is {@code
     * byte}.
     */
    @Nonnull
    default TriByteToIntFunction composeFromByte(@Nonnull ByteToLongFunction before1,
            @Nonnull ByteToLongFunction before2, @Nonnull ByteToLongFunction before3) {
        Objects.requireNonNull(before1);
        Objects.requireNonNull(before2);
        Objects.requireNonNull(before3);
        return (value1, value2, value3) -> applyAsInt(before1.applyAsLong(value1), before2.applyAsLong(value2),
                before3.applyAsLong(value3));
    }

    /**
     * Returns a composed {@link TriCharToIntFunction} that first applies the {@code before} functions to its input, and
     * then applies this function to the result. If evaluation of either operation throws an exception, it is relayed to
     * the caller of the composed operation. This method is just convenience, to provide the ability to execute an
     * operation which accepts {@code char} input, before this primitive function is executed.
     *
     * @param before1 The first function to apply before this function is applied
     * @param before2 The second function to apply before this function is applied
     * @param before3 The third function to apply before this function is applied
     * @return A composed {@code TriCharToIntFunction} that first applies the {@code before} functions to its input, and
     * then applies this function to the result.
     * @throws NullPointerException If given argument is {@code null}
     * @implSpec The input argument of this method is able to handle primitive values. In this case this is {@code
     * char}.
     */
    @Nonnull
    default TriCharToIntFunction composeFromChar(@Nonnull CharToLongFunction before1,
            @Nonnull CharToLongFunction before2, @Nonnull CharToLongFunction before3) {
        Objects.requireNonNull(before1);
        Objects.requireNonNull(before2);
        Objects.requireNonNull(before3);
        return (value1, value2, value3) -> applyAsInt(before1.applyAsLong(value1), before2.applyAsLong(value2),
                before3.applyAsLong(value3));
    }

    /**
     * Returns a composed {@link TriDoubleToIntFunction} that first applies the {@code before} functions to its input,
     * and then applies this function to the result. If evaluation of either operation throws an exception, it is
     * relayed to the caller of the composed operation. This method is just convenience, to provide the ability to
     * execute an operation which accepts {@code double} input, before this primitive function is executed.
     *
     * @param before1 The first function to apply before this function is applied
     * @param before2 The second function to apply before this function is applied
     * @param before3 The third function to apply before this function is applied
     * @return A composed {@code TriDoubleToIntFunction} that first applies the {@code before} functions to its input,
     * and then applies this function to the result.
     * @throws NullPointerException If given argument is {@code null}
     * @implSpec The input argument of this method is able to handle primitive values. In this case this is {@code
     * double}.
     */
    @Nonnull
    default TriDoubleToIntFunction composeFromDouble(@Nonnull DoubleToLongFunction before1,
            @Nonnull DoubleToLongFunction before2, @Nonnull DoubleToLongFunction before3) {
        Objects.requireNonNull(before1);
        Objects.requireNonNull(before2);
        Objects.requireNonNull(before3);
        return (value1, value2, value3) -> applyAsInt(before1.applyAsLong(value1), before2.applyAsLong(value2),
                before3.applyAsLong(value3));
    }

    /**
     * Returns a composed {@link TriFloatToIntFunction} that first applies the {@code before} functions to its input,
     * and then applies this function to the result. If evaluation of either operation throws an exception, it is
     * relayed to the caller of the composed operation. This method is just convenience, to provide the ability to
     * execute an operation which accepts {@code float} input, before this primitive function is executed.
     *
     * @param before1 The first function to apply before this function is applied
     * @param before2 The second function to apply before this function is applied
     * @param before3 The third function to apply before this function is applied
     * @return A composed {@code TriFloatToIntFunction} that first applies the {@code before} functions to its input,
     * and then applies this function to the result.
     * @throws NullPointerException If given argument is {@code null}
     * @implSpec The input argument of this method is able to handle primitive values. In this case this is {@code
     * float}.
     */
    @Nonnull
    default TriFloatToIntFunction composeFromFloat(@Nonnull FloatToLongFunction before1,
            @Nonnull FloatToLongFunction before2, @Nonnull FloatToLongFunction before3) {
        Objects.requireNonNull(before1);
        Objects.requireNonNull(before2);
        Objects.requireNonNull(before3);
        return (value1, value2, value3) -> applyAsInt(before1.applyAsLong(value1), before2.applyAsLong(value2),
                before3.applyAsLong(value3));
    }

    /**
     * Returns a composed {@link IntTernaryOperator} that first applies the {@code before} functions to its input, and
     * then applies this function to the result. If evaluation of either operation throws an exception, it is relayed to
     * the caller of the composed operation. This method is just convenience, to provide the ability to execute an
     * operation which accepts {@code int} input, before this primitive function is executed.
     *
     * @param before1 The first function to apply before this function is applied
     * @param before2 The second function to apply before this function is applied
     * @param before3 The third function to apply before this function is applied
     * @return A composed {@code IntTernaryOperator} that first applies the {@code before} functions to its input, and
     * then applies this function to the result.
     * @throws NullPointerException If given argument is {@code null}
     * @implSpec The input argument of this method is able to handle primitive values. In this case this is {@code
     * int}.
     */
    @Nonnull
    default IntTernaryOperator composeFromInt(@Nonnull IntToLongFunction before1,
            @Nonnull IntToLongFunction before2, @Nonnull IntToLongFunction before3) {
        Objects.requireNonNull(before1);
        Objects.requireNonNull(before2);
        Objects.requireNonNull(before3);
        return (value1, value2, value3) -> applyAsInt(before1.applyAsLong(value1), before2.applyAsLong(value2),
                before3.applyAsLong(value3));
    }

    /**
     * Returns a composed {@link TriLongToIntFunction} that first applies the {@code before} operators to its input, and
     * then applies this function to the result. If evaluation of either operation throws an exception, it is relayed to
     * the caller of the composed operation. This method is just convenience, to provide the ability to execute an
     * operation which accepts {@code long} input, before this primitive function is executed.
     *
     * @param before1 The first operator to apply before this function is applied
     * @param before2 The second operator to apply before this function is applied
     * @param before3 The third operator to apply before this function is applied
     * @return A composed {@code TriLongToIntFunction} that first applies the {@code before} operators to its input, and
     * then applies this function to the result.
     * @throws NullPointerException If given argument is {@code null}
     * @implSpec The input argument of this method is able to handle primitive values. In this case this is {@code
     * long}.
     */
    @Nonnull
    default TriLongToIntFunction composeFromLong(@Nonnull LongUnaryOperator before1,
            @Nonnull LongUnaryOperator before2, @Nonnull LongUnaryOperator before3) {
        Objects.requireNonNull(before1);
        Objects.requireNonNull(before2);
        Objects.requireNonNull(before3);
        return (value1, value2, value3) -> applyAsInt(before1.applyAsLong(value1), before2.applyAsLong(value2),
                before3.applyAsLong(value3));
    }

    /**
     * Returns a composed {@link TriShortToIntFunction} that first applies the {@code before} functions to its input,
     * and then applies this function to the result. If evaluation of either operation throws an exception, it is
     * relayed to the caller of the composed operation. This method is just convenience, to provide the ability to
     * execute an operation which accepts {@code short} input, before this primitive function is executed.
     *
     * @param before1 The first function to apply before this function is applied
     * @param before2 The second function to apply before this function is applied
     * @param before3 The third function to apply before this function is applied
     * @return A composed {@code TriShortToIntFunction} that first applies the {@code before} functions to its input,
     * and then applies this function to the result.
     * @throws NullPointerException If given argument is {@code null}
     * @implSpec The input argument of this method is able to handle primitive values. In this case this is {@code
     * short}.
     */
    @Nonnull
    default TriShortToIntFunction composeFromShort(@Nonnull ShortToLongFunction before1,
            @Nonnull ShortToLongFunction before2, @Nonnull ShortToLongFunction before3) {
        Objects.requireNonNull(before1);
        Objects.requireNonNull(before2);
        Objects.requireNonNull(before3);
        return (value1, value2, value3) -> applyAsInt(before1.applyAsLong(value1), before2.applyAsLong(value2),
                before3.applyAsLong(value3));
    }

    /**
     * Returns a composed {@link TriLongFunction} that first applies this function to its input, and then applies the
     * {@code after} function to the result. If evaluation of either operation throws an exception, it is relayed to the
     * caller of the composed operation.
     *
     * @param <S> The type of return value from the {@code after} function, and of the composed function
     * @param after The function to apply after this function is applied
     * @return A composed {@code TriLongFunction} that first applies this function to its input, and then applies the
     * {@code after} function to the result.
     * @throws NullPointerException If given argument is {@code null}
     * @implSpec The input argument of this method is able to return every type.
     */
    @Nonnull
    default <S> TriLongFunction<S> andThen(@Nonnull IntFunction<? extends S> after) {
        Objects.requireNonNull(after);
        return (value1, value2, value3) -> after.apply(applyAsInt(value1, value2, value3));
    }

    /**
     * Returns a composed {@link TriLongPredicate} that first applies this function to its input, and then applies the
     * {@code after} predicate to the result. If evaluation of either operation throws an exception, it is relayed to
     * the caller of the composed operation. This method is just convenience, to provide the ability to transform this
     * primitive function to an operation returning {@code boolean}.
     *
     * @param after The predicate to apply after this function is applied
     * @return A composed {@code TriLongPredicate} that first applies this function to its input, and then applies the
     * {@code after} predicate to the result.
     * @throws NullPointerException If given argument is {@code null}
     * @implSpec The input argument of this method is able to return primitive values. In this case this is {@code
     * boolean}.
     */
    @Nonnull
    default TriLongPredicate andThenToBoolean(@Nonnull IntPredicate after) {
        Objects.requireNonNull(after);
        return (value1, value2, value3) -> after.test(applyAsInt(value1, value2, value3));
    }

    /**
     * Returns a composed {@link TriLongToByteFunction} that first applies this function to its input, and then applies
     * the {@code after} function to the result. If evaluation of either operation throws an exception, it is relayed to
     * the caller of the composed operation. This method is just convenience, to provide the ability to transform this
     * primitive function to an operation returning {@code byte}.
     *
     * @param after The function to apply after this function is applied
     * @return A composed {@code TriLongToByteFunction} that first applies this function to its input, and then applies
     * the {@code after} function to the result.
     * @throws NullPointerException If given argument is {@code null}
     * @implSpec The input argument of this method is able to return primitive values. In this case this is {@code
     * byte}.
     */
    @Nonnull
    default TriLongToByteFunction andThenToByte(@Nonnull IntToByteFunction after) {
        Objects.requireNonNull(after);
        return (value1, value2, value3) -> after.applyAsByte(applyAsInt(value1, value2, value3));
    }

    /**
     * Returns a composed {@link TriLongToCharFunction} that first applies this function to its input, and then applies
     * the {@code after} function to the result. If evaluation of either operation throws an exception, it is relayed to
     * the caller of the composed operation. This method is just convenience, to provide the ability to transform this
     * primitive function to an operation returning {@code char}.
     *
     * @param after The function to apply after this function is applied
     * @return A composed {@code TriLongToCharFunction} that first applies this function to its input, and then applies
     * the {@code after} function to the result.
     * @throws NullPointerException If given argument is {@code null}
     * @implSpec The input argument of this method is able to return primitive values. In this case this is {@code
     * char}.
     */
    @Nonnull
    default TriLongToCharFunction andThenToChar(@Nonnull IntToCharFunction after) {
        Objects.requireNonNull(after);
        return (value1, value2, value3) -> after.applyAsChar(applyAsInt(value1, value2, value3));
    }

    /**
     * Returns a composed {@link TriLongToDoubleFunction} that first applies this function to its input, and then
     * applies the {@code after} function to the result. If evaluation of either operation throws an exception, it is
     * relayed to the caller of the composed operation. This method is just convenience, to provide the ability to
     * transform this primitive function to an operation returning {@code double}.
     *
     * @param after The function to apply after this function is applied
     * @return A composed {@code TriLongToDoubleFunction} that first applies this function to its input, and then
     * applies the {@code after} function to the result.
     * @throws NullPointerException If given argument is {@code null}
     * @implSpec The input argument of this method is able to return primitive values. In this case this is {@code
     * double}.
     */
    @Nonnull
    default TriLongToDoubleFunction andThenToDouble(@Nonnull IntToDoubleFunction after) {
        Objects.requireNonNull(after);
        return (value1, value2, value3) -> after.applyAsDouble(applyAsInt(value1, value2, value3));
    }

    /**
     * Returns a composed {@link TriLongToFloatFunction} that first applies this function to its input, and then applies
     * the {@code after} function to the result. If evaluation of either operation throws an exception, it is relayed to
     * the caller of the composed operation. This method is just convenience, to provide the ability to transform this
     * primitive function to an operation returning {@code float}.
     *
     * @param after The function to apply after this function is applied
     * @return A composed {@code TriLongToFloatFunction} that first applies this function to its input, and then applies
     * the {@code after} function to the result.
     * @throws NullPointerException If given argument is {@code null}
     * @implSpec The input argument of this method is able to return primitive values. In this case this is {@code
     * float}.
     */
    @Nonnull
    default TriLongToFloatFunction andThenToFloat(@Nonnull IntToFloatFunction after) {
        Objects.requireNonNull(after);
        return (value1, value2, value3) -> after.applyAsFloat(applyAsInt(value1, value2, value3));
    }

    /**
     * Returns a composed {@link TriLongToIntFunction} that first applies this function to its input, and then applies
     * the {@code after} operator to the result. If evaluation of either operation throws an exception, it is relayed to
     * the caller of the composed operation. This method is just convenience, to provide the ability to transform this
     * primitive function to an operation returning {@code int}.
     *
     * @param after The operator to apply after this function is applied
     * @return A composed {@code TriLongToIntFunction} that first applies this function to its input, and then applies
     * the {@code after} operator to the result.
     * @throws NullPointerException If given argument is {@code null}
     * @implSpec The input argument of this method is able to return primitive values. In this case this is {@code
     * int}.
     */
    @Nonnull
    default TriLongToIntFunction andThenToInt(@Nonnull IntUnaryOperator after) {
        Objects.requireNonNull(after);
        return (value1, value2, value3) -> after.applyAsInt(applyAsInt(value1, value2, value3));
    }

    /**
     * Returns a composed {@link LongTernaryOperator} that first applies this function to its input, and then applies
     * the {@code after} function to the result. If evaluation of either operation throws an exception, it is relayed to
     * the caller of the composed operation. This method is just convenience, to provide the ability to transform this
     * primitive function to an operation returning {@code long}.
     *
     * @param after The function to apply after this function is applied
     * @return A composed {@code LongTernaryOperator} that first applies this function to its input, and then applies
     * the {@code after} function to the result.
     * @throws NullPointerException If given argument is {@code null}
     * @implSpec The input argument of this method is able to return primitive values. In this case this is {@code
     * long}.
     */
    @Nonnull
    default LongTernaryOperator andThenToLong(@Nonnull IntToLongFunction after) {
        Objects.requireNonNull(after);
        return (value1, value2, value3) -> after.applyAsLong(applyAsInt(value1, value2, value3));
    }

    /**
     * Returns a composed {@link TriLongToShortFunction} that first applies this function to its input, and then applies
     * the {@code after} function to the result. If evaluation of either operation throws an exception, it is relayed to
     * the caller of the composed operation. This method is just convenience, to provide the ability to transform this
     * primitive function to an operation returning {@code short}.
     *
     * @param after The function to apply after this function is applied
     * @return A composed {@code TriLongToShortFunction} that first applies this function to its input, and then applies
     * the {@code after} function to the result.
     * @throws NullPointerException If given argument is {@code null}
     * @implSpec The input argument of this method is able to return primitive values. In this case this is {@code
     * short}.
     */
    @Nonnull
    default TriLongToShortFunction andThenToShort(@Nonnull IntToShortFunction after) {
        Objects.requireNonNull(after);
        return (value1, value2, value3) -> after.applyAsShort(applyAsInt(value1, value2, value3));
    }

    /**
     * Returns a composed {@link TriLongConsumer} that fist applies this function to its input, and then consumes the
     * result using the given {@link IntConsumer}. If evaluation of either operation throws an exception, it is relayed
     * to the caller of the composed operation.
     *
     * @param consumer The operation which consumes the result from this operation
     * @return A composed {@code TriLongConsumer} that first applies this function to its input, and then consumes the
     * result using the given {@code IntConsumer}.
     * @throws NullPointerException If given argument is {@code null}
     */
    @Nonnull
    default TriLongConsumer consume(@Nonnull IntConsumer consumer) {
        Objects.requireNonNull(consumer);
        return (value1, value2, value3) -> consumer.accept(applyAsInt(value1, value2, value3));
    }

    /**
     * Returns a reversed version of this function. This may be useful in recursive context.
     *
     * @return A reversed version of this function.
     */
    @Nonnull
    default TriLongToIntFunction reversed() {
        return (value3, value2, value1) -> applyAsInt(value1, value2, value3);
    }

    /**
     * Returns a memoized (caching) version of this {@link TriLongToIntFunction}. Whenever it is called, the mapping
     * between the input parameters and the return value is preserved in a cache, making subsequent calls returning the
     * memoized value instead of computing the return value again.
     *

     * Unless the function and therefore the used cache will be garbage-collected, it will keep all memoized values
     * forever.
     *
     * @return A memoized (caching) version of this {@code TriLongToIntFunction}.
     * @implSpec This implementation does not allow the input parameters or return value to be {@code null} for the
     * resulting memoized function, as the cache used internally does not permit {@code null} keys or values.
     * @implNote The returned memoized function can be safely used concurrently from multiple threads which makes it
     * thread-safe.
     */
    @Nonnull
    default TriLongToIntFunction memoized() {
        if (isMemoized()) {
            return this;
        } else {
            Map<Triple<Long, Long, Long>, Integer> cache = new ConcurrentHashMap<>();
            return (TriLongToIntFunction & Memoized) (value1, value2, value3) -> {
                return cache.computeIfAbsent(Triple.of(value1, value2, value3),
                        key -> applyAsInt(key.getLeft(), key.getMiddle(), key.getRight()));
            };
        }
    }

    /**
     * Returns a composed {@link TriFunction} which represents this {@link TriLongToIntFunction}. Thereby the primitive
     * input argument for this function is autoboxed. This method provides the possibility to use this {@code
     * TriLongToIntFunction} with methods provided by the {@code JDK}.
     *
     * @return A composed {@code TriFunction} which represents this {@code TriLongToIntFunction}.
     */
    @Nonnull
    default TriFunction<Long, Long, Long, Integer> boxed() {
        return this::applyAsInt;
    }
}


text:
package com.google.errorprone.matchers;

import static com.google.common.truth.Truth.assertThat;
import static com.google.errorprone.matchers.Matchers.methodReturns;

import com.google.errorprone.VisitorState;
import com.google.errorprone.scanner.Scanner;
import com.google.errorprone.suppliers.Suppliers;
import com.sun.source.tree.MethodTree;
import java.util.ArrayList;
import java.util.List;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/** @author cpovirk@google.com (Chris Povirk) */
@RunWith(JUnit4.class)
public class MethodReturnsTest extends CompilerBasedAbstractTest {
  final List<ScannerTest> tests = new ArrayList<>();

  @After
  public void tearDown() {
    for (ScannerTest test : tests) {
      test.assertDone();
    }
  }

  @Test
  public void returnsString() {
    writeFile("A.java", "public class A {", "  static String foo() { return null; }", "}");
    assertCompiles(fooReturnsType(/* shouldMatch= */ true, "java.lang.String"));
  }

  @Test
  public void notReturnsString() {
    writeFile("A.java", "public class A {", "  static int foo() { return 0; }", "}");
    assertCompiles(fooReturnsType(/* shouldMatch= */ false, "java.lang.String"));
  }

  @Test
  public void returnsInt() {
    writeFile("A.java", "public class A {", "  static int foo() { return 0; }", "}");
    assertCompiles(fooReturnsType(/* shouldMatch= */ true, "int"));
  }

  private abstract static class ScannerTest extends Scanner {
    abstract void assertDone();
  }

  private Scanner fooReturnsType(final boolean shouldMatch, final String typeString) {
    ScannerTest test =
        new ScannerTest() {
          private boolean matched = false;

          @Override
          public Void visitMethod(MethodTree node, VisitorState visitorState) {
            if (methodReturns(Suppliers.typeFromString(typeString)).matches(node, visitorState)) {
              matched = true;
            }
            return super.visitMethod(node, visitorState);
          }

          @Override
          void assertDone() {
            assertThat(shouldMatch).isEqualTo(matched);
          }
        };
    tests.add(test);
    return test;
  }
}


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.trino.sql.planner.iterative.rule;

import com.google.common.collect.ImmutableSet;
import io.trino.matching.Captures;
import io.trino.matching.Pattern;
import io.trino.sql.planner.Symbol;
import io.trino.sql.planner.iterative.Rule;
import io.trino.sql.planner.plan.FilterNode;
import io.trino.sql.planner.plan.JoinNode;
import io.trino.sql.planner.plan.PlanNode;

import java.util.List;

import static io.trino.sql.planner.iterative.rule.Util.restrictOutputs;
import static io.trino.sql.planner.optimizations.QueryCardinalityUtil.isAtLeastScalar;
import static io.trino.sql.planner.optimizations.QueryCardinalityUtil.isAtMost;
import static io.trino.sql.planner.optimizations.QueryCardinalityUtil.isScalar;
import static io.trino.sql.planner.plan.Patterns.join;

/**
 * This rule transforms plans with joins, where:
 * - one of the sources is scalar and produces no output symbols.
 * In case of LEFT or RIGHT join, it has to be the inner source.
 * In case of FULL or INNER join, it can be either source.
 * - the other join source is at least scalar (not known to be empty).
 *

 * The join is replaced with the other source and an optional
 * pruning projection.
 *

 * Note: This rule does not transform plans where either join source
 * is empty. Such plans are transformed by RemoveRedundantJoin
 * and ReplaceRedundantJoinWithProject rules.
 */
public class ReplaceRedundantJoinWithSource
        implements Rule<JoinNode>
{
    private static final Pattern<JoinNode> PATTERN = join();

    @Override
    public Pattern<JoinNode> getPattern()
    {
        return PATTERN;
    }

    @Override
    public Result apply(JoinNode node, Captures captures, Context context)
    {
        if (isAtMost(node.getLeft(), context.getLookup(), 0) || isAtMost(node.getRight(), context.getLookup(), 0)) {
            return Result.empty();
        }

        boolean leftSourceScalarWithNoOutputs = node.getLeft().getOutputSymbols().isEmpty() && isScalar(node.getLeft(), context.getLookup());
        boolean rightSourceScalarWithNoOutputs = node.getRight().getOutputSymbols().isEmpty() && isScalar(node.getRight(), context.getLookup());

        return switch (node.getType()) {
            case INNER -> {
                PlanNode source;
                List<Symbol> sourceOutputs;
                if (leftSourceScalarWithNoOutputs) {
                    source = node.getRight();
                    sourceOutputs = node.getRightOutputSymbols();
                }
                else if (rightSourceScalarWithNoOutputs) {
                    source = node.getLeft();
                    sourceOutputs = node.getLeftOutputSymbols();
                }
                else {
                    yield Result.empty();
                }
                if (node.getFilter().isPresent()) {
                    source = new FilterNode(context.getIdAllocator().getNextId(), source, node.getFilter().get());
                }
                yield Result.ofPlanNode(restrictOutputs(context.getIdAllocator(), source, ImmutableSet.copyOf(sourceOutputs)).orElse(source));
            }
            case LEFT -> rightSourceScalarWithNoOutputs ?
                    Result.ofPlanNode(restrictOutputs(context.getIdAllocator(), node.getLeft(), ImmutableSet.copyOf(node.getLeftOutputSymbols()))
                            .orElse(node.getLeft())) :
                    Result.empty();
            case RIGHT -> leftSourceScalarWithNoOutputs ?
                    Result.ofPlanNode(restrictOutputs(context.getIdAllocator(), node.getRight(), ImmutableSet.copyOf(node.getRightOutputSymbols()))
                            .orElse(node.getRight())) :
                    Result.empty();
            case FULL -> {
                if (leftSourceScalarWithNoOutputs && isAtLeastScalar(node.getRight(), context.getLookup())) {
                    yield Result.ofPlanNode(restrictOutputs(context.getIdAllocator(), node.getRight(), ImmutableSet.copyOf(node.getRightOutputSymbols()))
                            .orElse(node.getRight()));
                }
                if (rightSourceScalarWithNoOutputs && isAtLeastScalar(node.getLeft(), context.getLookup())) {
                    yield Result.ofPlanNode(restrictOutputs(context.getIdAllocator(), node.getLeft(), ImmutableSet.copyOf(node.getLeftOutputSymbols()))
                            .orElse(node.getLeft()));
                }
                yield Result.empty();
            }
        };
    }
}


text:
<?php
namespace Bot;

use Bot\Core\CoreInterface;
use Bot\Filebase\Wrapper;
use DI\Annotation\Inject;
use DI\Container;
use React\EventLoop\LoopInterface;
use Sabre\Event\EventEmitter;

class App
{
    /**
     * @param Wrapper $db
     */
    private $db;

    /**
     * @Inject
     * @var Container
     */
    private $container;

    /**
     * @Inject("config")
     * @var \ArrayAccess
     */
    private $config;

    /**
     * @Inject("Core")
     * @var CoreInterface
     */
    private $core;

    public function run()
    {
        $this->db = $this->container->get('db');
        $this->db['last_run'] = date('Y-m-d H:i:s');

        \Util::debug('Connecting to Skype');
        $this->core->initSkypeConnection();

        \Util::debug('Initializing plugins');
        $this->container->get('Bot\Plugins\Infrastructure\Broker')->initPlugins();

        /** @var LoopInterface $loop */
        $loop = $this->container->get('loop');

        /** @var EventEmitter $ev */
        $ev = $this->container->get('event');

        if (isset($this->db['restart']) && $this->db['restart']) {
            list($chatName, $restartTime) = $this->db['restart'];
            $this->core->send($chatName, 'Я сделяль!');
            unset($this->db['restart']);
        }

        $loop->addPeriodicTimer(
            0.0001,
            function () use ($ev, $loop) {
                $this->core->poll();
//                $this->webCore->poll();
                $ev->emit('tick', [microtime(true)]);
            }
        );

        \Util::debug('Running main loop');
        $loop->run();
    }
}


text:
<!DOCTYPE html>

<title>lupapiste demo</title>

<link rel="stylesheet" type="text/css" href="../css/icons.css" />

<input type="button" id="300" value="300 x 300"/>
<input type="button" id="500" value="500 x 500"/>
<input type="button" id="700" value="700 x 700"/>
<input type="button" id="900" value="900 x 900"/>


text:
/// <reference path="../typings/angularjs/angular.d.ts" />
/// <reference path="../typings/oclazyload/oclazyload.d.ts" />
/// <reference path="../typings/angular-ui-router/angular-ui-router.d.ts" />

/**
 * This file should contain commonly used interfaces and classes.
 */

module Common {
	/**
	 * Each module may implement that interface and its factory method createModule()
	 * is supposed to return the module.
	 */
	export interface IModuleFactory {
		createModule(): angular.IModule;
	};

	/**
	 * Class used to encapsulate constants as they're not automagically
	 * populated using TypeScript.
	 */
	export class Constants {

		private values: { [key:string]: any };

		public constructor() {
			this.values = {};
		};

		public add<T>(key: string, value: T): Constants {
			this.values[key] = value;
			return this;
		};

		public get<T>(key: string, defaultIfMissing?:T):T {
			return this.values[key] || defaultIfMissing;
		};
	};

	/**
	 * Temporary interface to describe the ui-router's $templateFactory. This is
	 * necessary because this definition is missing from the d.ts.
	 */
	export interface $TemplateFactory {
		fromUrl(url: string): angular.IPromise<string>;
	};

	/**
	 * Dedicated interface that represents the structure of our global content.json.
	 * It contains meta-articles and meta-fragments and allows us to make extensions
	 * later if required:
	 */
	export interface ContentJSON {
		mydeps: { path: (string|oc.ITypedModuleConfig) }[];
		metaArticles: MetaArticle[];
		metaFragments: MetaFragment[];
	};

	export interface Meta extends Common.IKVStore<any> {
		author?: string;
		copyright?: string;
		description?: string;
		keywords?: string;
		score?: number;
	};

	export interface MetaArticle extends Meta {
		path: string;
		lastMod: string;
		urlName: string;
		title: string;
	};

  /**
   * This class represents one Article which can be displayed by STAB.
   */
	export class Article {
		constructor(private _metaArticle: MetaArticle, private _original: string, private $sce: angular.ISCEService) {
		};

		public get meta(): MetaArticle {
			return angular.extend({}, this._metaArticle);
		};

		public get original(): string {
			return this._original.substr(0);
		};

		public get asJQuery(): angular.IAugmentedJQuery {
			return angular.element(this._original);
		};

		public get asTrustedHtml(): any {
			var article = Array.prototype.slice.call(this.asJQuery, 0).filter(element => {
				return element instanceof HTMLElement &&
					(<HTMLElement>element).nodeName.toUpperCase() === 'ARTICLE';
			})[0];

			return this.$sce.trustAsHtml(angular.element(article).html());
		};

    /**
     * This function accepts a content transformer which can apply changes
     * to the original content of this article.
     */
    public transformContent(transformer: ContentTransformer): Common.Article {
      this._original = transformer.transform(this._original);
      return this;
    };
	};

  /**
   * This interface must be implemented by all content transformers. Instance
   * of it will be automatically picked up by the ContentService and applied
   * to any Article. The order of processing is however not guaranteed. Note
   * that if you want to provide your own, user-defined transformers, they must
   * be declared within the module/namespace 'Blog.Article'.
   */
  export interface ContentTransformer {
    transform(original: string): string;
  };

	export class Page<T> {

		next: Page<T>;
		prev: Page<T>;

		constructor(public items: T[], public index: number) {
			this.next = null;
			this.prev = null;
		};

		public hasPrev(): boolean {
			return this.prev !== null;
		};

		public hasNext(): boolean {
			return this.next !== null;
		};

		/**
		 * Takes a number of items and partitions them into pages by the
		 * given chunk-size. All pages are linked together and the first
		 * page is returned.
		 */
		public static partitionAndGetFirstPage<T1>(allItems: T1[], partSize: number = 5): Page<T1> {
			if (allItems.length === 0) {
				return new Page<T1>([], 0);
			}

			var numChunks = Math.ceil(allItems.length / partSize);
			var pages: Page<T1>[] = [];

			for (let i = 0; i < numChunks; i++) {
				pages.push(new Page<T1>(allItems.splice(0, partSize), i));
			}
			for (let i = 0; i < numChunks; i++) {
				if (i > 0) {
					pages[i].prev = pages[i - 1];
				}
				if (i < (numChunks - 1)) {
					pages[i].next = pages[i + 1];
				}
			}

			return pages[0];
		};
	};

	/**
	 * We might want to have different list-sites and each of them requires
	 * different logic or filters.
	 */
	export abstract class AListStrategy {
		protected injected: IKVStore<any> = {};

		public constructor(public type: string, public reverse: boolean) { };

		/**
		 * This method supposedly returns an ordered array of meta-articles
		 * based on the implemented strategy and given parameters.
		 */
		public abstract itemsList(source: MetaArticle[]): MetaArticle[];

		/**
		 * This function may be used by a controller to inject parameters such
		 * as search parameters.
		 */
		public inject(key: string, value: any): AListStrategy {
			this.injected[key] = value;
			return this;
		};

		/**
		 * Static method that returns false by default. When a specific
		 * list-type is requested, the designated controller will probe
		 * all registered ListStrategies with this method. Each strategy
		 * should override this static method.
		 */
		static canHandle(listType: string): boolean {
			return false;
		};
	};

	export class I2Tuple<T1, T2> {
		constructor(private _t1: T1, private _t2: T2) {
		};

		public get t1() {
			return this._t1;
		};

		public get t2() {
			return this._t2;
		};
	};

	export interface IKVStore<T> {
		[key:string]: T;
	};

	/**
	 * Describes a fragment's meta information.
	 */
	export interface MetaFragment {
		// Must be unique across all fragments
		id: string;
		// The path to load the fragment from. Optional.
		// If the path is not present we expect the fragment
		// to be embedded into the content.json.
		path?: string;
		// If the path coerces to false, content must be
		// present because the fragment ought to be embedded
		// into the content.json. If both coerce to false,
		// content will be set to an empty string.
		content?: any;
		// A hint on how to interpret the fragment. This
		// should be a valid mime-string. Out of the box,
		// Html and json work. If not present or unknown,
		// will be interpreted as text/plain which results
		// in no processing.
		mime?: string;
	};

	/**
	 * This class represents a fragment.
	 */
	export class Fragment {
		private trusted: any;

		private static supportedMimeTypesArray: {
			mime: string, regex: RegExp, sce: string, default?: boolean
		}[] = [
			{ mime: 'css', regex: /css/i, sce: 'css' },
			{ mime: 'html', regex: /(?:html?)|(?:xml)/i, sce: 'html' },
			{ mime: 'js', regex: /(?:js)|(?:javascript)/i, sce: 'js' },
			{ mime: 'text', regex: /(?:text)|(?:plain)/i, sce: 'html', default: true }
		];

		constructor(private _meta: MetaFragment, private _original: string, private $sce: angular.ISCEService) {
			// Takes the best match or default if no match for mime:
			var $sceMethod = Fragment.supportedMimeTypesArray.filter(t => t.regex.test(_meta.mime)).concat(Fragment.supportedMimeTypesArray.filter(t => t.hasOwnProperty('default') && t.default === true))[0].sce;

			var asJQuery = Array.prototype.slice.call(angular.element(_original), 0);
			var fragmentElem = asJQuery.filter(element => {
				return element instanceof HTMLElement &&
					(<HTMLElement>element).nodeName.toUpperCase() === 'FRAGMENT';
			})[0];

			this.trusted = $sce.trustAs($sceMethod, angular.element(fragmentElem).html());
		};

		public get meta(): MetaFragment {
			return angular.extend({}, this._meta);
		};

		/**
		 * Getter for the trusted value of the fragment.
		 */
		public get trustedValue(): any {
			return this.trusted;
		};

		public static get supportedMimeTypes(): string[] {
			return Fragment.supportedMimeTypesArray.slice(0).map(t => t.mime);
		};
	};
}


text:
package com.lee.base.activity;

import android.content.Intent;
import android.content.pm.PackageManager;
import android.support.v4.app.FragmentActivity;

import java.util.List;

/**
 * FragmentActivity Base
 * </p>
 * Created by LiYang on 2017/1/3.
 */

public class BaseFragmentActivity extends FragmentActivity{

    // TODO: 2017/1/3 common deal

    public void startActivity(Intent intent) {
        if(this.isIntentAvailable(intent)) {
            super.startActivity(intent);
        }
    }

    public void startActivityForResult(Intent intent, int requestCode) {
        if(this.isIntentAvailable(intent)) {
            super.startActivityForResult(intent, requestCode);
        }
    }

    /**
     * Check the Intent validity
     */
    private boolean isIntentAvailable(Intent intent) {
        if(intent == null) {
            return false;
        } else {
            PackageManager packageManager = this.getPackageManager();
            List list = packageManager.queryIntentActivities(intent, 1);
            return list.size() > 0;
        }
    }

}


text:
<?php

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

class AttributeGroups extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('exalted_attribute_groups', function($table){
			$table->increments('id');
			$table->timestamps();
			$table->string('url');
			$table->string('name');
			$table->string('description');
			$table->unique('url');
			$table->index('name');
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::dropIfExists('exalted_attribute_groups');
	}

}


text:
Let referenced objects in your ActiveModel::Serializer based API only include ID attribute by default, and extend them using URL parameters.

e.g. `https://api/resource?extend=author.name,author.username` to extend your referenced author with its name and username attributes.

## Installation

Add this line to your application's Gemfile:

    gem 'extendible'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install extendible

## Usage

You need to scope your params to the serializer by adding this to your controller:

    serialization_scope :params

and also include extendible in your serializer class:

    include Extendible

Then you can define your extendible references simply by adding this your serializer

    extendible :author

You can also make multiple referenced objects extendible

    extendible :author, :category

*full example of app/serializers/post_serializer.rb*

    class PostSerializer < ActiveModel::Serializer
      include Extendible

      attributes :id,
                 :subject,
                 :body

      extendible :author
    end

This will by default only include the id attribute for your author object

    {
      ...
      "author": {
        "id": 1
      }
    }

You can then extend the object by passing `?extend=author` in the URL, which will include all author attributes

    {
      ...
      "author": {
        "id": 1,
        "name": "Robert Falken",
        "username": "robertfalken"
      }
    }

Or, if you would like to only get the username, use dot notation `?extend=author.username`

    {
      ...
      "author": {
        "id": 1,
        "username": "robertfalken"
      }
    }

You also can extend multiple objects or attributes by comma separating them `?extend=author.username,category`

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request


text:
@extends ('backend.layouts.master')

@section ('title', 'Qualifications Setup')

@section('page-header')

        Qualifications Setup
        Add New

@endsection

@section ('breadcrumbs')

 Admin

{!! link_to_route('admin.setup.qualification.languages.index', 'Qualifications Setup') !!}

@stop

@section('content')

Add New Language

		{!! Form::model(new App\Language, ['route' => ['admin.setup.qualification.languages.store'], 'class' => 'form-horizontal']) !!}
		    @include('backend/setup/qualification/includes/partials/_form', ['submit_text' => 'Save'])
		{!! Form::close() !!}

@stop