text:
.class Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray$MarshalerArray;
.super Landroid/hardware/camera2/marshal/Marshaler;
.source "MarshalQueryableArray.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x2
    name = "MarshalerArray"
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "Landroid/hardware/camera2/marshal/Marshaler",
        "<TT;>;"
    }
.end annotation

# instance fields
.field private final mClass:Ljava/lang/Class;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/lang/Class",
            "<TT;>;"
        }
    .end annotation
.end field

.field private final mComponentClass:Ljava/lang/Class;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/lang/Class",
            "<*>;"
        }
    .end annotation
.end field

.field private final mComponentMarshaler:Landroid/hardware/camera2/marshal/Marshaler;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Landroid/hardware/camera2/marshal/Marshaler",
            "<*>;"
        }
    .end annotation
.end field

.field final synthetic this$0:Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray;

# direct methods
.method protected constructor <init>(Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray;Landroid/hardware/camera2/utils/TypeReference;I)V
    .locals 2
    .param p3, "nativeType"    # I
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Landroid/hardware/camera2/utils/TypeReference",
            "<TT;>;I)V"
        }
    .end annotation

    .prologue
    .line 50
    .local p0, "this":Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray$MarshalerArray;, "Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray<TT;>.MarshalerArray;"
    .local p1, "this$0":Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray;, "Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray<TT;>;"
    .local p2, "typeReference":Landroid/hardware/camera2/utils/TypeReference;, "Landroid/hardware/camera2/utils/TypeReference<TT;>;"
    iput-object p1, p0, Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray$MarshalerArray;->this$0:Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray;

    .line 51
    invoke-direct {p0, p1, p2, p3}, Landroid/hardware/camera2/marshal/Marshaler;-><init>(Landroid/hardware/camera2/marshal/MarshalQueryable;Landroid/hardware/camera2/utils/TypeReference;I)V

    .line 53
    invoke-virtual {p2}, Landroid/hardware/camera2/utils/TypeReference;->getRawType()Ljava/lang/Class;

    move-result-object v1

    iput-object v1, p0, Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray$MarshalerArray;->mClass:Ljava/lang/Class;

    .line 55
    invoke-virtual {p2}, Landroid/hardware/camera2/utils/TypeReference;->getComponentType()Landroid/hardware/camera2/utils/TypeReference;

    move-result-object v0

    .line 56
    .local v0, "componentToken":Landroid/hardware/camera2/utils/TypeReference;, "Landroid/hardware/camera2/utils/TypeReference<*>;"
    iget v1, p0, Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray$MarshalerArray;->mNativeType:I

    invoke-static {v0, v1}, Landroid/hardware/camera2/marshal/MarshalRegistry;->getMarshaler(Landroid/hardware/camera2/utils/TypeReference;I)Landroid/hardware/camera2/marshal/Marshaler;

    move-result-object v1

    iput-object v1, p0, Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray$MarshalerArray;->mComponentMarshaler:Landroid/hardware/camera2/marshal/Marshaler;

    .line 57
    invoke-virtual {v0}, Landroid/hardware/camera2/utils/TypeReference;->getRawType()Ljava/lang/Class;

    move-result-object v1

    iput-object v1, p0, Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray$MarshalerArray;->mComponentClass:Ljava/lang/Class;

    .line 50
    return-void
.end method

.method private calculateElementMarshalSize(Landroid/hardware/camera2/marshal/Marshaler;Ljava/lang/Object;I)I
    .locals 2
    .param p2, "array"    # Ljava/lang/Object;
    .param p3, "index"    # I
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "<TElem:",
            "Ljava/lang/Object;",
            ">(",
            "Landroid/hardware/camera2/marshal/Marshaler",
            "<TTElem;>;",
            "Ljava/lang/Object;",
            "I)I"
        }
    .end annotation

    .prologue
    .line 160
    .local p0, "this":Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray$MarshalerArray;, "Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray<TT;>.MarshalerArray;"
    .local p1, "marshaler":Landroid/hardware/camera2/marshal/Marshaler;, "Landroid/hardware/camera2/marshal/Marshaler<TTElem;>;"
    invoke-static {p2, p3}, Ljava/lang/reflect/Array;->get(Ljava/lang/Object;I)Ljava/lang/Object;

    move-result-object v0

    .line 162
    .local v0, "elem":Ljava/lang/Object;
    invoke-virtual {p1, v0}, Landroid/hardware/camera2/marshal/Marshaler;->calculateMarshalSize(Ljava/lang/Object;)I

    move-result v1

    return v1
.end method

.method private copyListToArray(Ljava/util/ArrayList;Ljava/lang/Object;)Ljava/lang/Object;
    .locals 1
    .param p2, "arrayDest"    # Ljava/lang/Object;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/ArrayList",
            "<*>;",
            "Ljava/lang/Object;",
            ")",
            "Ljava/lang/Object;"
        }
    .end annotation

    .prologue
    .line 154
    .local p0, "this":Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray$MarshalerArray;, "Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray<TT;>.MarshalerArray;"
    .local p1, "arrayList":Ljava/util/ArrayList;, "Ljava/util/ArrayList<*>;"
    check-cast p2, [Ljava/lang/Object;

    .end local p2    # "arrayDest":Ljava/lang/Object;
    invoke-virtual {p1, p2}, Ljava/util/ArrayList;->toArray([Ljava/lang/Object;)[Ljava/lang/Object;

    move-result-object v0

    return-object v0
.end method

.method private marshalArrayElement(Landroid/hardware/camera2/marshal/Marshaler;Ljava/nio/ByteBuffer;Ljava/lang/Object;I)V
    .locals 1
    .param p2, "buffer"    # Ljava/nio/ByteBuffer;
    .param p3, "array"    # Ljava/lang/Object;
    .param p4, "index"    # I
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "<TElem:",
            "Ljava/lang/Object;",
            ">(",
            "Landroid/hardware/camera2/marshal/Marshaler",
            "<TTElem;>;",
            "Ljava/nio/ByteBuffer;",
            "Ljava/lang/Object;",
            "I)V"
        }
    .end annotation

    .prologue
    .line 149
    .local p0, "this":Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray$MarshalerArray;, "Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray<TT;>.MarshalerArray;"
    .local p1, "marshaler":Landroid/hardware/camera2/marshal/Marshaler;, "Landroid/hardware/camera2/marshal/Marshaler<TTElem;>;"
    invoke-static {p3, p4}, Ljava/lang/reflect/Array;->get(Ljava/lang/Object;I)Ljava/lang/Object;

    move-result-object v0

    invoke-virtual {p1, v0, p2}, Landroid/hardware/camera2/marshal/Marshaler;->marshal(Ljava/lang/Object;Ljava/nio/ByteBuffer;)V

    .line 148
    return-void
.end method

# virtual methods
.method public calculateMarshalSize(Ljava/lang/Object;)I
    .locals 5
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(TT;)I"
        }
    .end annotation

    .prologue
    .line 125
    .local p0, "this":Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray$MarshalerArray;, "Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray<TT;>.MarshalerArray;"
    .local p1, "value":Ljava/lang/Object;, "TT;"
    iget-object v4, p0, Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray$MarshalerArray;->mComponentMarshaler:Landroid/hardware/camera2/marshal/Marshaler;

    invoke-virtual {v4}, Landroid/hardware/camera2/marshal/Marshaler;->getNativeSize()I

    move-result v1

    .line 126
    .local v1, "elementSize":I
    invoke-static {p1}, Ljava/lang/reflect/Array;->getLength(Ljava/lang/Object;)I

    move-result v0

    .line 128
    .local v0, "arrayLength":I
    sget v4, Landroid/hardware/camera2/marshal/Marshaler;->NATIVE_SIZE_DYNAMIC:I

    if-eq v1, v4, :cond_0

    .line 130
    mul-int v4, v1, v0

    return v4

    .line 133
    :cond_0
    const/4 v3, 0x0

    .line 134
    .local v3, "size":I
    const/4 v2, 0x0

    .local v2, "i":I
    :goto_0
    if-ge v2, v0, :cond_1

    .line 135
    iget-object v4, p0, Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray$MarshalerArray;->mComponentMarshaler:Landroid/hardware/camera2/marshal/Marshaler;

    invoke-direct {p0, v4, p1, v2}, Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray$MarshalerArray;->calculateElementMarshalSize(Landroid/hardware/camera2/marshal/Marshaler;Ljava/lang/Object;I)I

    move-result v4

    add-int/2addr v3, v4

    .line 134
    add-int/lit8 v2, v2, 0x1

    goto :goto_0

    .line 138
    :cond_1
    return v3
.end method

.method public getNativeSize()I
    .locals 1

    .prologue
    .line 120
    .local p0, "this":Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray$MarshalerArray;, "Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray<TT;>.MarshalerArray;"
    sget v0, Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray$MarshalerArray;->NATIVE_SIZE_DYNAMIC:I

    return v0
.end method

.method public marshal(Ljava/lang/Object;Ljava/nio/ByteBuffer;)V
    .locals 3
    .param p2, "buffer"    # Ljava/nio/ByteBuffer;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(TT;",
            "Ljava/nio/ByteBuffer;",
            ")V"
        }
    .end annotation

    .prologue
    .line 62
    .local p0, "this":Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray$MarshalerArray;, "Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray<TT;>.MarshalerArray;"
    .local p1, "value":Ljava/lang/Object;, "TT;"
    invoke-static {p1}, Ljava/lang/reflect/Array;->getLength(Ljava/lang/Object;)I

    move-result v1

    .line 63
    .local v1, "length":I
    const/4 v0, 0x0

    .local v0, "i":I
    :goto_0
    if-ge v0, v1, :cond_0

    .line 64
    iget-object v2, p0, Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray$MarshalerArray;->mComponentMarshaler:Landroid/hardware/camera2/marshal/Marshaler;

    invoke-direct {p0, v2, p2, p1, v0}, Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray$MarshalerArray;->marshalArrayElement(Landroid/hardware/camera2/marshal/Marshaler;Ljava/nio/ByteBuffer;Ljava/lang/Object;I)V

    .line 63
    add-int/lit8 v0, v0, 0x1

    goto :goto_0

    .line 61
    :cond_0
    return-void
.end method

.method public unmarshal(Ljava/nio/ByteBuffer;)Ljava/lang/Object;
    .locals 10
    .param p1, "buffer"    # Ljava/nio/ByteBuffer;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/nio/ByteBuffer;",
            ")TT;"
        }
    .end annotation

    .prologue
    .line 72
    .local p0, "this":Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray$MarshalerArray;, "Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray<TT;>.MarshalerArray;"
    iget-object v7, p0, Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray$MarshalerArray;->mComponentMarshaler:Landroid/hardware/camera2/marshal/Marshaler;

    invoke-virtual {v7}, Landroid/hardware/camera2/marshal/Marshaler;->getNativeSize()I

    move-result v4

    .line 74
    .local v4, "elementSize":I
    sget v7, Landroid/hardware/camera2/marshal/Marshaler;->NATIVE_SIZE_DYNAMIC:I

    if-eq v4, v7, :cond_1

    .line 75
    invoke-virtual {p1}, Ljava/nio/ByteBuffer;->remaining()I

    move-result v6

    .line 76
    .local v6, "remaining":I
    div-int v2, v6, v4

    .line 78
    .local v2, "arraySize":I
    rem-int v7, v6, v4

    if-eqz v7, :cond_0

    .line 79
    new-instance v7, Ljava/lang/UnsupportedOperationException;

    new-instance v8, Ljava/lang/StringBuilder;

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

    const-string/jumbo v9, "Arrays for "

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    iget-object v9, p0, Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray$MarshalerArray;->mTypeReference:Landroid/hardware/camera2/utils/TypeReference;

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v8

    .line 80
    const-string/jumbo v9, " must be packed tighly into a multiple of "

    .line 79
    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    invoke-virtual {v8, v4}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v8

    .line 81
    const-string/jumbo v9, "; but there are "

    .line 79
    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    .line 81
    rem-int v9, v6, v4

    .line 79
    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v8

    .line 81
    const-string/jumbo v9, " left over bytes"

    .line 79
    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    invoke-virtual {v8}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v8

    invoke-direct {v7, v8}, Ljava/lang/UnsupportedOperationException;-><init>(Ljava/lang/String;)V

    throw v7

    .line 91
    :cond_0
    iget-object v7, p0, Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray$MarshalerArray;->mComponentClass:Ljava/lang/Class;

    invoke-static {v7, v2}, Ljava/lang/reflect/Array;->newInstance(Ljava/lang/Class;I)Ljava/lang/Object;

    move-result-object v0

    .line 92
    .local v0, "array":Ljava/lang/Object;
    const/4 v5, 0x0

    .local v5, "i":I
    :goto_0
    if-ge v5, v2, :cond_3

    .line 93
    iget-object v7, p0, Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray$MarshalerArray;->mComponentMarshaler:Landroid/hardware/camera2/marshal/Marshaler;

    invoke-virtual {v7, p1}, Landroid/hardware/camera2/marshal/Marshaler;->unmarshal(Ljava/nio/ByteBuffer;)Ljava/lang/Object;

    move-result-object v3

    .line 94
    .local v3, "elem":Ljava/lang/Object;
    invoke-static {v0, v5, v3}, Ljava/lang/reflect/Array;->set(Ljava/lang/Object;ILjava/lang/Object;)V

    .line 92
    add-int/lit8 v5, v5, 0x1

    goto :goto_0

    .line 98
    .end local v0    # "array":Ljava/lang/Object;
    .end local v2    # "arraySize":I
    .end local v3    # "elem":Ljava/lang/Object;
    .end local v5    # "i":I
    .end local v6    # "remaining":I
    :cond_1
    new-instance v1, Ljava/util/ArrayList;

    invoke-direct {v1}, Ljava/util/ArrayList;-><init>()V

    .line 101
    .local v1, "arrayList":Ljava/util/ArrayList;, "Ljava/util/ArrayList<Ljava/lang/Object;>;"
    :goto_1
    invoke-virtual {p1}, Ljava/nio/ByteBuffer;->hasRemaining()Z

    move-result v7

    if-eqz v7, :cond_2

    .line 102
    iget-object v7, p0, Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray$MarshalerArray;->mComponentMarshaler:Landroid/hardware/camera2/marshal/Marshaler;

    invoke-virtual {v7, p1}, Landroid/hardware/camera2/marshal/Marshaler;->unmarshal(Ljava/nio/ByteBuffer;)Ljava/lang/Object;

    move-result-object v3

    .line 103
    .restart local v3    # "elem":Ljava/lang/Object;
    invoke-virtual {v1, v3}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    goto :goto_1

    .line 106
    .end local v3    # "elem":Ljava/lang/Object;
    :cond_2
    invoke-virtual {v1}, Ljava/util/ArrayList;->size()I

    move-result v2

    .line 107
    .restart local v2    # "arraySize":I
    iget-object v7, p0, Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray$MarshalerArray;->mComponentClass:Ljava/lang/Class;

    invoke-static {v7, v2}, Ljava/lang/reflect/Array;->newInstance(Ljava/lang/Class;I)Ljava/lang/Object;

    move-result-object v7

    invoke-direct {p0, v1, v7}, Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray$MarshalerArray;->copyListToArray(Ljava/util/ArrayList;Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    .line 110
    .end local v1    # "arrayList":Ljava/util/ArrayList;, "Ljava/util/ArrayList<Ljava/lang/Object;>;"
    .restart local v0    # "array":Ljava/lang/Object;
    :cond_3
    invoke-virtual {p1}, Ljava/nio/ByteBuffer;->remaining()I

    move-result v7

    if-eqz v7, :cond_4

    .line 111
    invoke-static {}, Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray;->-get0()Ljava/lang/String;

    move-result-object v7

    new-instance v8, Ljava/lang/StringBuilder;

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

    const-string/jumbo v9, "Trailing bytes ("

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    invoke-virtual {p1}, Ljava/nio/ByteBuffer;->remaining()I

    move-result v9

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v8

    const-string/jumbo v9, ") left over after unpacking "

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    .line 112
    iget-object v9, p0, Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray$MarshalerArray;->mClass:Ljava/lang/Class;

    .line 111
    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v8

    invoke-virtual {v8}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v8

    invoke-static {v7, v8}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 115
    :cond_4
    iget-object v7, p0, Landroid/hardware/camera2/marshal/impl/MarshalQueryableArray$MarshalerArray;->mClass:Ljava/lang/Class;

    invoke-virtual {v7, v0}, Ljava/lang/Class;->cast(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v7

    return-object v7
.end method


text:
ACCEPTED

#### According to
International Plant Names Index

#### Published in
Thaiszia, J. Bot. 17: -. [1-10]

#### Original name
null

### Remarks
null

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Collections;
using System.Data;
using Approve.EntityBase;

namespace Approve.EntitySys
{
    [Serializable]
    public class EsRole : EBase
    {
        public EsRole()
		{
            base.m_EntityType = EntityTypeEnum.EsRole;
		}

		public EsRole(IDictionary dict):base(dict)
		{
            base.m_EntityType = EntityTypeEnum.EsRole;
		}

		public EsRole(DataRow dr):base(dr)
		{
            base.m_EntityType = EntityTypeEnum.EsRole;
		}

        public EsRole(DataRow dr, IDictionary rel)
            : base(dr, rel)
		{
            base.m_EntityType = EntityTypeEnum.EsRole;
		}

        public string FName
        {
            get { return EConvert.ToString(base.GetProperty("FName")); }
            set { base.SetProperty("FName", value); }
        }
        public int FOrder
        {
            get { return EConvert.ToInt(base.GetProperty("FOrder")); }
            set { base.SetProperty("FOrder", value); }
        }

    }
}


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

namespace Pytocs.Core.CodeModel
{
    public class CodeObjectInitializer : CodeInitializer
    {
        public List<MemberDeclarator> MemberDeclarators = new List<MemberDeclarator>();

        public override void Accept(ICodeExpressionVisitor visitor)
        {
            visitor.VisitObjectInitializer(this);
        }

        public override T Accept<T>(ICodeExpressionVisitor<T> visitor)
        {
            return visitor.VisitObjectInitializer(this);
        }
    }

    public class MemberDeclarator
    {
        public string? Name;
        public CodeExpression? Expression;
    }

}


text:
<?php

/**
 * Doctrine_Export_Oracle_TestCase
 *
 * @package     Doctrine
 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi>
 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL
 * @category    Object Relational Mapping
 * @link        www.doctrine-project.org
 * @since       1.0
 * @version     $Revision$
 */
class Doctrine_Export_Oracle_TestCase extends Doctrine_UnitTestCase
{
    public function testCreateSequenceExecutesSql()
    {
        $sequenceName = 'sequence';
        $start = 1;
        $query = 'CREATE SEQUENCE ' . $sequenceName . '_seq START WITH ' . $start . ' INCREMENT BY 1 NOCACHE';

        $this->export->createSequence($sequenceName, $start);

        $this->assertEqual($this->adapter->pop(), $query);
    }

    public function testDropSequenceExecutesSql()
    {
        $sequenceName = 'sequence';

        $query = 'DROP SEQUENCE ' . $sequenceName;

        $this->export->dropSequence($sequenceName);

        $this->assertEqual($this->adapter->pop(), $query . '_seq');
    }
    public function testCreateTableExecutesSql()
    {
        $name = 'mytable';

        $fields  = array('id' => array('type' => 'integer'));
        $options = array('type' => 'MYISAM');

        $this->export->createTable($name, $fields);

        $this->assertEqual($this->adapter->pop(), 'COMMIT');
        $this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id INTEGER)');
        $this->assertEqual($this->adapter->pop(), 'BEGIN TRANSACTION');
    }
    public function testCreateTableSupportsDefaultAttribute()
    {
        $name = 'mytable';
        $fields  = array('name' => array('type' => 'char', 'length' => 10, 'default' => 'def'),
                         'type' => array('type' => 'integer', 'length' => 3, 'default' => 12)
                         );

        $options = array('primary' => array('name', 'type'));
        $this->export->createTable($name, $fields, $options);

        $this->assertEqual($this->adapter->pop(), 'COMMIT');
        $this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (name CHAR(10) DEFAULT \'def\', type NUMBER(8) DEFAULT 12, PRIMARY KEY(name, type))');
        $this->assertEqual($this->adapter->pop(), 'BEGIN TRANSACTION');
    }

    public function testCreateTableWithOwnParams()
    {
        $this->conn->setParam('char_unit', 'CHAR');
        $this->conn->setParam('varchar2_max_length', 1000);

        $fields = array(
            'type' => array('type' => 'char', 'length' => 10, 'default' => 'admin'),
            'name' => array('type' => 'string', 'length' => 1000),
            'about' => array('type' => 'string', 'length' => 1001, 'default' => 'def'),
        );

        $sql = $this->export->createTableSql('mytable', $fields);
        $this->assertEqual($sql[0], "CREATE TABLE mytable (type CHAR(10 CHAR) DEFAULT 'admin', name VARCHAR2(1000 CHAR), about CLOB DEFAULT 'def')");

        $this->conn->setParam('char_unit', null);
        $this->conn->setParam('varchar2_max_length', 4000);
    }

    public function testCreateTableSupportsMultiplePks()
    {
        $name = 'mytable';
        $fields  = array('name' => array('type' => 'char', 'length' => 10),
                         'type' => array('type' => 'integer', 'length' => 3));

        $options = array('primary' => array('name', 'type'));
        $this->export->createTable($name, $fields, $options);

        $this->assertEqual($this->adapter->pop(), 'COMMIT');
        $this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (name CHAR(10), type NUMBER(8), PRIMARY KEY(name, type))');
        $this->assertEqual($this->adapter->pop(), 'BEGIN TRANSACTION');
    }
    public function testCreateTableSupportsAutoincPks()
    {
        $name = 'mytable';

        $fields  = array('id' => array('type' => 'integer', 'autoincrement' => true));

        $this->export->createTable($name, $fields);

        $this->assertEqual($this->adapter->pop(), 'COMMIT');
        $this->assertEqual(substr($this->adapter->pop(), 0, 14), 'CREATE TRIGGER');
        $this->assertEqual($this->adapter->pop(), 'CREATE SEQUENCE MYTABLE_seq START WITH 1 INCREMENT BY 1 NOCACHE');
        $this->assertEqual(substr($this->adapter->pop(), 0, 7), "DECLARE");
        $this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id INTEGER)');
        $this->assertEqual($this->adapter->pop(), 'BEGIN TRANSACTION');
    }

    public function testCreateTableSupportsCharType()
    {
        $name = 'mytable';

        $fields  = array('id' => array('type' => 'char', 'length' => 3));

        $this->export->createTable($name, $fields);

        $this->adapter->pop();
        $this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id CHAR(3))');
    }
    public function testCreateTableSupportsUniqueConstraint()
    {
        $fields  = array('id' => array('type' => 'integer', 'unsigned' => 1, 'autoincrement' => true, 'unique' => true),
                         'name' => array('type' => 'string', 'length' => 4),
                         );

        $options = array('primary' => array('id'),
                         );

        $sql = $this->export->createTableSql('sometable', $fields, $options);

        $this->assertEqual($sql[0], 'CREATE TABLE sometable (id INTEGER UNIQUE, name VARCHAR2(4), PRIMARY KEY(id))');
    }
    public function testCreateTableSupportsIndexes()
    {
        $fields  = array('id' => array('type' => 'integer', 'unsigned' => 1, 'autoincrement' => true, 'unique' => true),
                         'name' => array('type' => 'string', 'length' => 4),
                         );

        $options = array('primary' => array('id'),
                         'indexes' => array('myindex' => array('fields' => array('id', 'name')))
                         );

        $sql = $this->export->createTableSql('sometable', $fields, $options);

        $this->assertEqual($sql[0], 'CREATE TABLE sometable (id INTEGER UNIQUE, name VARCHAR2(4), PRIMARY KEY(id))');
        $this->assertEqual($sql[4], 'CREATE INDEX myindex ON sometable (id, name)');

        $fields = array('id'=> array('type'=>'integer', 'unisgned' => 1, 'autoincrement' => true),
                        'name' => array('type' => 'string', 'length' => 4),
                        'category' => array('type'=>'integer', 'length'=>2),
                        );
        $options = array('primary' => array('id'),
                         'indexes' => array('category_index' => array('fields'=> array('category')), 'unique_index' => array('type'=> 'unique', 'fields'=> array('id', 'name'))),
                         );
        $sql = $this->export->createTableSql('sometable', $fields, $options);
        $this->assertEqual($sql[0], 'CREATE TABLE sometable (id INTEGER, name VARCHAR2(4), category NUMBER(5), PRIMARY KEY(id), CONSTRAINT unique_index UNIQUE (id, name))');
        $this->assertEqual($sql[4], 'CREATE INDEX category_index ON sometable (category)');
    }

    public function testIdentifierQuoting()
    {
    	$this->conn->setAttribute(Doctrine_Core::ATTR_QUOTE_IDENTIFIER, true);

        $fields = array('id' => array('type' => 'integer', 'unsigned' => 1, 'autoincrement' => true),
                        'name' => array('type' => 'string', 'length' => 4),
                        );
        $options = array('primary' => array('id'),
                         'indexes' => array('myindex' => array('fields' => array('id', 'name')))
                         );

        $sql  = $this->export->createTableSql('sometable', $fields, $options);
        $this->assertEqual($sql[0], 'CREATE TABLE "sometable" ("id" INTEGER, "name" VARCHAR2(4), PRIMARY KEY("id"))');
        $this->assertEqual($sql[1], 'DECLARE
  constraints_Count NUMBER;
BEGIN
  SELECT COUNT(CONSTRAINT_NAME) INTO constraints_Count FROM USER_CONSTRAINTS WHERE TABLE_NAME = \'sometable\' AND CONSTRAINT_TYPE = \'P\';
  IF constraints_Count = 0 THEN
    EXECUTE IMMEDIATE \'ALTER TABLE "sometable" ADD CONSTRAINT "sometable_AI_PK_idx" PRIMARY KEY ("id")\';
  END IF;
END;');
        $this->assertEqual($sql[2], 'CREATE SEQUENCE "sometable_seq" START WITH 1 INCREMENT BY 1 NOCACHE');
        $this->assertEqual($sql[3], 'CREATE TRIGGER "sometable_AI_PK"
   BEFORE INSERT
   ON "sometable"
   FOR EACH ROW
DECLARE
   last_Sequence NUMBER;
   last_InsertID NUMBER;
BEGIN
   IF (:NEW."id" IS NULL OR :NEW."id" = 0) THEN
      SELECT "sometable_seq".NEXTVAL INTO :NEW."id" FROM DUAL;
   ELSE
      SELECT NVL(Last_Number, 0) INTO last_Sequence
        FROM User_Sequences
       WHERE UPPER(Sequence_Name) = UPPER(\'sometable_seq\');
      SELECT :NEW."id" INTO last_InsertID FROM DUAL;
      WHILE (last_InsertID > last_Sequence) LOOP
         SELECT "sometable_seq".NEXTVAL INTO last_Sequence FROM DUAL;
      END LOOP;
   END IF;
END;');
		$this->assertEqual($sql[4], 'CREATE INDEX "myindex" ON "sometable" ("id", "name")');

		// test dropping sequence
		$sql = $this->export->dropSequenceSql('sometable');
		$this->assertEqual($sql, 'DROP SEQUENCE "sometable_seq"');

        $this->conn->setAttribute(Doctrine_Core::ATTR_QUOTE_IDENTIFIER, false);
    }
}


text:
package com.laytonsmith.abstraction.events;

import com.laytonsmith.abstraction.MCPlayer;
import com.laytonsmith.abstraction.blocks.MCBlock;
import com.laytonsmith.core.events.BindableEvent;

/**
 *
 * @author EntityReborn
 */
public interface MCBlockBreakEvent extends BindableEvent {

    public MCPlayer getPlayer();

    public MCBlock getBlock();

	public int getExpToDrop();

	public void setExpToDrop(int exp);
}


text:
You're welcome to contribute to lightil.

Plese take a moment to review this document in order to make the contribution process easy and effective for everyone involved.

## Commit message template
Commit messages should follow the following rules. The basic template is:
```
[type](<scope>): description
```
### Type

Type suggest which type of change you have made. The following type are suggested.

- `docs` : When you change something with the docs or typo you should use this type.
- `fix` : When you fix bugs.
- `feat` : When you add a new feature.
- `style` : When you change the code style. (formatting, missing semi colons, etc.)
- `refactor`: Rewrite bad code.
- `test` : Adding or refactoring tests.
- `chore` : Such as update config file etc, no production code change.
- `revert`: When you revert something
- `contrib`: Normal code work other than fix, feat, style, refactor

### Scope

Scope suggest which part of the code that you  have modified. You can use it freely, one or two words is prefered.


text:
chmod +x /home/vagrant/setup/*.sh
chmod +x /home/vagrant/setup/setup/*.sh

# start the setup
cd /home/vagrant && setup/setup.sh


text:
package jade.core;

//#APIDOC_EXCLUDE_FILE

// We use Hashtables since we need synchronized access
import java.util.Hashtable;

/**
   Processes JADE kernel-level commands, managing a filter/sink system
   to support dynamically configurable platform services.

   @author Giovanni Rimassa - FRAMeTech s.r.l.
   @author Giovanni Caire - TILAB
 */
class CommandProcessor {
	private Filter firstDownFilter;
	private Filter firstUpFilter;

	private final Hashtable downSinks;
	private final Hashtable upSinks;
	private SinksFilter lastDownFilter;
	private SinksFilter lastUpFilter;

	public CommandProcessor() {
		downSinks = new Hashtable(4);
		upSinks = new Hashtable(4);
		lastDownFilter = new SinksFilter(downSinks);
		lastUpFilter = new SinksFilter(upSinks);
		firstDownFilter = lastDownFilter;
		firstUpFilter = lastUpFilter;
	}

	/**
       Add a new filter to the filter chain.

       @param f The new filter to add.
       @param direction Whether to add this filter to the outgoing or
       incoming filter chain.
	 */
	public void addFilter(Filter f, boolean direction) {
		if(direction == Filter.INCOMING) {
			firstUpFilter = insertFilter(f, firstUpFilter);
		}
		else {
			firstDownFilter = insertFilter(f, firstDownFilter);
		}
	}

	/**
       Insert a Filter in the chain started by first.
       @return The Filter at the beginning of the chain (may have
       changed)
	 */
	private synchronized Filter insertFilter(Filter f, Filter first) {
		if (f != null) {
			if (f.getPreferredPosition() < first.getPreferredPosition()) {
				// Insert at the beginning of the filter chain
				f.setNext(first);
				return f;
			}
			else {
				Filter current = first;
				Filter next = current.getNext();
				while (true) {
					if (f.getPreferredPosition() < next.getPreferredPosition()) {
						// Insert between current and next
						f.setNext(next);
						current.setNext(f);
						break;
					}
					else {
						current = next;
						next = current.getNext();
					}
				}
			}
		}
		return first;
	}

	/**
       Remove a filter from the filter chain.

       @param f The filter to remove.
	 */
	public void removeFilter(Filter f, boolean direction) {
		if(direction == Filter.INCOMING) {
			firstUpFilter = removeFilter(f, firstUpFilter);
		}
		else {
			firstDownFilter = removeFilter(f, firstDownFilter);
		}
	}

	/**
       Remove a Filter from the chain started by first.
       @return The Filter at the beginning of the chain (may have
       changed)
	 */
	private synchronized Filter removeFilter(Filter f, Filter first) {
		if (first != null) {
			if (f != null) {
				if (f.equals(first)) {
					// Remove the first element of the filter chain
					return first.getNext();
				}
				else {
					Filter current = first;
					Filter next = current.getNext();
					while (true) {
						if (f.equals(next)) {
							// Remove next
							current.setNext(next.getNext());
							break;
						}
						else {
							current = next;
							next = current.getNext();
						}
					}
				}
			}
		}
		return first;
	}

	/**
       Register a command sink object to handle the given vertical commmand set.

       @param snk A service-specific implementation of the
       Sink interface, managing a set of vertical
       commands.
       @param side One of the two constants
       Sink.COMMAND_SOURCE or
       Sink.COMMAND_TARGET, to state whether this sink
       will handle locally issued commands or commands incoming from
       remote nodes.
       @param commandNames An array containing all the names of the
       vertical commands the new sink wants to handle.
       @throws ServiceException If some other sink is already
       registered for a member of the commandNames set.
	 */
	public synchronized void registerSink(Sink snk, boolean side, String serviceName) throws ServiceException {

		Hashtable sinks;
		if(side == Sink.COMMAND_SOURCE) {
			sinks = downSinks;
		}
		else {
			sinks = upSinks;
		}
		sinks.put(serviceName, snk);
	}

	/**
       Deregister a sink that is currently handling a given set of vertical commands.

       @param side One of the two constants
       Sink.COMMAND_SOURCE or
       Sink.COMMAND_TARGET, to state whether the sink to
       be removed is handling locally issued commands or commands
       incoming from remote nodes.
       @param commandNames An array containing all the names of the
       vertical commands currently handled by the sink to be removed.
       @throws ServiceException If a member of the
       commandNames set has no associated command sink.
	 */
	public synchronized void deregisterSink(boolean side, String serviceName) throws ServiceException {

		Hashtable sinks;
		if(side == Sink.COMMAND_SOURCE) {
			sinks = downSinks;
		}
		else {
			sinks = upSinks;
		}

		sinks.remove(serviceName);
	}

	/**
       Process an outgoing command object, carrying out the action it
       represents.  This method is not synchronized and it must be
       reentrant and as fast as possible, because it is going to be a
       bottleneck of the kernel call flow.

       @param cmd The VerticalCommand object to process.
	 */
	public Object processOutgoing(VerticalCommand cmd) {
		firstDownFilter.filter(cmd);
		return cmd.getReturnValue();
	}

	/**
       Process an incoming command object, carrying out the action it
       represents.  This method is not synchronized and it must be
       reentrant and as fast as possible, because it is going to be a
       bottleneck of the kernel call flow.

       @param cmd The VerticalCommand object to process.
	 */
	public Object processIncoming(VerticalCommand cmd) {
		firstUpFilter.filter(cmd);
		return cmd.getReturnValue();
	}

	/**
	  Inner class SinksFilter.
	  This class makes the set of sinks in a given direction
	  look like a single filter that always stands at the end of
	  the filter chain.
	 */
	private class SinksFilter extends Filter {
		private Hashtable mySinks;

		private SinksFilter(Hashtable ht) {
			mySinks = ht;
			preferredPosition = LAST+1;
		}

		protected boolean accept(VerticalCommand cmd) {
			String service = cmd.getService();
			if (service != null) {
				Sink s = (Sink) mySinks.get(service);
				if (s != null) {
					//System.out.println("Sink "+s+" consuming command "+cmd.getName());
					s.consume(cmd);
				}
			}
			// Do not propagate since this is always the last filter in the chain
			return false;
		}
	} // END of inner class SinksFilter
}


text:
package github.jadetang.maliang.bean;

/**
 * @author TANG SICHENG
 */
public class Relation extends Tuple<JavaField,Column> {

    private JavaField field;

    private Column column;

    public Relation(JavaField first, Column second) {
        super(first, second);
        this.field = first;
        this.column = second;
    }

    public JavaField bean(){
        return super._1();
    }

    public Column table(){
        return super._2();
    }

    public JavaField getField() {
        return field;
    }

    public void setField(JavaField field) {
        this.field = field;
    }

    public Column getColumn() {
        return column;
    }

    public void setColumn(Column column) {
        this.column = column;
    }
}


text:
var chai = require("chai");
var _ = require("underscore");
_.mixin(require('../src/underscore.deepextend'));

describe("underscore.deepextend", function() {
  beforeEach(function() {
    this.object = {foo: {bar: 123}};
  });

  it("should extend normaly", function() {
    var object = _.deepExtend(this.object, {foo: 312});
    chai.expect(object.foo, "foo").to.equal(312);
  });

  it("should deep extend function", function() {
    var value = "";
    var object = _.extend(this.object, {
      fooBar: function() {
        return value += "foo";
      }
    });

    object = _.deepExtend(object, {
      fooBar: function() {
        return value += "Bar";
      }
    });

    chai.expect(object.fooBar()).to.equal("fooBar");
  });

  it("should deep extend object", function() {
    var foo = this.object.foo;
    var object = _.deepExtend(this.object, {foo: {bar: 321}});

    chai.expect(object.foo).to.equal(foo);
  });
});


text:
"""
ansible callback plugin

所有用户存 Set
单个也存 Set
"""

from pymongo import MongoClient

mc = MongoClient()

host_db = mc['test']

class CallbackModule(object):
    """
    """

    def __init__(self):
        pass

    def v2_playbook_on_play_start(self, *args, **kwargs):
        pass

    def v2_runner_on_ok(self, res):
        if res._result.get('stdout_lines', None):
            # print res._result['stdout_lines']

            if host_db['host'].find_one({'host': str(res._host)}):
                host_db['host'].update({'host': str(res._host)},
                                       {'$set': {'users': res._result['stdout_lines']}})

            else:
                data = {
                    'host': str(res._host),
                    'users': res._result['stdout_lines']
                }

                host_db['host'].save(data)

                print data

    def v2_runner_on_failed(self, res, **kwargs):
        print 'failed: ',  res._host

    def v2_runner_on_unreachable(self, res):
        print 'unreacheable: ',  res._host

    def v2_runner_on_skipped(self, res):
        # data = {
            # 'status': 'skipped',
            # 'type': 'runner',
            # 'result': json.dumps(res._result),
            # 'name': str(res._task),
            # 'host': str(res._host),
        # }

        print 'skipped: ', res._host

    def v2_runner_item_on_ok(self, res):
        # print res._result['item']
        if res._result.get('stdout_lines', None):
            # print res._result['stdout_lines']
            if host_db['host'].find_one({'host': str(res._host)}):
                host_db['host'].update(
                    {'host': str(res._host)},
                    {'$set': {res._result['item']: res._result['stdout_lines'][0].split(',')}})

            else:
                data = {
                    'host': str(res._host),
                    res._result['item']: res._result['stdout_lines'][0].split(',')
                }

                host_db['host'].save(data)

                print data

    def v2_runner_item_on_failed(self, res):
        pass

    def v2_runner_item_on_skipped(self, res):
        pass

    def v2_runner_retry(self, res):
        pass

    def v2_playbook_on_stats(self, stats):
        """记录最终结果
        """
        # ips = {i for i in stats.ok.iterkeys()} | {i for i in stats.changed.iterkeys()}
        fail_ips = {i for i in stats.dark.iterkeys()} | {i for i in stats.failures.iterkeys()}

        print fail_ips

if __name__ == '__main__':
    print 'callback'


text:
cask :v1 => 'font-noto-sans-phags-pa' do
  version :latest
  sha256 :no_check

  url 'https://noto-website.storage.googleapis.com/pkgs/NotoSansPhags-pa-unhinted.zip'
  homepage 'https://www.google.com/get/noto'
  license :apache

  font 'NotoSansPhagsPa-Regular.ttf'
end


text:
<?php

/**
 * Exception classes for HTML_QuickForm2
 */
require_once 'HTML/QuickForm2/Exception.php';

/**
 * Javascript aggregator and builder class
 *
 * @category HTML
 * @package  HTML_QuickForm2
 * @author   Alexey Borzov <avb@php.net>
 * @author   Bertrand Mansion <golgote@mamasam.com>
 * @license  http://opensource.org/licenses/bsd-license.php New BSD License
 * @version  Release: @package_version@
 * @link     http://pear.php.net/package/HTML_QuickForm2
 */
class HTML_QuickForm2_JavascriptBuilder
{
   /**
    * Client-side rules
    * @var array
    */
    protected $rules = array();

   /**
    * Elements' setup code
    * @var array
    */
    protected $scripts = array();

   /**
    * Whether to generate a validator object for the form if no rules are present
    *
    * Needed when the form contains an empty repeat element
    *
    * @var array
    */
    protected $forceValidator = array();

    /**
    * Javascript libraries
    * @var array
    */
    protected $libraries = array(
        'base' => array('file' => 'quickform.js')
    );

   /**
    * Default web path to JS library files
    * @var string
    */
    protected $defaultWebPath;

   /**
    * Default filesystem path to JS library files
    * @var string
    */
    protected $defaultAbsPath;

   /**
    * Current form ID
    * @var string
    */
    protected $formId = null;

   /**
    * Constructor, sets default web path to JS library files and default filesystem path
    *
    * @param string $defaultWebPath default web path to JS library files
    *                               (to use in <script src="...">)
    * @param string $defaultAbsPath default filesystem path to JS library files
    *               (to inline these files into the page), this is set to a package
    *                subdirectory of PEAR data_dir if not given
    */
    public function __construct($defaultWebPath = 'js/', $defaultAbsPath = null)
    {
        $this->defaultWebPath = $defaultWebPath;

        if (null === $defaultAbsPath) {
            $defaultAbsPath = '@data_dir@' . DIRECTORY_SEPARATOR . 'HTML_QuickForm2'
                              . DIRECTORY_SEPARATOR . 'js' . DIRECTORY_SEPARATOR;
            // package was probably not installed, use relative path
            if (0 === strpos($defaultAbsPath, '@' . 'data_dir@')) {
                $defaultAbsPath = realpath(
                    dirname(dirname(dirname(__FILE__)))
                    . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'js'
                ) . DIRECTORY_SEPARATOR;
            }
        }
        $this->defaultAbsPath = $defaultAbsPath;
    }

   /**
    * Adds a Javascript library file to the list
    *
    * @param string $name     name to reference the library by
    * @param string $fileName file name, without path
    * @param string $webPath  path relative to web root to reference in <script src="">,
    *                         $defaultWebPath will be used if not given
    * @param string $absPath  filesystem path where the file resides, used when inlining
    *                         libraries, $defaultAbsPath will be used if not given
    */
    public function addLibrary($name, $fileName, $webPath = null, $absPath = null)
    {
        $this->libraries[strtolower($name)] = array(
            'file' => $fileName, 'webPath' => $webPath, 'absPath' => $absPath
        );
    }

   /**
    * Returns Javascript libraries
    *
    * @param bool $inline        whether to return a list of library file names
    *                            or contents of files
    * @param bool $addScriptTags whether to enclose the results in <script> tags
    *
    * @return   string|array
    */
    public function getLibraries($inline = false, $addScriptTags = true)
    {
        $ret = $inline? '': array();
        foreach ($this->libraries as $name => $library) {
            if ($inline) {
                $path = !empty($library['absPath'])? $library['absPath']: $this->defaultAbsPath;
                if (DIRECTORY_SEPARATOR != substr($path, -1)) {
                    $path .= DIRECTORY_SEPARATOR;
                }
                if (false === ($file = @file_get_contents($path . $library['file']))) {
                    throw new HTML_QuickForm2_NotFoundException(
                        "File '{$library['file']}' for JS library '{$name}' not found at '{$path}'"
                    );
                }
                $ret .= ('' == $ret? '': "\n") . $file;

            } else {
                $path = !empty($library['webPath'])? $library['webPath']: $this->defaultWebPath;
                if ('/' != substr($path, -1)) {
                    $path .= '/';
                }
                $ret[$name] = $addScriptTags
                              ? "<script type=\"text/javascript\" src=\"{$path}{$library['file']}\"></script>"
                              : $path . $library['file'];
            }
        }
        return ($inline && $addScriptTags) ? $this->wrapScript($ret) : $ret;
    }

   /**
    * Sets ID of the form currently being processed
    *
    * All subsequent calls to addRule() and addElementJavascript() will store
    * the scripts for that form
    *
    * @param string $formId
    */
    public function setFormId($formId)
    {
        $this->formId = $formId;
        $this->rules[$this->formId]          = array();
        $this->scripts[$this->formId]        = array();
        $this->forceValidator[$this->formId] = false;
    }

   /**
    * Adds the Rule javascript to the list of current form Rules
    *
    * @param HTML_QuickForm2_Rule $rule     Rule instance
    * @param bool                 $triggers Whether rule code should contain
    *                                       "triggers" for live validation
    */
    public function addRule(HTML_QuickForm2_Rule $rule, $triggers = false)
    {
        $this->rules[$this->formId][] = $rule->getJavascript($triggers);
    }

   /**
    * Adds element's setup code to form's Javascript
    *
    * @param string $script
    */
    public function addElementJavascript($script)
    {
        $this->scripts[$this->formId][] = $script;
    }

   /**
    * Enables generating a validator for the current form even if no rules are present
    */
    public function forceValidator()
    {
        $this->forceValidator[$this->formId] = true;
    }

   /**
    * Returns per-form javascript (client-side validation and elements' setup)
    *
    * @param string  $formId        form ID, if empty returns code for all forms
    * @param boolean $addScriptTags whether to enclose code in <script> tags
    *
    * @return   string
    */
    public function getFormJavascript($formId = null, $addScriptTags = true)
    {
        $js  = $this->getValidator($formId, false);
        $js .= ('' == $js ? '' : "\n") . $this->getSetupCode($formId, false);
        return $addScriptTags ? $this->wrapScript($js) : $js;
    }

    /**
     * Returns setup code for form elements
     *
     * @param string $formId        form ID, if empty returns code for all forms
     * @param bool   $addScriptTags whether to enclose code in <script> tags
     *
     * @return string
     */
    public function getSetupCode($formId = null, $addScriptTags = false)
    {
        $js = '';
        foreach ($this->scripts as $id => $scripts) {
            if ((null === $formId || $id == $formId) && !empty($scripts)) {
                $js .= ('' == $js? '': "\n") . implode("\n", $scripts);
            }
        }
        return $addScriptTags ? $this->wrapScript($js) : $js;
    }

    /**
     * Returns client-side validation code
     *
     * @param string $formId        form ID, if empty returns code for all forms
     * @param bool   $addScriptTags whether to enclose code in <script> tags
     *
     * @return string
     */
    public function getValidator($formId = null, $addScriptTags = false)
    {
        $js = '';
        foreach ($this->rules as $id => $rules) {
            if ((null === $formId || $id == $formId)
                && (!empty($rules) || !empty($this->forceValidator[$id]))
            ) {
                $js .= ('' == $js ? '' : "\n")
                       . "new qf.Validator(document.getElementById('{$id}'), [\n"
                       . implode(",\n", $rules) . "\n]);";
            }
        }
        return $addScriptTags ? $this->wrapScript($js) : $js;
    }

    /**
     * Wraps the given Javascript code in <script> tags
     *
     * @param string $js Javascript code
     *
     * @return string code wrapped in <script></script> tags,
     *                empty string if $js is empty
     */
    protected function wrapScript($js)
    {
        if ('' != $js) {
            $js = "<script type=\"text/javascript\">\n//<![CDATA[\n"
                  . $js . "\n//]]>\n</script>";
        }
        return $js;
    }

   /**
    * Encodes a value for use as Javascript literal
    *
    * NB: unlike json_encode() we do not enforce UTF-8 charset here
    *
    * @param mixed $value
    *
    * @return   string  value as Javascript literal
    */
    public static function encode($value)
    {
        if (is_null($value)) {
            return 'null';

        } elseif (is_bool($value)) {
            return $value? 'true': 'false';

        } elseif (is_int($value) || is_float($value)) {
            return $value;

        } elseif (is_string($value)) {
            return '"' . strtr($value, array(
                                "\r" => '\r',
                                "\n" => '\n',
                                "\t" => '\t',
                                "'"  => "\\'",
                                '"'  => '\"',
                                '\\' => '\\\\'
                              )) . '"';

        } elseif (is_array($value)) {
            // associative array, encoding as JS object
            if (count($value) && array_keys($value) !== range(0, count($value) - 1)) {
                return '{' . implode(',', array_map(
                    array('HTML_QuickForm2_JavascriptBuilder', 'encodeNameValue'),
                    array_keys($value), array_values($value)
                )) . '}';
            }
            return '[' . implode(',', array_map(
                array('HTML_QuickForm2_JavascriptBuilder', 'encode'),
                $value
            )) . ']';

        } elseif (is_object($value)) {
            $vars = get_object_vars($value);
            return '{' . implode(',', array_map(
                array('HTML_QuickForm2_JavascriptBuilder', 'encodeNameValue'),
                array_keys($vars), array_values($vars)
            )) . '}';

        } else {
            throw new HTML_QuickForm2_InvalidArgumentException(
                'Cannot encode ' . gettype($value) . ' as Javascript value'
            );
        }
    }

   /**
    * Callback for array_map used to generate name-value pairs
    *
    * @param mixed $name
    * @param mixed $value
    *
    * @return   string
    */
    protected static function encodeNameValue($name, $value)
    {
        return self::encode((string)$name) . ':' . self::encode($value);
    }
}
?>


text:
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>

Notes

              <input type="hidden" id="notesClassId" />

                      <input type="file" id="notesUploadFile" name="notesUploadFile" />

                      <textarea rows="5" id="noteMessage" class="form-control" placeholder="Type message..." ></textarea>

                            Add attachment
                          <button type="button" id="submitAddNotes" class="btn btn-success">  Submit</button>

          <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>


text:
import { createStore } from 'redux';
import { appReducer } from './appReducer';
import { INIT_STATE } from './../data/initState';

export const store = createStore(
    appReducer,
    INIT_STATE,
    window.devToolsExtension && window.devToolsExtension()
);


text:
from django.conf.urls.defaults import *
from django.conf.urls import patterns
from django.contrib import admin
from django.views.generic import ListView
from cities.models import Country, Region, City, District, PostalCode

class PlaceListView(ListView):
    template_name = "list.html"

    def get_queryset(self):
        if not self.args or not self.args[0]:
            self.place = None
            return Country.objects.all()
        args = self.args[0].split("/")

        country = Country.objects.get(slug=args[0])
        if len(args) == 1:
            self.place = country
            return Region.objects.filter(country=country).order_by('name')

        region = Region.objects.get(country = country, slug=args[1])
        if len(args) == 2:
            self.place = region
            return City.objects.filter(region=region).order_by('name')

        city = City.objects.get(region = region, slug=args[2])
        self.place = city
        return District.objects.filter(city=city).order_by('name')

    def get_context_data(self, **kwargs):
        context = super(PlaceListView, self).get_context_data(**kwargs)
        context['place'] = self.place

        if hasattr(self.place, 'location'):
            context['nearby'] = City.objects.distance(self.place.location).exclude(id=self.place.id).order_by('distance')[:10]
            context['postal'] = PostalCode.objects.distance(self.place.location).order_by('distance')[:10]
        return context

admin.autodiscover()
urlpatterns = patterns('',
    (r'^admin/', include(admin.site.urls)),
    (r'^(.*)$', PlaceListView.as_view()),
)


text:
@interface Rectangle : NSObject <NSCopying, NSCoding> {
	RectangleStruct data;
}

- (id) initWithX:(int)x y:(int)y width:(int)width height:(int)height;
- (id) initWithRectangleStruct:(RectangleStruct*) rectangleStruct;
- (id) initWithRectangle:(Rectangle*) rectangle;

+ (Rectangle*) rectangleWithX:(int)x y:(int)y width:(int)width height:(int)height;
+ (Rectangle*) rectangleWithStruct:(RectangleStruct*) rectangleStruct;
+ (Rectangle*) rectangleWithRectangle:(Rectangle*) rectangle;
+ (Rectangle*) rectangleWithCGRect:(CGRect) cgRect;

@property (nonatomic) int x;
@property (nonatomic) int y;
@property (nonatomic) int width;
@property (nonatomic) int height;
@property (nonatomic, readonly) RectangleStruct *data;

- (Rectangle*) set:(Rectangle*)value;

- (BOOL) containsX:(int)x y:(int)y;
- (BOOL) containsPoint:(XniPoint*)point;

- (BOOL) equals:(Rectangle*)rectangle;

+ (Rectangle*) empty;

@end


text:
#ifndef CELIX_PUBSUB_UDPMC_COMMON_H
#define CELIX_PUBSUB_UDPMC_COMMON_H

#include <utils.h>

#include "version.h"

typedef struct pubsub_udp_msg_header {
    unsigned int type;
    unsigned char major;
    unsigned char minor;
} pubsub_udp_msg_header_t;

bool psa_udpmc_checkVersion(version_pt msgVersion, pubsub_udp_msg_header_t *hdr);

#endif //CELIX_PUBSUB_UDPMC_COMMON_H


text:
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
/**
******************************************************************************
* @author  Oivind H. Danielsen
* @date    Creation date: 2000-02-02
* @file
* Class definition for FastOS_UNIX_Thread
*****************************************************************************/

#pragma once

#include "thread.h"

class FastOS_UNIX_Thread : public FastOS_ThreadInterface
{
private:
    FastOS_UNIX_Thread(const FastOS_UNIX_Thread &);
    FastOS_UNIX_Thread& operator=(const FastOS_UNIX_Thread &);

protected:
    pthread_t _handle;
    bool _handleValid;

    bool Initialize (int stackSize, int stackGuardSize) override;
    void PreEntry () override;

public:
    static bool InitializeClass ();
    static bool CleanupClass ();

    FastOS_UNIX_Thread(FastOS_ThreadPool *pool)
        : FastOS_ThreadInterface(pool),
          _handle(),
          _handleValid(false)
    {}

    ~FastOS_UNIX_Thread();

    FastOS_ThreadId GetThreadId () const noexcept override;
    static bool CompareThreadIds (FastOS_ThreadId a, FastOS_ThreadId b);
    static FastOS_ThreadId GetCurrentThreadId ();
};


text:
GraphQL API that wraps the spreadsheet we use for La Superliga (FIFA internal tournament at [SCV](http://scvsoft.com/))

## Usage

`npm start` and go to `/graphiql` to play around. To consume it from a real client, POST to `/graphql`.

`npm run spreadsheet:update` downloads the latest version of [the spreadsheet](https://docs.google.com/spreadsheets/d/1dDsZY2MD7ZYq5xmVcebevu-ZVI4hwlTkhuyBoxAWGe8).


text:
var removerForm;
function apagar(form) {
    var div = document.querySelector(".alerta");
    div.classList.add("visivel");
    var div2 = document.querySelector(".nevoa");
    div2.classList.add("visivel");
    removerForm = form;
    return false;
}
function confirmar() {
    removerForm.submit();
}

function cancelar() {
    removerForm = null;
    var div = document.querySelector(".alerta");
    div.classList.remove("visivel");
    var div2 = document.querySelector(".nevoa");
    div2.classList.remove("visivel");
}


text:
from __future__ import absolute_import

from pypio.workflow.cleanup_functions import CleanupFunctions

__all__ = [
    'CleanupFunctions'
]


text:
using Figlotech.Core;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace Figlotech.Extensions
{
    public static class FiStreamExtensions {
        private static Type[] AllowedTypes = new Type[] {
            typeof(Int16),
            typeof(Int32),
            typeof(Int64),
            typeof(UInt16),
            typeof(UInt32),
            typeof(UInt64),
            typeof(Single),
            typeof(Double),
            typeof(Char),
            typeof(Boolean),
        };
        private static Dictionary<Type, int> AllowedSizes = new Dictionary<Type, int> {
            { typeof(Int16), sizeof(Int16) },
            { typeof(Int32), sizeof(Int32) },
            { typeof(Int64), sizeof(Int64) },
            { typeof(UInt16), sizeof(UInt16) },
            { typeof(UInt32), sizeof(UInt32) },
            { typeof(UInt64), sizeof(UInt64) },
            { typeof(Single), sizeof(Single) },
            { typeof(Double), sizeof(Double) },
            { typeof(Char), sizeof(Char) },
            { typeof(Boolean), sizeof(Boolean) },
        };

        /// <summary>
        /// This copies one stream to the other comparing bytes on each one
        /// Reading the destination stream first to check if its necessary to write
        /// and so saving unnecessary write (may be cool sometimes, for stuff like for file copy)
        /// </summary>
        /// <param name="origin"></param>
        /// <param name="destination"></param>
        public static void EconomicCopyTo(this Stream origin, Stream destination) {
            origin.Seek(0, SeekOrigin.Begin);
            destination.Seek(0, SeekOrigin.Begin);
            var bufferSize = 256 * 1024;
            if(origin.Length < bufferSize * 2) {
                origin.CopyTo(destination);
            }
            var originBuffer = new byte[bufferSize];
            var destinationBuffer = new byte[bufferSize];
            int bytesRead = 0;
            while ((bytesRead = origin.Read(originBuffer, 0, originBuffer.Length)) > 0) {
                destination.Read(destinationBuffer, 0, bytesRead);
                if (originBuffer.SequenceEqual(destinationBuffer)) {
                    // relax
                }
                else {
                    destination.Seek(origin.Position - bytesRead, SeekOrigin.Begin);
                    destination.Write(originBuffer, 0, bytesRead);
                }
            }
        }

        public static T Read<T>(this Stream me) {
            Action err = () => {
                var supportedTypes = String.Join(", ", AllowedTypes.Select(t => t.Name));
                throw new ArgumentException($"Generic type {typeof(T).Name} for FiStreamExtensions.Read<T> is invalid, supported types are: { supportedTypes }");
            };

            if(!AllowedSizes.ContainsKey(typeof(T))) {
                err();
            }
            var len = AllowedSizes[typeof(T)];
            var buff = new byte[len];
            me.Read(buff, 0, len);

            var methods = typeof(BitConverter).GetMethods();
            var method = methods.FirstOrDefault(m => m.Name == $"To{typeof(T).Name}");
            if(method == null) {
                err();
            }
            T retv = (T)method.Invoke(me, new Object[] { buff, 0 });
            return retv;
        }

        public static void Write<T>(this Stream me, T val) {
            if(val is String || val is string) {
                Write(me, val as String, Fi.StandardEncoding);
                return;
            }
            Action err = () => {
                var supportedTypes = String.Join(", ", AllowedTypes.Select(t => t.Name));
                throw new ArgumentException($"Generic type {typeof(T).Name} for FiStreamExtensions.Read<T> is invalid, supported types are: { supportedTypes }");
            };

            if (!AllowedSizes.ContainsKey(typeof(T))) {
                err();
            }
            var len = AllowedSizes[typeof(T)];
            var buff = new byte[len];

            var methods = typeof(BitConverter).GetMethods();
            var method = methods.FirstOrDefault(m => m.Name == $"GetBytes" && m.GetParameters().FirstOrDefault()?.ParameterType == typeof(T));
            if (method == null) {
                err();
            }

            buff = (byte[]) method.Invoke(me, new Object[] { val });
            me.Write(buff, 0, len);
        }

        public static void Write(this Stream me, String text, Encoding encoding = null) {
            if (encoding == null)
                encoding = Fi.StandardEncoding;
            var buff = encoding.GetBytes(text);
            me.Write(buff, 0, buff.Length);
        }
        public static void WriteLine(this Stream me, String text, Encoding encoding = null) {
            me.Write(text+"\n", encoding);
        }
    }
}


text:
'use strict';

const models = require('./index');

/**
 * The properties for updating a docker build step.
 *
 * @extends models['TaskStepUpdateParameters']
 */
class DockerBuildStepUpdateParameters extends models['TaskStepUpdateParameters'] {
  /**
   * Create a DockerBuildStepUpdateParameters.
   * @property {array} [imageNames] The fully qualified image names including
   * the repository and tag.
   * @property {boolean} [isPushEnabled] The value of this property indicates
   * whether the image built should be pushed to the registry or not.
   * @property {boolean} [noCache] The value of this property indicates whether
   * the image cache is enabled or not.
   * @property {string} [dockerFilePath] The Docker file path relative to the
   * source context.
   * @property {array} [argumentsProperty] The collection of override arguments
   * to be used when executing this build step.
   * @property {string} [target] The name of the target build stage for the
   * docker build.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of DockerBuildStepUpdateParameters
   *
   * @returns {object} metadata of DockerBuildStepUpdateParameters
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'Docker',
      type: {
        name: 'Composite',
        polymorphicDiscriminator: {
          serializedName: 'type',
          clientName: 'type'
        },
        uberParent: 'TaskStepUpdateParameters',
        className: 'DockerBuildStepUpdateParameters',
        modelProperties: {
          contextPath: {
            required: false,
            serializedName: 'contextPath',
            type: {
              name: 'String'
            }
          },
          contextAccessToken: {
            required: false,
            serializedName: 'contextAccessToken',
            type: {
              name: 'String'
            }
          },
          type: {
            required: true,
            serializedName: 'type',
            isPolymorphicDiscriminator: true,
            type: {
              name: 'String'
            }
          },
          imageNames: {
            required: false,
            serializedName: 'imageNames',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'StringElementType',
                  type: {
                    name: 'String'
                  }
              }
            }
          },
          isPushEnabled: {
            required: false,
            serializedName: 'isPushEnabled',
            type: {
              name: 'Boolean'
            }
          },
          noCache: {
            required: false,
            serializedName: 'noCache',
            type: {
              name: 'Boolean'
            }
          },
          dockerFilePath: {
            required: false,
            serializedName: 'dockerFilePath',
            type: {
              name: 'String'
            }
          },
          argumentsProperty: {
            required: false,
            serializedName: 'arguments',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'ArgumentElementType',
                  type: {
                    name: 'Composite',
                    className: 'Argument'
                  }
              }
            }
          },
          target: {
            required: false,
            serializedName: 'target',
            type: {
              name: 'String'
            }
          }
        }
      }
    };
  }
}

module.exports = DockerBuildStepUpdateParameters;


text:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.appspot.pistatium.ssmemo.EditActivity">

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scaleType="centerCrop"
        android:src="@drawable/background" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="fill_parent"
        android:layout_margin="@dimen/activity_margin"
        android:alpha="0.8">

        <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:card_view="http://schemas.android.com/apk/res-auto"
            android:layout_width="match_parent"
            android:layout_height="fill_parent"
            card_view:cardCornerRadius="@dimen/corner_radius">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="fill_parent"
                android:padding="@dimen/inner_padding"

                android:orientation="vertical">

                <EditText
                    android:id="@+id/et_input_memo"
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    android:layout_weight="1"
                    android:gravity="top|start"
                    android:singleLine="false"
                    android:lineSpacingMultiplier="1.4"
                    android:autoLink="all"
                    android:textSize="@dimen/main_text_size"
                    android:transitionName="target">

                    <requestFocus />
                </EditText>

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="60dp"
                    android:onClick="onClickDone"
                    android:text="OK" />
            </LinearLayout>

        </android.support.v7.widget.CardView>
    </LinearLayout>
</FrameLayout>


text:
package org.kuali.coeus.propdev.impl.action;

import org.kuali.coeus.propdev.impl.auth.task.ProposalAuthorizer;
import org.kuali.coeus.propdev.impl.core.ProposalDevelopmentDocument;
import org.kuali.kra.infrastructure.TaskName;
import org.kuali.coeus.propdev.impl.auth.task.ProposalTask;
import org.kuali.coeus.propdev.impl.hierarchy.ProposalHierarchyException;
import org.kuali.coeus.propdev.impl.hierarchy.ProposalHierarchyService;
import org.kuali.rice.kew.api.WorkflowDocument;

/**
 * This authorizer determines if the user has the permission
 * to execute any workflow actions.  The isAuthorized method currently
 * only looks to see if the proposal is a child document, and if the parent
 * is enroute it denies the authorization ( hierarchy children cannot be cancelled or disapproved
 * when the parent is enroute.
 */
public class ProposalHierarchyChildWorkflowActionAuthorizer extends ProposalAuthorizer {

    private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(ProposalHierarchyChildWorkflowActionAuthorizer.class);

    private ProposalHierarchyService proposalHierarchyService;
    public  void setProposalHierarchyService (ProposalHierarchyService proposalHierarchyService){
        this.proposalHierarchyService = proposalHierarchyService;
    }
    public  ProposalHierarchyService getProposalHierarchyService (){
        return proposalHierarchyService;
    }

    public boolean isAuthorized(String username, ProposalTask task) {
        boolean authorized = true;
        ProposalDevelopmentDocument doc = task.getDocument();

        if( doc.getDevelopmentProposal().isChild() ) {
            try {
                WorkflowDocument parentWDoc  = getProposalHierarchyService().getParentWorkflowDocument(doc);
                if( task.getTaskName().equals(TaskName.PROPOSAL_HIERARCHY_CHILD_ACKNOWLEDGE_ACTION)) {
                    if( (!parentWDoc.isAcknowledgeRequested()) || parentWDoc.isInitiated() ) authorized = false;
                } else if ( task.getTaskName().equals(TaskName.PROPOSAL_HIERARCHY_CHILD_WORKFLOW_ACTION) ) {
                    if( !parentWDoc.isInitiated()  ) authorized = false;
                }
            } catch (ProposalHierarchyException e) {
                LOG.error( String.format( "Could not find parent workflow document for proposal document number:%s, which claims to be a child. Returning false.",doc.getDocumentHeader().getDocumentNumber()),e);
                authorized = false;
            }
        }

        return authorized;
    }

}


text:
export interface ReferenceRepresentation {
    $ref: string;
}

export type PrimitiveRepresentation = string | boolean | number | null | undefined;

export type ObjectRepresentation = {
    [property: string]: ObjectRepresentation | Array<ObjectRepresentation>
} | PrimitiveRepresentation | ReferenceRepresentation;

export type TreeRepresentation = ObjectRepresentation | Array<ObjectRepresentation>;


text:
package org.lwjgl.openxr;

import javax.annotation.*;

import java.nio.*;

import org.lwjgl.*;
import org.lwjgl.system.*;

import static org.lwjgl.system.Checks.*;
import static org.lwjgl.system.MemoryUtil.*;
import static org.lwjgl.system.MemoryStack.*;

/**
 * Suggested bindings for a interaction profile.
 *
 *
Valid Usage (Implicit)

 *
 *

 *
{@code type} must be {@link XR10#XR_TYPE_INTERACTION_PROFILE_SUGGESTED_BINDING TYPE_INTERACTION_PROFILE_SUGGESTED_BINDING}

 *
{@code next} must be {@code NULL} or a valid pointer to the next structure in a structure chain. See also: {@link XrBindingModificationsKHR}

 *
{@code suggestedBindings} must be a pointer to an array of {@code countSuggestedBindings} valid {@link XrActionSuggestedBinding} structures

 *
The {@code countSuggestedBindings} parameter must be greater than 0

 *

 *
 *
See Also

 *
 *
{@link XrActionSuggestedBinding}, {@link XR10#xrSuggestInteractionProfileBindings SuggestInteractionProfileBindings}

 *
 *
Layout

 *
 *

 * struct XrInteractionProfileSuggestedBinding {
 *     XrStructureType {@link #type};
 *     void const * {@link #next};
 *     XrPath {@link #interactionProfile};
 *     uint32_t {@link #countSuggestedBindings};
 *     {@link XrActionSuggestedBinding XrActionSuggestedBinding} const * {@link #suggestedBindings};
 * }

 */
public class XrInteractionProfileSuggestedBinding extends Struct implements NativeResource {

    /** The struct size in bytes. */
    public static final int SIZEOF;

    /** The struct alignment in bytes. */
    public static final int ALIGNOF;

    /** The struct member offsets. */
    public static final int
        TYPE,
        NEXT,
        INTERACTIONPROFILE,
        COUNTSUGGESTEDBINDINGS,
        SUGGESTEDBINDINGS;

    static {
        Layout layout = __struct(
            __member(4),
            __member(POINTER_SIZE),
            __member(8),
            __member(4),
            __member(POINTER_SIZE)
        );

        SIZEOF = layout.getSize();
        ALIGNOF = layout.getAlignment();

        TYPE = layout.offsetof(0);
        NEXT = layout.offsetof(1);
        INTERACTIONPROFILE = layout.offsetof(2);
        COUNTSUGGESTEDBINDINGS = layout.offsetof(3);
        SUGGESTEDBINDINGS = layout.offsetof(4);
    }

    /**
     * Creates a {@code XrInteractionProfileSuggestedBinding} instance at the current position of the specified {@link ByteBuffer} container. Changes to the buffer's content will be
     * visible to the struct instance and vice versa.
     *
     *
The created instance holds a strong reference to the container object.

     */
    public XrInteractionProfileSuggestedBinding(ByteBuffer container) {
        super(memAddress(container), __checkContainer(container, SIZEOF));
    }

    @Override
    public int sizeof() { return SIZEOF; }

    /** the {@code XrStructureType} of this structure. */
    @NativeType("XrStructureType")
    public int type() { return ntype(address()); }
    /** {@code NULL} or a pointer to the next structure in a structure chain. No such structures are defined in core OpenXR. */
    @NativeType("void const *")
    public long next() { return nnext(address()); }
    /** the {@code XrPath} of an interaction profile. */
    @NativeType("XrPath")
    public long interactionProfile() { return ninteractionProfile(address()); }
    /** the number of suggested bindings in the array pointed to by {@code suggestedBindings}. */
    @NativeType("uint32_t")
    public int countSuggestedBindings() { return ncountSuggestedBindings(address()); }
    /** a pointer to an array of {@link XrActionSuggestedBinding} structures that define all of the application's suggested bindings for the specified interaction profile. */
    @NativeType("XrActionSuggestedBinding const *")
    public XrActionSuggestedBinding.Buffer suggestedBindings() { return nsuggestedBindings(address()); }

    /** Sets the specified value to the {@link #type} field. */
    public XrInteractionProfileSuggestedBinding type(@NativeType("XrStructureType") int value) { ntype(address(), value); return this; }
    /** Sets the {@link XR10#XR_TYPE_INTERACTION_PROFILE_SUGGESTED_BINDING TYPE_INTERACTION_PROFILE_SUGGESTED_BINDING} value to the {@link #type} field. */
    public XrInteractionProfileSuggestedBinding type$Default() { return type(XR10.XR_TYPE_INTERACTION_PROFILE_SUGGESTED_BINDING); }
    /** Sets the specified value to the {@link #next} field. */
    public XrInteractionProfileSuggestedBinding next(@NativeType("void const *") long value) { nnext(address(), value); return this; }
    /** Prepends the specified {@link XrBindingModificationsKHR} value to the {@code next} chain. */
    public XrInteractionProfileSuggestedBinding next(XrBindingModificationsKHR value) { return this.next(value.next(this.next()).address()); }
    /** Sets the specified value to the {@link #interactionProfile} field. */
    public XrInteractionProfileSuggestedBinding interactionProfile(@NativeType("XrPath") long value) { ninteractionProfile(address(), value); return this; }
    /** Sets the address of the specified {@link XrActionSuggestedBinding.Buffer} to the {@link #suggestedBindings} field. */
    public XrInteractionProfileSuggestedBinding suggestedBindings(@NativeType("XrActionSuggestedBinding const *") XrActionSuggestedBinding.Buffer value) { nsuggestedBindings(address(), value); return this; }

    /** Initializes this struct with the specified values. */
    public XrInteractionProfileSuggestedBinding set(
        int type,
        long next,
        long interactionProfile,
        XrActionSuggestedBinding.Buffer suggestedBindings
    ) {
        type(type);
        next(next);
        interactionProfile(interactionProfile);
        suggestedBindings(suggestedBindings);

        return this;
    }

    /**
     * Copies the specified struct data to this struct.
     *
     * @param src the source struct
     *
     * @return this struct
     */
    public XrInteractionProfileSuggestedBinding set(XrInteractionProfileSuggestedBinding src) {
        memCopy(src.address(), address(), SIZEOF);
        return this;
    }

    // -----------------------------------

    /** Returns a new {@code XrInteractionProfileSuggestedBinding} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed. */
    public static XrInteractionProfileSuggestedBinding malloc() {
        return wrap(XrInteractionProfileSuggestedBinding.class, nmemAllocChecked(SIZEOF));
    }

    /** Returns a new {@code XrInteractionProfileSuggestedBinding} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed. */
    public static XrInteractionProfileSuggestedBinding calloc() {
        return wrap(XrInteractionProfileSuggestedBinding.class, nmemCallocChecked(1, SIZEOF));
    }

    /** Returns a new {@code XrInteractionProfileSuggestedBinding} instance allocated with {@link BufferUtils}. */
    public static XrInteractionProfileSuggestedBinding create() {
        ByteBuffer container = BufferUtils.createByteBuffer(SIZEOF);
        return wrap(XrInteractionProfileSuggestedBinding.class, memAddress(container), container);
    }

    /** Returns a new {@code XrInteractionProfileSuggestedBinding} instance for the specified memory address. */
    public static XrInteractionProfileSuggestedBinding create(long address) {
        return wrap(XrInteractionProfileSuggestedBinding.class, address);
    }

    /** Like {@link #create(long) create}, but returns {@code null} if {@code address} is {@code NULL}. */
    @Nullable
    public static XrInteractionProfileSuggestedBinding createSafe(long address) {
        return address == NULL ? null : wrap(XrInteractionProfileSuggestedBinding.class, address);
    }

    /**
     * Returns a new {@link XrInteractionProfileSuggestedBinding.Buffer} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed.
     *
     * @param capacity the buffer capacity
     */
    public static XrInteractionProfileSuggestedBinding.Buffer malloc(int capacity) {
        return wrap(Buffer.class, nmemAllocChecked(__checkMalloc(capacity, SIZEOF)), capacity);
    }

    /**
     * Returns a new {@link XrInteractionProfileSuggestedBinding.Buffer} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed.
     *
     * @param capacity the buffer capacity
     */
    public static XrInteractionProfileSuggestedBinding.Buffer calloc(int capacity) {
        return wrap(Buffer.class, nmemCallocChecked(capacity, SIZEOF), capacity);
    }

    /**
     * Returns a new {@link XrInteractionProfileSuggestedBinding.Buffer} instance allocated with {@link BufferUtils}.
     *
     * @param capacity the buffer capacity
     */
    public static XrInteractionProfileSuggestedBinding.Buffer create(int capacity) {
        ByteBuffer container = __create(capacity, SIZEOF);
        return wrap(Buffer.class, memAddress(container), capacity, container);
    }

    /**
     * Create a {@link XrInteractionProfileSuggestedBinding.Buffer} instance at the specified memory.
     *
     * @param address  the memory address
     * @param capacity the buffer capacity
     */
    public static XrInteractionProfileSuggestedBinding.Buffer create(long address, int capacity) {
        return wrap(Buffer.class, address, capacity);
    }

    /** Like {@link #create(long, int) create}, but returns {@code null} if {@code address} is {@code NULL}. */
    @Nullable
    public static XrInteractionProfileSuggestedBinding.Buffer createSafe(long address, int capacity) {
        return address == NULL ? null : wrap(Buffer.class, address, capacity);
    }

    /**
     * Returns a new {@code XrInteractionProfileSuggestedBinding} instance allocated on the specified {@link MemoryStack}.
     *
     * @param stack the stack from which to allocate
     */
    public static XrInteractionProfileSuggestedBinding malloc(MemoryStack stack) {
        return wrap(XrInteractionProfileSuggestedBinding.class, stack.nmalloc(ALIGNOF, SIZEOF));
    }

    /**
     * Returns a new {@code XrInteractionProfileSuggestedBinding} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero.
     *
     * @param stack the stack from which to allocate
     */
    public static XrInteractionProfileSuggestedBinding calloc(MemoryStack stack) {
        return wrap(XrInteractionProfileSuggestedBinding.class, stack.ncalloc(ALIGNOF, 1, SIZEOF));
    }

    /**
     * Returns a new {@link XrInteractionProfileSuggestedBinding.Buffer} instance allocated on the specified {@link MemoryStack}.
     *
     * @param stack    the stack from which to allocate
     * @param capacity the buffer capacity
     */
    public static XrInteractionProfileSuggestedBinding.Buffer malloc(int capacity, MemoryStack stack) {
        return wrap(Buffer.class, stack.nmalloc(ALIGNOF, capacity * SIZEOF), capacity);
    }

    /**
     * Returns a new {@link XrInteractionProfileSuggestedBinding.Buffer} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero.
     *
     * @param stack    the stack from which to allocate
     * @param capacity the buffer capacity
     */
    public static XrInteractionProfileSuggestedBinding.Buffer calloc(int capacity, MemoryStack stack) {
        return wrap(Buffer.class, stack.ncalloc(ALIGNOF, capacity, SIZEOF), capacity);
    }

    // -----------------------------------

    /** Unsafe version of {@link #type}. */
    public static int ntype(long struct) { return UNSAFE.getInt(null, struct + XrInteractionProfileSuggestedBinding.TYPE); }
    /** Unsafe version of {@link #next}. */
    public static long nnext(long struct) { return memGetAddress(struct + XrInteractionProfileSuggestedBinding.NEXT); }
    /** Unsafe version of {@link #interactionProfile}. */
    public static long ninteractionProfile(long struct) { return UNSAFE.getLong(null, struct + XrInteractionProfileSuggestedBinding.INTERACTIONPROFILE); }
    /** Unsafe version of {@link #countSuggestedBindings}. */
    public static int ncountSuggestedBindings(long struct) { return UNSAFE.getInt(null, struct + XrInteractionProfileSuggestedBinding.COUNTSUGGESTEDBINDINGS); }
    /** Unsafe version of {@link #suggestedBindings}. */
    public static XrActionSuggestedBinding.Buffer nsuggestedBindings(long struct) { return XrActionSuggestedBinding.create(memGetAddress(struct + XrInteractionProfileSuggestedBinding.SUGGESTEDBINDINGS), ncountSuggestedBindings(struct)); }

    /** Unsafe version of {@link #type(int) type}. */
    public static void ntype(long struct, int value) { UNSAFE.putInt(null, struct + XrInteractionProfileSuggestedBinding.TYPE, value); }
    /** Unsafe version of {@link #next(long) next}. */
    public static void nnext(long struct, long value) { memPutAddress(struct + XrInteractionProfileSuggestedBinding.NEXT, value); }
    /** Unsafe version of {@link #interactionProfile(long) interactionProfile}. */
    public static void ninteractionProfile(long struct, long value) { UNSAFE.putLong(null, struct + XrInteractionProfileSuggestedBinding.INTERACTIONPROFILE, value); }
    /** Sets the specified value to the {@code countSuggestedBindings} field of the specified {@code struct}. */
    public static void ncountSuggestedBindings(long struct, int value) { UNSAFE.putInt(null, struct + XrInteractionProfileSuggestedBinding.COUNTSUGGESTEDBINDINGS, value); }
    /** Unsafe version of {@link #suggestedBindings(XrActionSuggestedBinding.Buffer) suggestedBindings}. */
    public static void nsuggestedBindings(long struct, XrActionSuggestedBinding.Buffer value) { memPutAddress(struct + XrInteractionProfileSuggestedBinding.SUGGESTEDBINDINGS, value.address()); ncountSuggestedBindings(struct, value.remaining()); }

    /**
     * Validates pointer members that should not be {@code NULL}.
     *
     * @param struct the struct to validate
     */
    public static void validate(long struct) {
        int countSuggestedBindings = ncountSuggestedBindings(struct);
        long suggestedBindings = memGetAddress(struct + XrInteractionProfileSuggestedBinding.SUGGESTEDBINDINGS);
        check(suggestedBindings);
        validate(suggestedBindings, countSuggestedBindings, XrActionSuggestedBinding.SIZEOF, XrActionSuggestedBinding::validate);
    }

    // -----------------------------------

    /** An array of {@link XrInteractionProfileSuggestedBinding} structs. */
    public static class Buffer extends StructBuffer<XrInteractionProfileSuggestedBinding, Buffer> implements NativeResource {

        private static final XrInteractionProfileSuggestedBinding ELEMENT_FACTORY = XrInteractionProfileSuggestedBinding.create(-1L);

        /**
         * Creates a new {@code XrInteractionProfileSuggestedBinding.Buffer} instance backed by the specified container.
         *
         * Changes to the container's content will be visible to the struct buffer instance and vice versa. The two buffers' position, limit, and mark values
         * will be independent. The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer divided
         * by {@link XrInteractionProfileSuggestedBinding#SIZEOF}, and its mark will be undefined.
         *
         *
The created buffer instance holds a strong reference to the container object.

         */
        public Buffer(ByteBuffer container) {
            super(container, container.remaining() / SIZEOF);
        }

        public Buffer(long address, int cap) {
            super(address, null, -1, 0, cap, cap);
        }

        Buffer(long address, @Nullable ByteBuffer container, int mark, int pos, int lim, int cap) {
            super(address, container, mark, pos, lim, cap);
        }

        @Override
        protected Buffer self() {
            return this;
        }

        @Override
        protected XrInteractionProfileSuggestedBinding getElementFactory() {
            return ELEMENT_FACTORY;
        }

        /** @return the value of the {@link XrInteractionProfileSuggestedBinding#type} field. */
        @NativeType("XrStructureType")
        public int type() { return XrInteractionProfileSuggestedBinding.ntype(address()); }
        /** @return the value of the {@link XrInteractionProfileSuggestedBinding#next} field. */
        @NativeType("void const *")
        public long next() { return XrInteractionProfileSuggestedBinding.nnext(address()); }
        /** @return the value of the {@link XrInteractionProfileSuggestedBinding#interactionProfile} field. */
        @NativeType("XrPath")
        public long interactionProfile() { return XrInteractionProfileSuggestedBinding.ninteractionProfile(address()); }
        /** @return the value of the {@link XrInteractionProfileSuggestedBinding#countSuggestedBindings} field. */
        @NativeType("uint32_t")
        public int countSuggestedBindings() { return XrInteractionProfileSuggestedBinding.ncountSuggestedBindings(address()); }
        /** @return a {@link XrActionSuggestedBinding.Buffer} view of the struct array pointed to by the {@link XrInteractionProfileSuggestedBinding#suggestedBindings} field. */
        @NativeType("XrActionSuggestedBinding const *")
        public XrActionSuggestedBinding.Buffer suggestedBindings() { return XrInteractionProfileSuggestedBinding.nsuggestedBindings(address()); }

        /** Sets the specified value to the {@link XrInteractionProfileSuggestedBinding#type} field. */
        public XrInteractionProfileSuggestedBinding.Buffer type(@NativeType("XrStructureType") int value) { XrInteractionProfileSuggestedBinding.ntype(address(), value); return this; }
        /** Sets the {@link XR10#XR_TYPE_INTERACTION_PROFILE_SUGGESTED_BINDING TYPE_INTERACTION_PROFILE_SUGGESTED_BINDING} value to the {@link XrInteractionProfileSuggestedBinding#type} field. */
        public XrInteractionProfileSuggestedBinding.Buffer type$Default() { return type(XR10.XR_TYPE_INTERACTION_PROFILE_SUGGESTED_BINDING); }
        /** Sets the specified value to the {@link XrInteractionProfileSuggestedBinding#next} field. */
        public XrInteractionProfileSuggestedBinding.Buffer next(@NativeType("void const *") long value) { XrInteractionProfileSuggestedBinding.nnext(address(), value); return this; }
        /** Prepends the specified {@link XrBindingModificationsKHR} value to the {@code next} chain. */
        public XrInteractionProfileSuggestedBinding.Buffer next(XrBindingModificationsKHR value) { return this.next(value.next(this.next()).address()); }
        /** Sets the specified value to the {@link XrInteractionProfileSuggestedBinding#interactionProfile} field. */
        public XrInteractionProfileSuggestedBinding.Buffer interactionProfile(@NativeType("XrPath") long value) { XrInteractionProfileSuggestedBinding.ninteractionProfile(address(), value); return this; }
        /** Sets the address of the specified {@link XrActionSuggestedBinding.Buffer} to the {@link XrInteractionProfileSuggestedBinding#suggestedBindings} field. */
        public XrInteractionProfileSuggestedBinding.Buffer suggestedBindings(@NativeType("XrActionSuggestedBinding const *") XrActionSuggestedBinding.Buffer value) { XrInteractionProfileSuggestedBinding.nsuggestedBindings(address(), value); return this; }

    }

}


text:
"""Example use of jupyter_kernel_test, with tests for IPython."""

import unittest
import jupyter_kernel_test as jkt

class BashKernelTests(jkt.KernelTests):
    kernel_name = "calysto_bash"

    language_name = "bash"

    code_hello_world = "echo 'hello, world'"

    completion_samples = [
        {
            'text': 'fdis',
            'matches': {'fdisk'},
        },
    ]

    code_page_something = "ls?"

if __name__ == '__main__':
    unittest.main()