text:
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/cloud/vpcaccess/v1/vpc_access.proto

package com.google.cloud.vpcaccess.v1;

public final class VpcAccessProto {
  private VpcAccessProto() {}

  public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {}

  public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) {
    registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry);
  }

  static final com.google.protobuf.Descriptors.Descriptor
      internal_static_google_cloud_vpcaccess_v1_Connector_descriptor;
  static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internal_static_google_cloud_vpcaccess_v1_Connector_fieldAccessorTable;
  static final com.google.protobuf.Descriptors.Descriptor
      internal_static_google_cloud_vpcaccess_v1_Connector_Subnet_descriptor;
  static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internal_static_google_cloud_vpcaccess_v1_Connector_Subnet_fieldAccessorTable;
  static final com.google.protobuf.Descriptors.Descriptor
      internal_static_google_cloud_vpcaccess_v1_CreateConnectorRequest_descriptor;
  static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internal_static_google_cloud_vpcaccess_v1_CreateConnectorRequest_fieldAccessorTable;
  static final com.google.protobuf.Descriptors.Descriptor
      internal_static_google_cloud_vpcaccess_v1_GetConnectorRequest_descriptor;
  static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internal_static_google_cloud_vpcaccess_v1_GetConnectorRequest_fieldAccessorTable;
  static final com.google.protobuf.Descriptors.Descriptor
      internal_static_google_cloud_vpcaccess_v1_ListConnectorsRequest_descriptor;
  static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internal_static_google_cloud_vpcaccess_v1_ListConnectorsRequest_fieldAccessorTable;
  static final com.google.protobuf.Descriptors.Descriptor
      internal_static_google_cloud_vpcaccess_v1_ListConnectorsResponse_descriptor;
  static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internal_static_google_cloud_vpcaccess_v1_ListConnectorsResponse_fieldAccessorTable;
  static final com.google.protobuf.Descriptors.Descriptor
      internal_static_google_cloud_vpcaccess_v1_DeleteConnectorRequest_descriptor;
  static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internal_static_google_cloud_vpcaccess_v1_DeleteConnectorRequest_fieldAccessorTable;
  static final com.google.protobuf.Descriptors.Descriptor
      internal_static_google_cloud_vpcaccess_v1_OperationMetadata_descriptor;
  static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internal_static_google_cloud_vpcaccess_v1_OperationMetadata_fieldAccessorTable;

  public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
    return descriptor;
  }

  private static com.google.protobuf.Descriptors.FileDescriptor descriptor;

  static {
    java.lang.String[] descriptorData = {
      "\n*google/cloud/vpcaccess/v1/vpc_access.p"
          + "roto\022\031google.cloud.vpcaccess.v1\032\034google/"
          + "api/annotations.proto\032\027google/api/client"
          + ".proto\032\037google/api/field_behavior.proto\032"
          + "\031google/api/resource.proto\032#google/longr"
          + "unning/operations.proto\032\037google/protobuf"
          + "/timestamp.proto\"\310\004\n\tConnector\022\014\n\004name\030\001"
          + " \001(\t\022\017\n\007network\030\002 \001(\t\022\025\n\rip_cidr_range\030\003"
          + " \001(\t\022>\n\005state\030\004 \001(\0162*.google.cloud.vpcac"
          + "cess.v1.Connector.StateB\003\340A\003\022\026\n\016min_thro"
          + "ughput\030\005 \001(\005\022\026\n\016max_throughput\030\006 \001(\005\022\037\n\022"
          + "connected_projects\030\007 \003(\tB\003\340A\003\022;\n\006subnet\030"
          + "\010 \001(\0132+.google.cloud.vpcaccess.v1.Connec"
          + "tor.Subnet\022\024\n\014machine_type\030\n \001(\t\022\025\n\rmin_"
          + "instances\030\013 \001(\005\022\025\n\rmax_instances\030\014 \001(\005\032*"
          + "\n\006Subnet\022\014\n\004name\030\001 \001(\t\022\022\n\nproject_id\030\002 \001"
          + "(\t\"^\n\005State\022\025\n\021STATE_UNSPECIFIED\020\000\022\t\n\005RE"
          + "ADY\020\001\022\014\n\010CREATING\020\002\022\014\n\010DELETING\020\003\022\t\n\005ERR"
          + "OR\020\004\022\014\n\010UPDATING\020\005:g\352Ad\n\"vpcaccess.googl"
          + "eapis.com/Connector\022>projects/{project}/"
          + "locations/{location}/connectors/{connect"
          + "or}\"\254\001\n\026CreateConnectorRequest\0229\n\006parent"
          + "\030\001 \001(\tB)\340A\002\372A#\n!locations.googleapis.com"
          + "/Location\022\031\n\014connector_id\030\002 \001(\tB\003\340A\002\022<\n\t"
          + "connector\030\003 \001(\0132$.google.cloud.vpcaccess"
          + ".v1.ConnectorB\003\340A\002\"O\n\023GetConnectorReques"
          + "t\0228\n\004name\030\001 \001(\tB*\340A\002\372A$\n\"vpcaccess.googl"
          + "eapis.com/Connector\"y\n\025ListConnectorsReq"
          + "uest\0229\n\006parent\030\001 \001(\tB)\340A\002\372A#\n!locations."
          + "googleapis.com/Location\022\021\n\tpage_size\030\002 \001"
          + "(\005\022\022\n\npage_token\030\003 \001(\t\"k\n\026ListConnectors"
          + "Response\0228\n\nconnectors\030\001 \003(\0132$.google.cl"
          + "oud.vpcaccess.v1.Connector\022\027\n\017next_page_"
          + "token\030\002 \001(\t\"R\n\026DeleteConnectorRequest\0228\n"
          + "\004name\030\001 \001(\tB*\340A\002\372A$\n\"vpcaccess.googleapi"
          + "s.com/Connector\"\315\001\n\021OperationMetadata\022\023\n"
          + "\006method\030\001 \001(\tB\003\340A\003\0224\n\013create_time\030\002 \001(\0132"
          + "\032.google.protobuf.TimestampB\003\340A\003\0221\n\010end_"
          + "time\030\003 \001(\0132\032.google.protobuf.TimestampB\003"
          + "\340A\003\022:\n\006target\030\005 \001(\tB*\340A\003\372A$\n\"vpcaccess.g"
          + "oogleapis.com/Connector2\374\006\n\020VpcAccessSer"
          + "vice\022\350\001\n\017CreateConnector\0221.google.cloud."
          + "vpcaccess.v1.CreateConnectorRequest\032\035.go"
          + "ogle.longrunning.Operation\"\202\001\202\323\344\223\002;\"./v1"
          + "/{parent=projects/*/locations/*}/connect"
          + "ors:\tconnector\332A\035parent,connector_id,con"
          + "nector\312A\036\n\tConnector\022\021OperationMetadata\022"
          + "\243\001\n\014GetConnector\022..google.cloud.vpcacces"
          + "s.v1.GetConnectorRequest\032$.google.cloud."
          + "vpcaccess.v1.Connector\"=\202\323\344\223\0020\022./v1/{nam"
          + "e=projects/*/locations/*/connectors/*}\332A"
          + "\004name\022\266\001\n\016ListConnectors\0220.google.cloud."
          + "vpcaccess.v1.ListConnectorsRequest\0321.goo"
          + "gle.cloud.vpcaccess.v1.ListConnectorsRes"
          + "ponse\"?\202\323\344\223\0020\022./v1/{parent=projects/*/lo"
          + "cations/*}/connectors\332A\006parent\022\317\001\n\017Delet"
          + "eConnector\0221.google.cloud.vpcaccess.v1.D"
          + "eleteConnectorRequest\032\035.google.longrunni"
          + "ng.Operation\"j\202\323\344\223\0020*./v1/{name=projects"
          + "/*/locations/*/connectors/*}\332A\004name\312A*\n\025"
          + "google.protobuf.Empty\022\021OperationMetadata"
          + "\032L\312A\030vpcaccess.googleapis.com\322A.https://"
          + "www.googleapis.com/auth/cloud-platformB\314"
          + "\001\n\035com.google.cloud.vpcaccess.v1B\016VpcAcc"
          + "essProtoP\001ZBgoogle.golang.org/genproto/g"
          + "oogleapis/cloud/vpcaccess/v1;vpcaccess\252\002"
          + "\031Google.Cloud.VpcAccess.V1\312\002\031Google\\Clou"
          + "d\\VpcAccess\\V1\352\002\034Google::Cloud::VpcAcces"
          + "s::V1b\006proto3"
    };
    descriptor =
        com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom(
            descriptorData,
            new com.google.protobuf.Descriptors.FileDescriptor[] {
              com.google.api.AnnotationsProto.getDescriptor(),
              com.google.api.ClientProto.getDescriptor(),
              com.google.api.FieldBehaviorProto.getDescriptor(),
              com.google.api.ResourceProto.getDescriptor(),
              com.google.longrunning.OperationsProto.getDescriptor(),
              com.google.protobuf.TimestampProto.getDescriptor(),
            });
    internal_static_google_cloud_vpcaccess_v1_Connector_descriptor =
        getDescriptor().getMessageTypes().get(0);
    internal_static_google_cloud_vpcaccess_v1_Connector_fieldAccessorTable =
        new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
            internal_static_google_cloud_vpcaccess_v1_Connector_descriptor,
            new java.lang.String[] {
              "Name",
              "Network",
              "IpCidrRange",
              "State",
              "MinThroughput",
              "MaxThroughput",
              "ConnectedProjects",
              "Subnet",
              "MachineType",
              "MinInstances",
              "MaxInstances",
            });
    internal_static_google_cloud_vpcaccess_v1_Connector_Subnet_descriptor =
        internal_static_google_cloud_vpcaccess_v1_Connector_descriptor.getNestedTypes().get(0);
    internal_static_google_cloud_vpcaccess_v1_Connector_Subnet_fieldAccessorTable =
        new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
            internal_static_google_cloud_vpcaccess_v1_Connector_Subnet_descriptor,
            new java.lang.String[] {
              "Name", "ProjectId",
            });
    internal_static_google_cloud_vpcaccess_v1_CreateConnectorRequest_descriptor =
        getDescriptor().getMessageTypes().get(1);
    internal_static_google_cloud_vpcaccess_v1_CreateConnectorRequest_fieldAccessorTable =
        new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
            internal_static_google_cloud_vpcaccess_v1_CreateConnectorRequest_descriptor,
            new java.lang.String[] {
              "Parent", "ConnectorId", "Connector",
            });
    internal_static_google_cloud_vpcaccess_v1_GetConnectorRequest_descriptor =
        getDescriptor().getMessageTypes().get(2);
    internal_static_google_cloud_vpcaccess_v1_GetConnectorRequest_fieldAccessorTable =
        new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
            internal_static_google_cloud_vpcaccess_v1_GetConnectorRequest_descriptor,
            new java.lang.String[] {
              "Name",
            });
    internal_static_google_cloud_vpcaccess_v1_ListConnectorsRequest_descriptor =
        getDescriptor().getMessageTypes().get(3);
    internal_static_google_cloud_vpcaccess_v1_ListConnectorsRequest_fieldAccessorTable =
        new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
            internal_static_google_cloud_vpcaccess_v1_ListConnectorsRequest_descriptor,
            new java.lang.String[] {
              "Parent", "PageSize", "PageToken",
            });
    internal_static_google_cloud_vpcaccess_v1_ListConnectorsResponse_descriptor =
        getDescriptor().getMessageTypes().get(4);
    internal_static_google_cloud_vpcaccess_v1_ListConnectorsResponse_fieldAccessorTable =
        new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
            internal_static_google_cloud_vpcaccess_v1_ListConnectorsResponse_descriptor,
            new java.lang.String[] {
              "Connectors", "NextPageToken",
            });
    internal_static_google_cloud_vpcaccess_v1_DeleteConnectorRequest_descriptor =
        getDescriptor().getMessageTypes().get(5);
    internal_static_google_cloud_vpcaccess_v1_DeleteConnectorRequest_fieldAccessorTable =
        new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
            internal_static_google_cloud_vpcaccess_v1_DeleteConnectorRequest_descriptor,
            new java.lang.String[] {
              "Name",
            });
    internal_static_google_cloud_vpcaccess_v1_OperationMetadata_descriptor =
        getDescriptor().getMessageTypes().get(6);
    internal_static_google_cloud_vpcaccess_v1_OperationMetadata_fieldAccessorTable =
        new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
            internal_static_google_cloud_vpcaccess_v1_OperationMetadata_descriptor,
            new java.lang.String[] {
              "Method", "CreateTime", "EndTime", "Target",
            });
    com.google.protobuf.ExtensionRegistry registry =
        com.google.protobuf.ExtensionRegistry.newInstance();
    registry.add(com.google.api.ClientProto.defaultHost);
    registry.add(com.google.api.FieldBehaviorProto.fieldBehavior);
    registry.add(com.google.api.AnnotationsProto.http);
    registry.add(com.google.api.ClientProto.methodSignature);
    registry.add(com.google.api.ClientProto.oauthScopes);
    registry.add(com.google.api.ResourceProto.resource);
    registry.add(com.google.api.ResourceProto.resourceReference);
    registry.add(com.google.longrunning.OperationsProto.operationInfo);
    com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor(
        descriptor, registry);
    com.google.api.AnnotationsProto.getDescriptor();
    com.google.api.ClientProto.getDescriptor();
    com.google.api.FieldBehaviorProto.getDescriptor();
    com.google.api.ResourceProto.getDescriptor();
    com.google.longrunning.OperationsProto.getDescriptor();
    com.google.protobuf.TimestampProto.getDescriptor();
  }

  // @@protoc_insertion_point(outer_class_scope)
}


text:
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models

class Migration(SchemaMigration):

    def forwards(self, orm):
        # Removing unique constraint on 'UserSocialAuth', fields ['provider', 'uid']
        db.delete_unique(u'social_auth_usersocialauth', ['provider', 'uid'])

        # Adding unique constraint on 'UserSocialAuth', fields ['provider', 'uid', 'user']
        db.create_unique(u'social_auth_usersocialauth', ['provider', 'uid', 'user_id'])

    def backwards(self, orm):
        # Removing unique constraint on 'UserSocialAuth', fields ['provider', 'uid', 'user']
        db.delete_unique(u'social_auth_usersocialauth', ['provider', 'uid', 'user_id'])

        # Adding unique constraint on 'UserSocialAuth', fields ['provider', 'uid']
        db.create_unique(u'social_auth_usersocialauth', ['provider', 'uid'])

    models = {
        'sentry.user': {
            'Meta': {'object_name': 'User', 'db_table': "'auth_user'"},
            'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
            'id': ('sentry.db.models.fields.bounded.BoundedAutoField', [], {'primary_key': 'True'}),
            'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
            'is_managed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'is_password_expired': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
            'last_password_change': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '200', 'db_column': "'first_name'", 'blank': 'True'}),
            'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
            'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'})
        },
        'social_auth.usersocialauth': {
            'Meta': {'unique_together': "(('provider', 'uid', 'user'),)", 'object_name': 'UserSocialAuth'},
            'extra_data': ('social_auth.fields.JSONField', [], {'default': "'{}'"}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'provider': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
            'uid': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
            'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'social_auth'", 'to': "orm['sentry.User']"})
        }
    }

    complete_apps = ['social_auth']

redpajama_set_name: RedPajamaGithub


text:
from __future__ import unicode_literals

from django.db import models, migrations

class Migration(migrations.Migration):

    dependencies = [
        ('cms_pages', '0009_auto_20150723_0222'),
    ]

    operations = [
        migrations.AddField(
            model_name='newspage',
            name='special_case',
            field=models.BooleanField(default=False, db_index=True),
        ),
    ]


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

using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.Azure.Test;
using Microsoft.WindowsAzure.Management;
using Microsoft.WindowsAzure.Management.Compute;
using Microsoft.WindowsAzure.Management.Network;
using Microsoft.WindowsAzure.Management.Storage;
using Microsoft.WindowsAzure.Commands.Utilities.Common;
using Xunit;
using Microsoft.Azure.Commands.Common.Authentication;
using Xunit.Abstractions;
using Microsoft.WindowsAzure.ServiceManagemenet.Common.Models;

namespace Microsoft.WindowsAzure.Commands.ScenarioTest
{
    public class SqlIaaSExtensionTests
    {
        private EnvironmentSetupHelper helper = new EnvironmentSetupHelper();

        public SqlIaaSExtensionTests(ITestOutputHelper output)
        {
            XunitTracingInterceptor.AddToContext(new XunitTracingInterceptor(output));
        }

        [Fact]
        [Trait(Category.AcceptanceType, Category.CheckIn)]
        [Trait(Category.AcceptanceType, Category.BVT)]
        public void TestGetAzureVMSqlIaaSExtension()
        {
            this.RunPowerShellTest("Test-GetAzureVMSqlIaaSExtension");
        }

        protected void SetupManagementClients()
        {
            var rdfeTestFactory = new RDFETestEnvironmentFactory();
            var managementClient = TestBase.GetServiceClient<ManagementClient>(rdfeTestFactory);
            var computeClient = TestBase.GetServiceClient<ComputeManagementClient>(rdfeTestFactory);
            var networkClient = TestBase.GetServiceClient<NetworkManagementClient>(rdfeTestFactory);
            var storageClient = TestBase.GetServiceClient<StorageManagementClient>(rdfeTestFactory);

            helper.SetupSomeOfManagementClients(
                managementClient,
                computeClient,
                networkClient,
                storageClient);
        }

        protected void RunPowerShellTest(params string[] scripts)
        {
            using (UndoContext context = UndoContext.Current)
            {
                context.Start(TestUtilities.GetCallingClass(1), TestUtilities.GetCurrentMethodName(2));

                SetupManagementClients();

                var modules = new List<string>
                {
                    "Resources\\SqlIaaSExtension\\SqlIaaSExtensionTests.ps1",
                    "Resources\\ServiceManagement\\Common.ps1",
                    ".\\Assert.ps1",
                    @"..\..\..\..\..\Package\Debug\ServiceManagement\Azure\Compute\AzurePreview.psd1"
                };

                helper.SetupEnvironment(AzureModule.AzureServiceManagement);
                helper.SetupModules(AzureModule.AzureServiceManagement, modules.ToArray());

                var scriptEnvPath = new List<string>();
                scriptEnvPath.Add(
                    string.Format(
                    "$env:PSModulePath=\"{0};$env:PSModulePath\"",
                    @"..\..\..\..\..\Package\Debug\ServiceManagement\Azure\Compute".AsAbsoluteLocation()));

                helper.RunPowerShellTest(scriptEnvPath, scripts);
            }
        }
    }
}


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

package android.support.customtabs;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

/**
 * A BroadcastReceiver that handles the Action Intent from the Custom Tab and fires a Share Intent.
 */
public class ShareBroadcastReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        String url = intent.getDataString();

        if (url != null) {
            Intent shareIntent = new Intent(Intent.ACTION_SEND);
            shareIntent.setType("text/plain");
            shareIntent.putExtra(Intent.EXTRA_TEXT, url);

            Intent chooserIntent = Intent.createChooser(shareIntent, "Share url");
            chooserIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

            context.startActivity(chooserIntent);
        }
    }
}


text:
export function createConstants(...constants) {
  return constants.reduce((acc, constant) => {
    acc[constant] = constant;
    return acc;
  }, {});
}


text:
package org.kuali.kfs.fp.document.validation.impl;

import static org.kuali.kfs.sys.document.validation.impl.AccountingDocumentRuleBaseConstants.ERROR_PATH.DOCUMENT_ERROR_PREFIX;

import org.kuali.kfs.fp.document.CashReceiptDocument;
import org.kuali.kfs.fp.document.CashReceiptFamilyBase;
import org.kuali.kfs.sys.KFSKeyConstants;
import org.kuali.kfs.sys.KFSPropertyConstants;
import org.kuali.kfs.sys.document.validation.GenericValidation;
import org.kuali.kfs.sys.document.validation.event.AttributedDocumentEvent;
import org.kuali.rice.core.api.util.type.KualiDecimal;
import org.kuali.rice.krad.util.GlobalVariables;

/**
 * Validation for the Cash Receipt family of documents that checks the total amount of the document.
 */
public class CashReceiptFamilyDocumentTotalValidation extends GenericValidation {
    private CashReceiptFamilyBase cashReceiptFamilyDocumentForValidation;

    /**
     * For Cash Receipt documents, the document is balanced if the sum total of checks and cash and coin equals the sum total of the
     * accounting lines. In addition, the sum total of checks and cash and coin must be greater than zero.
     *
     * @see org.kuali.kfs.sys.document.validation.Validation#validate(org.kuali.kfs.sys.document.validation.event.AttributedDocumentEvent)
     */
    public boolean validate(AttributedDocumentEvent event) {
        // make sure that cash reconciliation total is greater than zero
        boolean isValid = getCashReceiptFamilyDocumentForValidation().getTotalDollarAmount().compareTo(KualiDecimal.ZERO) > 0;
        if (!isValid) {
            GlobalVariables.getMessageMap().putError(DOCUMENT_ERROR_PREFIX + KFSPropertyConstants.SUM_TOTAL_AMOUNT, KFSKeyConstants.CashReceipt.ERROR_DOCUMENT_CASH_RECEIPT_NO_CASH_RECONCILIATION_TOTAL);
        }

        if (isValid) {
            // make sure the document is in balance
            isValid = getCashReceiptFamilyDocumentForValidation().getSourceTotal().compareTo(getCashReceiptFamilyDocumentForValidation().getTotalDollarAmount().subtract(
                    ((CashReceiptDocument)getCashReceiptFamilyDocumentForValidation()).getTotalChangeAmount())) == 0;

            if (!isValid) {
                GlobalVariables.getMessageMap().putError(DOCUMENT_ERROR_PREFIX + KFSPropertyConstants.SUM_TOTAL_AMOUNT, KFSKeyConstants.CashReceipt.ERROR_DOCUMENT_CASH_RECEIPT_BALANCE);
            }
        }

        return isValid;
    }

    /**
     * Gets the cashReceiptFamilyDocumentForValidation attribute.
     * @return Returns the cashReceiptFamilyDocumentForValidation.
     */
    public CashReceiptFamilyBase getCashReceiptFamilyDocumentForValidation() {
        return cashReceiptFamilyDocumentForValidation;
    }

    /**
     * Sets the cashReceiptFamilyDocumentForValidation attribute value.
     * @param cashReceiptFamilyDocumentForValidation The cashReceiptFamilyDocumentForValidation to set.
     */
    public void setCashReceiptFamilyDocumentForValidation(CashReceiptFamilyBase cashReceiptFamilyDocumentForValidation) {
        this.cashReceiptFamilyDocumentForValidation = cashReceiptFamilyDocumentForValidation;
    }
}


text:
import {Component, Input} from '@angular/core';

import {TabSetComponent} from './tabset.component';

@Component({
    selector: 'tab',
    template:
    `<div [hidden]="!active">
    <ng-content></ng-content>
</div>`
})
export class TabComponent {

    @Input() heading: string;
    active: boolean = false;

    constructor(tabs: TabSetComponent) {
        tabs.addTab(this);
    }

    getHeading(): string {
        return this.heading;
    }

    getClass(): string {
        if (this.active) {
            return "nav-link active";
        } else {
            return "nav-link";
        }
    }
}


text:
package com.intellij.openapi.externalSystem.service.project.manage;

import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.externalSystem.model.DataNode;
import com.intellij.openapi.externalSystem.model.project.*;
import com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProvider;
import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil;
import com.intellij.openapi.externalSystem.util.ExternalSystemConstants;
import com.intellij.openapi.externalSystem.util.Order;
import com.intellij.openapi.module.ModifiableModuleModel;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectBundle;
import com.intellij.openapi.roots.*;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.ObjectUtils;
import com.intellij.util.PathUtil;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.ContainerUtilRt;
import com.intellij.util.containers.MultiMap;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.*;

/**
 * @author Denis Zhdanov
 * @since 4/14/13 11:21 PM
 */
@Order(ExternalSystemConstants.BUILTIN_SERVICE_ORDER)
public abstract class AbstractDependencyDataService<E extends AbstractDependencyData<?>, I extends ExportableOrderEntry>
  extends AbstractProjectDataService<E, I> {

  private static final Logger LOG = Logger.getInstance(AbstractDependencyDataService.class.getName());

  @Override
  public void importData(@NotNull Collection<DataNode<E>> toImport,
                         @Nullable ProjectData projectData,
                         @NotNull Project project,
                         @NotNull IdeModifiableModelsProvider modelsProvider) {
    if (toImport.isEmpty()) {
      return;
    }

    MultiMap<DataNode<ModuleData>, DataNode<E>> byModule = ExternalSystemApiUtil.groupBy(toImport, ModuleData.class);
    for (Map.Entry<DataNode<ModuleData>, Collection<DataNode<E>>> entry : byModule.entrySet()) {
      final DataNode<ModuleData> moduleDataNode = entry.getKey();
      Module module = modelsProvider.findIdeModule(moduleDataNode.getData());
      if (module == null) {
        LOG.warn(String.format(
          "Can't import dependencies %s. Reason: target module (%s) is not found at the ide and can't be imported",
          entry.getValue(), moduleDataNode
        ));
        continue;
      }

      final Map<OrderEntry, OrderAware> moduleDependenciesOrder = importData(entry.getValue(), module, modelsProvider);
      final Map<OrderEntry, OrderAware> orderEntryDataMap = moduleDataNode.getUserData(AbstractModuleDataService.ORDERED_DATA_MAP_KEY);
      if(orderEntryDataMap != null) {
        orderEntryDataMap.putAll(moduleDependenciesOrder);
      } else {
        moduleDataNode.putUserData(AbstractModuleDataService.ORDERED_DATA_MAP_KEY, moduleDependenciesOrder);
      }
    }
  }

  protected abstract Map<OrderEntry, OrderAware> importData(@NotNull Collection<DataNode<E>> nodesToImport,
                                                            @NotNull Module module,
                                                            @NotNull IdeModifiableModelsProvider modelsProvider);

  @NotNull
  @Override
  public Computable<Collection<I>> computeOrphanData(@NotNull final Collection<DataNode<E>> toImport,
                                                     @NotNull final ProjectData projectData,
                                                     @NotNull final Project project,
                                                     @NotNull final IdeModifiableModelsProvider modelsProvider) {
    return () -> {
      MultiMap<String /*module name*/, String /*dep name*/> byModuleName = MultiMap.create();
      for (DataNode<E> node : toImport) {
        final AbstractDependencyData data = node.getData();
        Module ownerModule = modelsProvider.findIdeModule(data.getOwnerModule());
        assert ownerModule != null;
        String depName;
        if(data instanceof ModuleDependencyData) {
          Module targetModule = modelsProvider.findIdeModule(((ModuleDependencyData)data).getTarget());
          assert targetModule != null;
          depName = targetModule.getName();
        } else {
          depName = getInternalName(data);
        }
        byModuleName.putValue(ownerModule.getName(), depName);
      }

      final ModifiableModuleModel modifiableModuleModel = modelsProvider.getModifiableModuleModel();
      List<I> orphanEntries = ContainerUtil.newSmartList();
      for (Module module : modelsProvider.getModules(projectData)) {
        for (OrderEntry entry : modelsProvider.getOrderEntries(module)) {
          // do not remove recently created library w/o name
          if (entry instanceof LibraryOrderEntry &&
              ((LibraryOrderEntry)entry).getLibraryName() == null &&
              entry.getUrls(OrderRootType.CLASSES).length == 0) {
            continue;
          }
          if (getOrderEntryType().isInstance(entry)) {
            final String moduleName = ObjectUtils.chooseNotNull(modifiableModuleModel.getNewName(entry.getOwnerModule()), entry.getOwnerModule().getName()) ;
            //noinspection unchecked
            if (!byModuleName.get(moduleName).contains(getOrderEntryName(modelsProvider, (I)entry))) {
              //noinspection unchecked
              orphanEntries.add((I)entry);
            }
          }
        }
      }

      return orphanEntries;
    };
  }

  @NotNull
  protected abstract Class<I> getOrderEntryType();

  protected String getOrderEntryName(@NotNull IdeModifiableModelsProvider modelsProvider, @NotNull I orderEntry) {
    return orderEntry.getPresentableName();
  }

  @Override
  public void removeData(@NotNull Computable<Collection<I>> toRemoveComputable,
                         @NotNull Collection<DataNode<E>> toIgnore,
                         @NotNull ProjectData projectData,
                         @NotNull Project project,
                         @NotNull IdeModifiableModelsProvider modelsProvider) {
    Map<Module, Collection<ExportableOrderEntry>> byModule = groupByModule(toRemoveComputable.compute());
    for (Map.Entry<Module, Collection<ExportableOrderEntry>> entry : byModule.entrySet()) {
      removeData(entry.getValue(), entry.getKey(), modelsProvider);
    }
  }

  @NotNull
  private static Map<Module, Collection<ExportableOrderEntry>> groupByModule(@NotNull Collection<? extends ExportableOrderEntry> data) {
    Map<Module, Collection<ExportableOrderEntry>> result = ContainerUtilRt.newHashMap();
    for (ExportableOrderEntry entry : data) {
      Collection<ExportableOrderEntry> entries = result.get(entry.getOwnerModule());
      if (entries == null) {
        result.put(entry.getOwnerModule(), entries = ContainerUtilRt.newArrayList());
      }
      entries.add(entry);
    }
    return result;
  }

  protected void removeData(@NotNull Collection<? extends ExportableOrderEntry> toRemove,
                            @NotNull Module module,
                            @NotNull IdeModifiableModelsProvider modelsProvider) {
    if (toRemove.isEmpty()) {
      return;
    }
    final ModifiableRootModel modifiableRootModel = modelsProvider.getModifiableRootModel(module);
    for (final ExportableOrderEntry dependency : toRemove) {
      modifiableRootModel.removeOrderEntry(dependency);
    }
  }

  private static String getInternalName(final AbstractDependencyData data) {
    if (data instanceof LibraryDependencyData) {
      final String name = data.getInternalName();
      if (StringUtil.isNotEmpty(name)) {
        return name;
      }
      else {
        Set<String> paths = ((LibraryDependencyData)data).getTarget().getPaths(LibraryPathType.BINARY);
        if (!paths.isEmpty()) {
          String url = paths.iterator().next();
          return PathUtil.toPresentableUrl(url);
        }
        else {
          return ProjectBundle.message("library.empty.library.item");
        }
      }
    }
    return data.getInternalName();
  }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android">

    <Button
        android:id="@+id/onboarding_create_account_button"
        style="@style/button_progressive"
        android:layout_marginBottom="8dp"
        android:layout_marginTop="8dp"
        android:minHeight="48dp"
        android:text="@string/create_account_button"
        android:textSize="20sp" />

    <Button
        android:id="@+id/onboarding_login_button"
        style="@style/button_secondary"
        android:layout_marginBottom="8dp"
        android:layout_marginTop="8dp"
        android:minHeight="48dp"
        android:text="@string/create_account_login_link"
        android:textSize="16sp" />

    <TextView
        android:id="@+id/onboarding_skip_link"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|center_horizontal"
        android:minHeight="48dp"
        android:padding="8dp"
        android:text="@string/skip"
        android:textColor="@color/onboarding_skip_gray"
        android:textSize="16sp" />

</merge>


text:
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using System.Text;
using System.IO;

namespace Amazon.S3.Model
{
    /// <summary>
    /// Specifies an object key and optional object version.
    /// </summary>
    public class KeyVersion
    {

        private string key;
        private string versionId;

        /// <summary>
        /// Key name of the object to delete.
        ///
        /// </summary>
        public string Key
        {
            get { return this.key; }
            set { this.key = value; }
        }

        // Check to see if Key property is set
        internal bool IsSetKey()
        {
            return this.key != null;
        }

        /// <summary>
        /// VersionId for the specific version of the object to delete.
        ///
        /// </summary>
        public string VersionId
        {
            get { return this.versionId; }
            set { this.versionId = value; }
        }

        // Check to see if VersionId property is set
        internal bool IsSetVersionId()
        {
            return this.versionId != null;
        }
    }
}


text:
SYNONYM

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

#### Published in
J. Linn. Soc. , Bot. 11(no. 56): 557 (1871)

#### Original name
Agaricus cyanescens Berk. & Broome, 1871

### Remarks
null


text:
using System.Runtime.CompilerServices;

namespace System.Html {
	[IgnoreNamespace, Imported(TypeCheckCode = "{$System.Script}.isInstanceOfType({this}, Element) && {this}.tagName === 'IMG'"), ScriptName("Element")]
	public partial class ImageElement : Element {
		[InlineCode("new Image()")]
		public ImageElement() {
		}

		[InlineCode("new Image({width})")]
		public ImageElement(int width) {
		}

		[InlineCode("new Image({width}, {height})")]
		public ImageElement(int width, int height) {
		}

		public void AddEventListener(ImageElementEvents type, Action listener) {
		}

		public void AddEventListener(ImageElementEvents type, Action listener, bool capture) {
		}

		public void AddEventListener(ImageElementEvents type, HtmlEventHandler listener) {
		}

		public void AddEventListener(ImageElementEvents type, HtmlEventHandler listener, bool capture) {
		}

		public void AddEventListener(ImageElementEvents type, HtmlEventHandlerWithTarget<ImageElement> listener) {
		}

		public void AddEventListener(ImageElementEvents type, HtmlEventHandlerWithTarget<ImageElement> listener, bool capture) {
		}

		public void AddEventListener(ImageElementEvents type, IEventListener listener) {
		}

		public void AddEventListener(ImageElementEvents type, IEventListener listener, bool capture) {
		}

		public void AddEventListener(string type, HtmlEventHandlerWithTarget<ImageElement> listener) {
		}

		public void AddEventListener(string type, HtmlEventHandlerWithTarget<ImageElement> listener, bool capture) {
		}

		[IntrinsicProperty]
		public string Align {
			get {
				return null;
			}
			set {
			}
		}

		[IntrinsicProperty]
		public string Alt {
			get {
				return null;
			}
			set {
			}
		}

		[IntrinsicProperty]
		public string Border {
			get {
				return null;
			}
			set {
			}
		}

		[IntrinsicProperty]
		public bool Complete {
			get {
				return false;
			}
		}

		[IntrinsicProperty]
		public string CrossOrigin {
			get {
				return null;
			}
			set {
			}
		}

		[IntrinsicProperty]
		public int Height {
			get {
				return 0;
			}
			set {
			}
		}

		[IntrinsicProperty]
		public int Hspace {
			get {
				return 0;
			}
			set {
			}
		}

		[IntrinsicProperty]
		public bool IsMap {
			get {
				return false;
			}
			set {
			}
		}

		[IntrinsicProperty]
		public string LongDesc {
			get {
				return null;
			}
			set {
			}
		}

		[IntrinsicProperty]
		public string Lowsrc {
			get {
				return null;
			}
			set {
			}
		}

		[IntrinsicProperty]
		public string Name {
			get {
				return null;
			}
			set {
			}
		}

		[IntrinsicProperty]
		public int NaturalHeight {
			get {
				return 0;
			}
		}

		[IntrinsicProperty]
		public int NaturalWidth {
			get {
				return 0;
			}
		}

		public void RemoveEventListener(ImageElementEvents type, Action listener) {
		}

		public void RemoveEventListener(ImageElementEvents type, Action listener, bool capture) {
		}

		public void RemoveEventListener(ImageElementEvents type, HtmlEventHandler listener) {
		}

		public void RemoveEventListener(ImageElementEvents type, HtmlEventHandler listener, bool capture) {
		}

		public void RemoveEventListener(ImageElementEvents type, HtmlEventHandlerWithTarget<ImageElement> listener) {
		}

		public void RemoveEventListener(ImageElementEvents type, HtmlEventHandlerWithTarget<ImageElement> listener, bool capture) {
		}

		public void RemoveEventListener(ImageElementEvents type, IEventListener listener) {
		}

		public void RemoveEventListener(ImageElementEvents type, IEventListener listener, bool capture) {
		}

		public void RemoveEventListener(string type, HtmlEventHandlerWithTarget<ImageElement> listener) {
		}

		public void RemoveEventListener(string type, HtmlEventHandlerWithTarget<ImageElement> listener, bool capture) {
		}

		[IntrinsicProperty]
		public string Src {
			get {
				return null;
			}
			set {
			}
		}

		[IntrinsicProperty]
		public string UseMap {
			get {
				return null;
			}
			set {
			}
		}

		[IntrinsicProperty]
		public int Vspace {
			get {
				return 0;
			}
			set {
			}
		}

		[IntrinsicProperty]
		public int Width {
			get {
				return 0;
			}
			set {
			}
		}

		[IntrinsicProperty]
		public int X {
			get {
				return 0;
			}
		}

		[IntrinsicProperty]
		public int Y {
			get {
				return 0;
			}
		}
	}
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using ReadingList.Logic.Models;

namespace ReadingList.Trello.Helpers
{
    public static class BookMapper
    {
        private static char _bookTitleDelimiter => '-';
        private static char _authorsDelimiter => ',';

        public static Book CreateBook(string bookString, string listLabel)
        {

            var bookArray = bookString.Split(_bookTitleDelimiter);

            return new Book(
                ExtractTitle(bookArray),
                ExtractAuthors(bookArray.Last()), MapBookTypeLabel(listLabel));
        }

        public static Label MapBookTypeLabel(string label)
        {
            try
            {
                return (Label)Enum.Parse(typeof(Label), label, true);
            }
            catch(ArgumentException)
            {
                return Label.Unspecified;
            }
        }

        private static string ExtractTitle(string[] bookArray)
        {
            // To support titles with the title-author delimiter in it, the string needs to be joined on it and last element (after the actual delimiter)
            // containing authors taken out of the array.
            return string.Join(_bookTitleDelimiter.ToString(), bookArray.Take(bookArray.Length - 1)).Trim();
        }

        private static IEnumerable<string> ExtractAuthors(string authors)
        {
            return authors.Split(_authorsDelimiter).Select(author => author.Trim()).ToList();
        }
    }
}


text:
package net.sourceforge.plantuml.posimo;

public class Path {

	private final Label label;
	private final Block start;
	private final Block end;
	private final int length;
	private DotPath dotPath;

	public Path(Block start, Block end, Label label) {
		this(start, end, label, 2);
	}

	public Path(Block start, Block end, Label label, int length) {
		if (start == null || end == null) {
			throw new IllegalArgumentException();
		}
		if (length < 1) {
			throw new IllegalArgumentException("length=" + length);
		}
		this.start = start;
		this.end = end;
		this.label = label;
		this.length = length;
	}

	public final Label getLabel() {
		return label;
	}

	public final Block getStart() {
		return start;
	}

	public final Block getEnd() {
		return end;
	}

	public void setLabelPositionCenter(double labelX, double labelY) {
		label.setCenterX(labelX);
		label.setCenterY(labelY);
	}

	public void setLabelPosition(double x, double y) {
		label.setX(x);
		label.setY(y);
	}

	public void setDotPath(DotPath dotPath) {
		this.dotPath = dotPath;

	}

	public final DotPath getDotPath() {
		return dotPath;
	}

	public int getLength() {
		return length;
	}

}


text:
The [lodash](https://lodash.com/) library exported as a [UMD](https://github.com/umdjs/umd) module.

Generated using [lodash-cli](https://www.npmjs.com/package/lodash-cli):
```bash
$ npm run build
$ lodash -o ./dist/lodash.js
$ lodash core -o ./dist/lodash.core.js
```

## What is Lodash

Lodash makes JavaScript easier by taking the hassle out of working with arrays,

numbers, objects, strings, etc. Lodash's modular methods can be used for:

* Iterating arrays, objects, & strings
* Manipulating & testing values
* Creating composite functions

## Community

[![Gitter](https://badges.gitter.im/lodash/lodash.svg)](https://gitter.im/lodash/lodash)

## Documentation

  * [API Documentation](https://lodash.com/docs)
  * [DevDocs – *a searchable interface for our documentation*](https://devdocs.io/lodash/)

## Download

Lodash is released under the [MIT license](https://raw.githubusercontent.com/lodash/lodash/4.3.0/LICENSE) & supports [modern environments](#support).

Review the [build differences](https://github.com/lodash/lodash/wiki/build-differences) & pick the one that's right for you.

 * [Core build](https://raw.githubusercontent.com/lodash/lodash/4.3.0/dist/lodash.core.js) ([~4 kB gzipped](https://raw.githubusercontent.com/lodash/lodash/4.3.0/dist/lodash.core.min.js))
 * [Full build](https://raw.githubusercontent.com/lodash/lodash/4.3.0/dist/lodash.js) ([~20 kB gzipped](https://raw.githubusercontent.com/lodash/lodash/4.3.0/dist/lodash.min.js))

## Module Formats

Lodash is available in a variety of other builds & module formats.

 * [lodash](https://www.npmjs.com/package/lodash) & [per method packages](https://www.npmjs.com/browse/keyword/lodash-modularized)
 * [lodash-amd](https://www.npmjs.com/package/lodash-amd)
 * [lodash-es](https://www.npmjs.com/package/lodash-es) & [babel-plugin-lodash](https://www.npmjs.com/package/babel-plugin-lodash)

CDN copies are available on [cdnjs](https://cdnjs.com/) & [jsDelivr](http://www.jsdelivr.com/).

Create [custom builds](https://lodash.com/custom-builds) with only the features you need.

## Further Reading

  * [Release Notes](https://github.com/lodash/lodash/releases/tag/4.0.0)
  * [Build Differences](https://github.com/lodash/lodash/wiki/Build-Differences)
  * [Changelog](https://github.com/lodash/lodash/wiki/Changelog)
  * [Roadmap](https://github.com/lodash/lodash/wiki/Roadmap)
  * [More Resources](https://github.com/lodash/lodash/wiki/Resources)


text:
require 'spec_helper'

describe Slnky::Service::Base do
  subject { described_class.new }

  it 'can manage subscriptions' do
    expect { described_class.subscribe('test.event', :method) }.to_not raise_error
    expect(subject.subscriber.list.count).to eq(1)
    expect(subject.subscriber.list.first).to be_a(Slnky::Service::Subscription)
  end

  it 'can manage timers' do
    expect { described_class.timer(5.seconds, :method) }.to_not raise_error
    expect(subject.timers.list.count).to eq(1)
    expect(subject.timers.list.first).to be_a(Slnky::Service::Periodic)
  end
end


text:
package com.facebook.buck.cli;

import static org.junit.Assert.assertThat;

import com.facebook.buck.testutil.ProcessResult;
import com.facebook.buck.testutil.TemporaryPaths;
import com.facebook.buck.testutil.integration.ProjectWorkspace;
import com.facebook.buck.testutil.integration.TestDataHelper;
import com.facebook.buck.util.MoreStringsForTests;
import java.io.IOException;
import org.junit.Rule;
import org.junit.Test;

public class AuditRulesCommandIntegrationTest {

  @Rule public TemporaryPaths tmp = new TemporaryPaths();

  @Test
  public void testBuckAuditRules() throws IOException {
    ProjectWorkspace workspace =
        TestDataHelper.createProjectWorkspaceForScenario(this, "audit_rules", tmp);
    workspace.setUp();

    // Print all of the rules in a file.
    ProcessResult result1 = workspace.runBuckCommand("audit", "rules", "example/BUCK");
    result1.assertSuccess();
    assertThat(
        result1.getStdout(),
        MoreStringsForTests.equalToIgnoringPlatformNewlines(
            workspace.getFileContents("stdout.all")));

    // Print all of the rules filtered by type.
    ProcessResult result2 =
        workspace.runBuckCommand("audit", "rules", "--type", "genrule", "example/BUCK");
    result2.assertSuccess();
    assertThat(
        result2.getStdout(),
        MoreStringsForTests.equalToIgnoringPlatformNewlines(
            workspace.getFileContents("stdout.genrule")));

    // Print all of the rules using multiple filters.
    ProcessResult result3 =
        workspace.runBuckCommand(
            "audit", "rules", "-t", "genrule", "-t", "keystore", "example/BUCK");
    result3.assertSuccess();
    assertThat(
        result3.getStdout(),
        MoreStringsForTests.equalToIgnoringPlatformNewlines(
            workspace.getFileContents("stdout.all")));
  }

  @Test
  public void testSkylarkAuditRules() throws IOException {
    ProjectWorkspace workspace =
        TestDataHelper.createProjectWorkspaceForScenario(this, "audit_skylark_rules", tmp);
    workspace.setUp();
    workspace.addBuckConfigLocalOption("parser", "polyglot_parsing_enabled", "true");
    workspace.addBuckConfigLocalOption("parser", "default_build_file_syntax", "skylark");

    // Print all of the rules in a file.
    ProcessResult result = workspace.runBuckCommand("audit", "rules", "example/BUCK");
    result.assertSuccess();
    assertThat(
        result.getStdout(),
        MoreStringsForTests.equalToIgnoringPlatformNewlines(
            workspace.getFileContents("stdout.all")));

    // Print all of the rules in a file.
    ProcessResult result1 = workspace.runBuckCommand("audit", "rules", "example/BUCK");
    result1.assertSuccess();
    assertThat(
        result1.getStdout(),
        MoreStringsForTests.equalToIgnoringPlatformNewlines(
            workspace.getFileContents("stdout.all")));
  }

  @Test
  public void auditRulesRespectConfigs() throws IOException {
    ProjectWorkspace workspace =
        TestDataHelper.createProjectWorkspaceForScenario(this, "audit_rules_respect_configs", tmp);
    workspace.setUp();
    ProcessResult result1 =
        workspace.runBuckCommand("audit", "rules", "example/BUCK", "-c", "test.config=bar");
    result1.assertSuccess();
    assertThat(
        result1.getStdout(),
        MoreStringsForTests.equalToIgnoringPlatformNewlines(
            workspace.getFileContents("stdout.all")));
  }

  @Test
  public void testBuckAuditRulesSortsBasedOnName() throws IOException {
    ProjectWorkspace workspace =
        TestDataHelper.createProjectWorkspaceForScenario(this, "audit_rules", tmp);
    workspace.setUp();

    ProcessResult result = workspace.runBuckCommand("audit", "rules", "unsorted/BUCK");
    result.assertSuccess();
    assertThat(
        result.getStdout(),
        MoreStringsForTests.equalToIgnoringPlatformNewlines(
            workspace.getFileContents("stdout.sorted")));
  }
}


text:
//
//  EColumnChartLabel.m
//  EChart
//
//  Created by Efergy China on 13/12/13.
//  Copyright (c) 2013 Scott Zhu. All rights reserved.
//

#import "EColumnChartLabel.h"
#import "EColor.h"

@implementation EColumnChartLabel

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setLineBreakMode:NSLineBreakByClipping];
        self.adjustsFontSizeToFitWidth = YES;
        [self setMinimumScaleFactor:5.0f/13.0f];

        [self setNumberOfLines:1];
        [self setFont:[UIFont boldSystemFontOfSize:13.0f]];
        [self setTextColor: EDeepGrey];
        self.backgroundColor = [UIColor clearColor];
        [self setTextAlignment:NSTextAlignmentLeft];
        self.userInteractionEnabled = YES;
        [self setBaselineAdjustment:UIBaselineAdjustmentAlignCenters];
    }
    return self;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/

@end


text:
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CodeGeneration;
using Microsoft.CodeAnalysis.Editing;
using Microsoft.CodeAnalysis.LanguageServices;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Roslyn.Utilities;

namespace Microsoft.CodeAnalysis.GenerateType
{
    internal abstract partial class AbstractGenerateTypeService<TService, TSimpleNameSyntax, TObjectCreationExpressionSyntax, TExpressionSyntax, TTypeDeclarationSyntax, TArgumentSyntax>
    {
        internal abstract IMethodSymbol GetDelegatingConstructor(TObjectCreationExpressionSyntax objectCreation, INamedTypeSymbol namedType, SemanticModel model, ISet<IMethodSymbol> candidates, CancellationToken cancellationToken);

        private partial class Editor
        {
            private INamedTypeSymbol GenerateNamedType()
            {
                return CodeGenerationSymbolFactory.CreateNamedTypeSymbol(
                    DetermineAttributes(),
                    DetermineAccessibility(),
                    DetermineModifiers(),
                    DetermineTypeKind(),
                    DetermineName(),
                    DetermineTypeParameters(),
                    DetermineBaseType(),
                    DetermineInterfaces(),
                    members: DetermineMembers());
            }

            private INamedTypeSymbol GenerateNamedType(GenerateTypeOptionsResult options)
            {
                if (options.TypeKind == TypeKind.Delegate)
                {
                    return CodeGenerationSymbolFactory.CreateDelegateTypeSymbol(
                        DetermineAttributes(),
                        options.Accessibility,
                        DetermineModifiers(),
                        DetermineReturnType(options),
                        options.TypeName,
                        DetermineTypeParameters(options),
                        DetermineParameters(options));
                }

                return CodeGenerationSymbolFactory.CreateNamedTypeSymbol(
                    DetermineAttributes(),
                    options.Accessibility,
                    DetermineModifiers(),
                    options.TypeKind,
                    options.TypeName,
                    DetermineTypeParameters(),
                    DetermineBaseType(),
                    DetermineInterfaces(),
                    members: DetermineMembers(options));
            }

            private ITypeSymbol DetermineReturnType(GenerateTypeOptionsResult options)
            {
                if (_state.DelegateMethodSymbol == null ||
                    _state.DelegateMethodSymbol.ReturnType == null ||
                    _state.DelegateMethodSymbol.ReturnType is IErrorTypeSymbol)
                {
                    // Since we cannot determine the return type, we are returning void
                    return _state.Compilation.GetSpecialType(SpecialType.System_Void);
                }
                else
                {
                    return _state.DelegateMethodSymbol.ReturnType;
                }
            }

            private IList<ITypeParameterSymbol> DetermineTypeParameters(GenerateTypeOptionsResult options)
            {
                if (_state.DelegateMethodSymbol != null)
                {
                    return _state.DelegateMethodSymbol.TypeParameters;
                }

                // If the delegate symbol cannot be determined then
                return DetermineTypeParameters();
            }

            private IList<IParameterSymbol> DetermineParameters(GenerateTypeOptionsResult options)
            {
                if (_state.DelegateMethodSymbol != null)
                {
                    return _state.DelegateMethodSymbol.Parameters;
                }

                return null;
            }

            private IList<ISymbol> DetermineMembers(GenerateTypeOptionsResult options = null)
            {
                var members = new List<ISymbol>();
                AddMembers(members, options);

                if (_state.IsException)
                {
                    AddExceptionConstructors(members);
                }

                return members;
            }

            private void AddMembers(IList<ISymbol> members, GenerateTypeOptionsResult options = null)
            {
                AddProperties(members);

                IList<TArgumentSyntax> argumentList;
                if (!_service.TryGetArgumentList(_state.ObjectCreationExpressionOpt, out argumentList))
                {
                    return;
                }

                var parameterTypes = GetArgumentTypes(argumentList);

                // Don't generate this constructor if it would conflict with a default exception
                // constructor.  Default exception constructors will be added automatically by our
                // caller.
                if (_state.IsException &&
                    _state.BaseTypeOrInterfaceOpt.InstanceConstructors.Any(
                        c => c.Parameters.Select(p => p.Type).SequenceEqual(parameterTypes)))
                {
                    return;
                }

                // If there's an accessible base constructor that would accept these types, then
                // just call into that instead of generating fields.
                if (_state.BaseTypeOrInterfaceOpt != null)
                {
                    if (_state.BaseTypeOrInterfaceOpt.TypeKind == TypeKind.Interface && argumentList.Count == 0)
                    {
                        // No need to add the default constructor if our base type is going to be
                        // 'object'.  We get that constructor for free.
                        return;
                    }

                    var accessibleInstanceConstructors = _state.BaseTypeOrInterfaceOpt.InstanceConstructors.Where(
                        IsSymbolAccessible).ToSet();

                    if (accessibleInstanceConstructors.Any())
                    {
                        var delegatedConstructor = _service.GetDelegatingConstructor(_state.ObjectCreationExpressionOpt, _state.BaseTypeOrInterfaceOpt, _document.SemanticModel, accessibleInstanceConstructors, _cancellationToken);
                        if (delegatedConstructor != null)
                        {
                            // There was a best match.  Call it directly.
                            AddBaseDelegatingConstructor(delegatedConstructor, members);
                            return;
                        }
                    }
                }

                // Otherwise, just generate a normal constructor that assigns any provided
                // parameters into fields.
                AddFieldDelegatingConstructor(argumentList, members, options);
            }

            private void AddProperties(IList<ISymbol> members)
            {
                var typeInference = _document.Project.LanguageServices.GetService<ITypeInferenceService>();
                foreach (var property in _state.PropertiesToGenerate)
                {
                    IPropertySymbol generatedProperty;
                    if (_service.TryGenerateProperty(property, _document.SemanticModel, typeInference, _cancellationToken, out generatedProperty))
                    {
                        members.Add(generatedProperty);
                    }
                }
            }

            private void AddBaseDelegatingConstructor(
                IMethodSymbol methodSymbol,
                IList<ISymbol> members)
            {
                // If we're generating a constructor to delegate into the no-param base constructor
                // then we can just elide the constructor entirely.
                if (methodSymbol.Parameters.Length == 0)
                {
                    return;
                }

                var factory = _document.Project.LanguageServices.GetService<SyntaxGenerator>();
                members.Add(factory.CreateBaseDelegatingConstructor(
                    methodSymbol, DetermineName()));
            }

            private void AddFieldDelegatingConstructor(
                IList<TArgumentSyntax> argumentList, IList<ISymbol> members, GenerateTypeOptionsResult options = null)
            {
                var factory = _document.Project.LanguageServices.GetService<SyntaxGenerator>();
                var syntaxFactsService = _document.Project.LanguageServices.GetService<ISyntaxFactsService>();

                var availableTypeParameters = _service.GetAvailableTypeParameters(_state, _document.SemanticModel, _intoNamespace, _cancellationToken);
                var parameterTypes = GetArgumentTypes(argumentList);
                var parameterNames = _service.GenerateParameterNames(_document.SemanticModel, argumentList);
                var parameters = new List<IParameterSymbol>();

                var parameterToExistingFieldMap = new Dictionary<string, ISymbol>();
                var parameterToNewFieldMap = new Dictionary<string, string>();

                var syntaxFacts = _document.Project.LanguageServices.GetService<ISyntaxFactsService>();
                for (var i = 0; i < parameterNames.Count; i++)
                {
                    var refKind = syntaxFacts.GetRefKindOfArgument(argumentList[i]);

                    var parameterName = parameterNames[i];
                    var parameterType = (ITypeSymbol)parameterTypes[i];
                    parameterType = parameterType.RemoveUnavailableTypeParameters(
                        _document.SemanticModel.Compilation, availableTypeParameters);

                    if (!TryFindMatchingField(parameterName, parameterType, parameterToExistingFieldMap, caseSensitive: true))
                    {
                        if (!TryFindMatchingField(parameterName, parameterType, parameterToExistingFieldMap, caseSensitive: false))
                        {
                            parameterToNewFieldMap[parameterName] = parameterName;
                        }
                    }

                    parameters.Add(CodeGenerationSymbolFactory.CreateParameterSymbol(
                        attributes: null,
                        refKind: refKind,
                        isParams: false,
                        type: parameterType,
                        name: parameterName));
                }

                // Empty Constructor for Struct is not allowed
                if (!(parameters.Count == 0 && options != null && (options.TypeKind == TypeKind.Struct || options.TypeKind == TypeKind.Structure)))
                {
                    members.AddRange(factory.CreateFieldDelegatingConstructor(
                        DetermineName(), null, parameters, parameterToExistingFieldMap, parameterToNewFieldMap, _cancellationToken));
                }
            }

            private void AddExceptionConstructors(IList<ISymbol> members)
            {
                var factory = _document.Project.LanguageServices.GetService<SyntaxGenerator>();
                var exceptionType = _document.SemanticModel.Compilation.ExceptionType();
                var constructors =
                   exceptionType.InstanceConstructors
                       .Where(c => c.DeclaredAccessibility == Accessibility.Public || c.DeclaredAccessibility == Accessibility.Protected)
                       .Select(c => CodeGenerationSymbolFactory.CreateConstructorSymbol(
                           attributes: null,
                           accessibility: c.DeclaredAccessibility,
                           modifiers: default(DeclarationModifiers),
                           typeName: DetermineName(),
                           parameters: c.Parameters,
                           statements: null,
                           baseConstructorArguments: c.Parameters.Length == 0 ? null : factory.CreateArguments(c.Parameters)));
                members.AddRange(constructors);
            }

            private IList<AttributeData> DetermineAttributes()
            {
                if (_state.IsException)
                {
                    var serializableType = _document.SemanticModel.Compilation.SerializableAttributeType();
                    if (serializableType != null)
                    {
                        var attribute = CodeGenerationSymbolFactory.CreateAttributeData(serializableType);
                        return new[] { attribute };
                    }
                }

                return null;
            }

            private Accessibility DetermineAccessibility()
            {
                return _service.GetAccessibility(_state, _document.SemanticModel, _intoNamespace, _cancellationToken);
            }

            private DeclarationModifiers DetermineModifiers()
            {
                return default(DeclarationModifiers);
            }

            private INamedTypeSymbol DetermineBaseType()
            {
                if (_state.BaseTypeOrInterfaceOpt == null || _state.BaseTypeOrInterfaceOpt.TypeKind == TypeKind.Interface)
                {
                    return null;
                }

                return RemoveUnavailableTypeParameters(_state.BaseTypeOrInterfaceOpt);
            }

            private IList<INamedTypeSymbol> DetermineInterfaces()
            {
                if (_state.BaseTypeOrInterfaceOpt != null && _state.BaseTypeOrInterfaceOpt.TypeKind == TypeKind.Interface)
                {
                    var type = RemoveUnavailableTypeParameters(_state.BaseTypeOrInterfaceOpt);
                    if (type != null)
                    {
                        return new[] { type };
                    }
                }

                return SpecializedCollections.EmptyList<INamedTypeSymbol>();
            }

            private INamedTypeSymbol RemoveUnavailableTypeParameters(INamedTypeSymbol type)
            {
                return type.RemoveUnavailableTypeParameters(
                    _document.SemanticModel.Compilation, GetAvailableTypeParameters()) as INamedTypeSymbol;
            }

            private string DetermineName()
            {
                return GetTypeName(_state);
            }

            private IList<ITypeParameterSymbol> DetermineTypeParameters()
            {
                return _service.GetTypeParameters(_state, _document.SemanticModel, _cancellationToken);
            }

            private TypeKind DetermineTypeKind()
            {
                return _state.IsStruct
                    ? TypeKind.Struct
                    : _state.IsInterface
                        ? TypeKind.Interface
                        : TypeKind.Class;
            }

            protected IList<ITypeParameterSymbol> GetAvailableTypeParameters()
            {
                var availableInnerTypeParameters = _service.GetTypeParameters(_state, _document.SemanticModel, _cancellationToken);
                var availableOuterTypeParameters = !_intoNamespace && _state.TypeToGenerateInOpt != null
                    ? _state.TypeToGenerateInOpt.GetAllTypeParameters()
                    : SpecializedCollections.EmptyEnumerable<ITypeParameterSymbol>();

                return availableOuterTypeParameters.Concat(availableInnerTypeParameters).ToList();
            }
        }

        internal abstract bool TryGenerateProperty(TSimpleNameSyntax propertyName, SemanticModel semanticModel, ITypeInferenceService typeInference, CancellationToken cancellationToken, out IPropertySymbol property);
    }
}


text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;

namespace Cosmos.IL2CPU {
  public class ILReader {
    // We split this into two arrays since we have to read
    // a byte at a time anways. In the future if we need to
    // back to a unifed array, instead of 64k entries
    // we can change it to a signed int, and then add x0200 to the value.
    // This will reduce array size down to 768 entries.
    protected OpCode[] mOpCodesLo = new OpCode[256];
    protected OpCode[] mOpCodesHi = new OpCode[256];

    public ILReader() {
      LoadOpCodes();
    }

    protected void LoadOpCodes() {
      foreach (var xField in typeof(OpCodes).GetFields(BindingFlags.DeclaredOnly | BindingFlags.Static | BindingFlags.Public)) {
        var xOpCode = (OpCode)xField.GetValue(null);
        var xValue = (ushort)xOpCode.Value;
        if (xValue <= 0xFF) {
          mOpCodesLo[xValue] = xOpCode;
        } else {
          mOpCodesHi[xValue & 0xFF] = xOpCode;
        }
      }
    }

    protected void CheckBranch(int aTarget, int aMethodSize) {
      // this method is a safety-measure. Should never occur
      if (aTarget < 0 || aTarget >= aMethodSize) {
        throw new Exception("Branch jumps outside method.");
      }
    }

    public List<ILOpCode> ProcessMethod(MethodBase aMethod) {
      var xResult = new List<ILOpCode>();
      var xBody = aMethod.GetMethodBody();
      // Cache for use in field and method resolution
      Type[] xTypeGenArgs = null;
      Type[] xMethodGenArgs = null;
      if (aMethod.DeclaringType.IsGenericType) {
        xTypeGenArgs = aMethod.DeclaringType.GetGenericArguments();
      }
      if (aMethod.IsGenericMethod) {
        xMethodGenArgs = aMethod.GetGenericArguments();
      }

      // Some methods return no body. Not sure why.. have to investigate
      // They arent abstracts or icalls...
      if (xBody == null) {
        return null;
      }

      var xIL = xBody.GetILAsByteArray();
      int xPos = 0;
      while (xPos < xIL.Length) {
          ExceptionHandlingClause xCurrentHandler = null;
          #region Determine current handler
          // todo: add support for nested handlers using a stack or so..
          foreach (ExceptionHandlingClause xHandler in xBody.ExceptionHandlingClauses)
          {
              if (xHandler.TryOffset > 0)
              {
                  if (xHandler.TryOffset <= xPos && (xHandler.TryLength + xHandler.TryOffset ) > xPos)
                  {
                      if (xCurrentHandler == null)
                      {
                          xCurrentHandler = xHandler;
                          continue;
                      }
                      else if (xHandler.TryOffset > xCurrentHandler.TryOffset && (xHandler.TryLength + xHandler.TryOffset) < (xCurrentHandler.TryLength + xCurrentHandler.TryOffset))
                      {
                          // only replace if the current found handler is narrower
                          xCurrentHandler = xHandler;
                          continue;
                      }
                  }
              }
              if (xHandler.HandlerOffset > 0)
              {
                  if (xHandler.HandlerOffset <= xPos && (xHandler.HandlerOffset + xHandler.HandlerLength) > xPos)
                  {
                      if (xCurrentHandler == null)
                      {
                          xCurrentHandler = xHandler;
                          continue;
                      }
                      else if (xHandler.HandlerOffset > xCurrentHandler.HandlerOffset && (xHandler.HandlerOffset + xHandler.HandlerLength) < (xCurrentHandler.HandlerOffset + xCurrentHandler.HandlerLength))
                      {
                          // only replace if the current found handler is narrower
                          xCurrentHandler = xHandler;
                          continue;
                      }
                  }
              }
              if ((xHandler.Flags & ExceptionHandlingClauseOptions.Filter) > 0)
              {
                  if (xHandler.FilterOffset > 0)
                  {
                      if (xHandler.FilterOffset <= xPos)
                      {
                          if (xCurrentHandler == null)
                          {
                              xCurrentHandler = xHandler;
                              continue;
                          }
                          else if (xHandler.FilterOffset > xCurrentHandler.FilterOffset)
                          {
                              // only replace if the current found handler is narrower
                              xCurrentHandler = xHandler;
                              continue;
                          }
                      }
                  }
              }
          }
          #endregion
          ILOpCode.Code xOpCodeVal;
        OpCode xOpCode;
        int xOpPos = xPos;
        if (xIL[xPos] == 0xFE) {
          xOpCodeVal = (ILOpCode.Code)(0xFE00 | xIL[xPos + 1]);
          xOpCode = mOpCodesHi[xIL[xPos + 1]];
          xPos = xPos + 2;
        } else {
          xOpCodeVal = (ILOpCode.Code)xIL[xPos];
          xOpCode = mOpCodesLo[xIL[xPos]];
          xPos++;
        }

        ILOpCode xILOpCode = null;
        switch (xOpCode.OperandType) {
          // No operand.
          case OperandType.InlineNone:
                {
                    #region Inline none options
                    // These shortcut translation regions expand shortcut ops into full ops
              // This elminates the amount of code required in the assemblers
              // by allowing them to ignore the shortcuts
              switch (xOpCodeVal) {
                case ILOpCode.Code.Ldarg_0:
                      xILOpCode = new ILOpCodes.OpVar(ILOpCode.Code.Ldarg, xOpPos, xPos, 0, xCurrentHandler);
                  break;
                case ILOpCode.Code.Ldarg_1:
                  xILOpCode = new ILOpCodes.OpVar(ILOpCode.Code.Ldarg, xOpPos, xPos, 1, xCurrentHandler);
                  break;
                case ILOpCode.Code.Ldarg_2:
                  xILOpCode = new ILOpCodes.OpVar(ILOpCode.Code.Ldarg, xOpPos, xPos, 2, xCurrentHandler);
                  break;
                case ILOpCode.Code.Ldarg_3:
                  xILOpCode = new ILOpCodes.OpVar(ILOpCode.Code.Ldarg, xOpPos, xPos, 3, xCurrentHandler);
                  break;
                case ILOpCode.Code.Ldc_I4_0:
                  xILOpCode = new ILOpCodes.OpInt(ILOpCode.Code.Ldc_I4, xOpPos, xPos, 0, xCurrentHandler);
                  break;
                case ILOpCode.Code.Ldc_I4_1:
                  xILOpCode = new ILOpCodes.OpInt(ILOpCode.Code.Ldc_I4, xOpPos, xPos, 1, xCurrentHandler);
                  break;
                case ILOpCode.Code.Ldc_I4_2:
                  xILOpCode = new ILOpCodes.OpInt(ILOpCode.Code.Ldc_I4, xOpPos, xPos, 2, xCurrentHandler);
                  break;
                case ILOpCode.Code.Ldc_I4_3:
                  xILOpCode = new ILOpCodes.OpInt(ILOpCode.Code.Ldc_I4, xOpPos, xPos, 3, xCurrentHandler);
                  break;
                case ILOpCode.Code.Ldc_I4_4:
                  xILOpCode = new ILOpCodes.OpInt(ILOpCode.Code.Ldc_I4, xOpPos, xPos, 4, xCurrentHandler);
                  break;
                case ILOpCode.Code.Ldc_I4_5:
                  xILOpCode = new ILOpCodes.OpInt(ILOpCode.Code.Ldc_I4, xOpPos, xPos, 5, xCurrentHandler);
                  break;
                case ILOpCode.Code.Ldc_I4_6:
                  xILOpCode = new ILOpCodes.OpInt(ILOpCode.Code.Ldc_I4, xOpPos, xPos, 6, xCurrentHandler);
                  break;
                case ILOpCode.Code.Ldc_I4_7:
                  xILOpCode = new ILOpCodes.OpInt(ILOpCode.Code.Ldc_I4, xOpPos, xPos, 7, xCurrentHandler);
                  break;
                case ILOpCode.Code.Ldc_I4_8:
                  xILOpCode = new ILOpCodes.OpInt(ILOpCode.Code.Ldc_I4, xOpPos, xPos, 8, xCurrentHandler);
                  break;
                case ILOpCode.Code.Ldc_I4_M1:
                  xILOpCode = new ILOpCodes.OpInt(ILOpCode.Code.Ldc_I4, xOpPos, xPos, -1, xCurrentHandler);
                  break;
                case ILOpCode.Code.Ldloc_0:
                  xILOpCode = new ILOpCodes.OpVar(ILOpCode.Code.Ldloc, xOpPos, xPos, 0, xCurrentHandler);
                  break;
                case ILOpCode.Code.Ldloc_1:
                  xILOpCode = new ILOpCodes.OpVar(ILOpCode.Code.Ldloc, xOpPos, xPos, 1, xCurrentHandler);
                  break;
                case ILOpCode.Code.Ldloc_2:
                  xILOpCode = new ILOpCodes.OpVar(ILOpCode.Code.Ldloc, xOpPos, xPos, 2, xCurrentHandler);
                  break;
                case ILOpCode.Code.Ldloc_3:
                  xILOpCode = new ILOpCodes.OpVar(ILOpCode.Code.Ldloc, xOpPos, xPos, 3, xCurrentHandler);
                  break;
                case ILOpCode.Code.Stloc_0:
                  xILOpCode = new ILOpCodes.OpVar(ILOpCode.Code.Stloc, xOpPos, xPos, 0, xCurrentHandler);
                  break;
                case ILOpCode.Code.Stloc_1:
                  xILOpCode = new ILOpCodes.OpVar(ILOpCode.Code.Stloc, xOpPos, xPos, 1, xCurrentHandler);
                  break;
                case ILOpCode.Code.Stloc_2:
                  xILOpCode = new ILOpCodes.OpVar(ILOpCode.Code.Stloc, xOpPos, xPos, 2, xCurrentHandler);
                  break;
                case ILOpCode.Code.Stloc_3:
                  xILOpCode = new ILOpCodes.OpVar(ILOpCode.Code.Stloc, xOpPos, xPos, 3, xCurrentHandler);
                  break;
                default:
                  xILOpCode = new ILOpCodes.OpNone(xOpCodeVal, xOpPos, xPos, xCurrentHandler);
                  break;
              }
                    #endregion
              break;
          }

          case OperandType.ShortInlineBrTarget:
                {
                    #region Inline branch
                    // By calculating target, we assume all branches are within a method
                    // So far at least wtih csc, its true. We check it with CheckBranch
                    // just in case.
                    int xTarget = xPos + 1 + (sbyte)xIL[xPos];
                    CheckBranch(xTarget, xIL.Length);
                    switch (xOpCodeVal)
                    {
                        case ILOpCode.Code.Beq_S:
                            xILOpCode = new ILOpCodes.OpBranch(ILOpCode.Code.Beq, xOpPos, xPos + 1, xTarget, xCurrentHandler);
                            break;
                        case ILOpCode.Code.Bge_S:
                            xILOpCode = new ILOpCodes.OpBranch(ILOpCode.Code.Bge, xOpPos, xPos + 1, xTarget, xCurrentHandler);
                            break;
                        case ILOpCode.Code.Bge_Un_S:
                            xILOpCode = new ILOpCodes.OpBranch(ILOpCode.Code.Bge_Un, xOpPos, xPos + 1, xTarget, xCurrentHandler);
                            break;
                        case ILOpCode.Code.Bgt_S:
                            xILOpCode = new ILOpCodes.OpBranch(ILOpCode.Code.Bgt, xOpPos, xPos + 1, xTarget, xCurrentHandler);
                            break;
                        case ILOpCode.Code.Bgt_Un_S:
                            xILOpCode = new ILOpCodes.OpBranch(ILOpCode.Code.Bgt_Un, xOpPos, xPos + 1, xTarget, xCurrentHandler);
                            break;
                        case ILOpCode.Code.Ble_S:
                            xILOpCode = new ILOpCodes.OpBranch(ILOpCode.Code.Ble, xOpPos, xPos + 1, xTarget, xCurrentHandler);
                            break;
                        case ILOpCode.Code.Ble_Un_S:
                            xILOpCode = new ILOpCodes.OpBranch(ILOpCode.Code.Ble_Un, xOpPos, xPos + 1, xTarget, xCurrentHandler);
                            break;
                        case ILOpCode.Code.Blt_S:
                            xILOpCode = new ILOpCodes.OpBranch(ILOpCode.Code.Blt, xOpPos, xPos + 1, xTarget, xCurrentHandler);
                            break;
                        case ILOpCode.Code.Blt_Un_S:
                            xILOpCode = new ILOpCodes.OpBranch(ILOpCode.Code.Blt_Un, xOpPos, xPos + 1, xTarget, xCurrentHandler);
                            break;
                        case ILOpCode.Code.Bne_Un_S:
                            xILOpCode = new ILOpCodes.OpBranch(ILOpCode.Code.Bne_Un, xOpPos, xPos + 1, xTarget, xCurrentHandler);
                            break;
                        case ILOpCode.Code.Br_S:
                            xILOpCode = new ILOpCodes.OpBranch(ILOpCode.Code.Br, xOpPos, xPos + 1, xTarget, xCurrentHandler);
                            break;
                        case ILOpCode.Code.Brfalse_S:
                            xILOpCode = new ILOpCodes.OpBranch(ILOpCode.Code.Brfalse, xOpPos, xPos + 1, xTarget, xCurrentHandler);
                            break;
                        case ILOpCode.Code.Brtrue_S:
                            xILOpCode = new ILOpCodes.OpBranch(ILOpCode.Code.Brtrue, xOpPos, xPos + 1, xTarget, xCurrentHandler);
                            break;
                        case ILOpCode.Code.Leave_S:
                            xILOpCode = new ILOpCodes.OpBranch(ILOpCode.Code.Leave, xOpPos, xPos + 1, xTarget, xCurrentHandler);
                            break;
                        default:
                            xILOpCode = new ILOpCodes.OpBranch(xOpCodeVal, xOpPos, xPos + 1, xTarget, xCurrentHandler);
                            break;
                    }
                    xPos = xPos + 1;
                    break;
                    #endregion
                }
          case OperandType.InlineBrTarget: {
              int xTarget = xPos + 4 + ReadInt32(xIL, xPos);
              CheckBranch(xTarget, xIL.Length);
              xILOpCode = new ILOpCodes.OpBranch(xOpCodeVal, xOpPos, xPos + 4, xTarget, xCurrentHandler);
              xPos = xPos + 4;
              break;
            }

          case OperandType.ShortInlineI:
            switch (xOpCodeVal) {
              case ILOpCode.Code.Ldc_I4_S:
                    xILOpCode = new ILOpCodes.OpInt(ILOpCode.Code.Ldc_I4, xOpPos, xPos + 1, ((sbyte)xIL[xPos]), xCurrentHandler);
                break;
              default:
                xILOpCode = new ILOpCodes.OpInt(xOpCodeVal, xOpPos, xPos + 1, ((sbyte)xIL[xPos]), xCurrentHandler);
                break;
            }
            xPos = xPos + 1;
            break;
          case OperandType.InlineI:
            xILOpCode = new ILOpCodes.OpInt(xOpCodeVal, xOpPos, xPos + 4, ReadInt32(xIL, xPos), xCurrentHandler);
            xPos = xPos + 4;
            break;
          case OperandType.InlineI8:
            xILOpCode = new ILOpCodes.OpInt64(xOpCodeVal, xOpPos, xPos + 8, ReadUInt64(xIL, xPos), xCurrentHandler);
            xPos = xPos + 8;
            break;

          case OperandType.ShortInlineR:
            xILOpCode = new ILOpCodes.OpSingle(xOpCodeVal, xOpPos, xPos + 4, BitConverter.ToSingle(xIL, xPos), xCurrentHandler);
            xPos = xPos + 4;
            break;
          case OperandType.InlineR:
            xILOpCode = new ILOpCodes.OpDouble(xOpCodeVal, xOpPos, xPos + 8, BitConverter.ToDouble(xIL, xPos), xCurrentHandler);
            xPos = xPos + 8;
            break;

          // The operand is a 32-bit metadata token.
          case OperandType.InlineField: {
              var xValue = aMethod.Module.ResolveField(ReadInt32(xIL, xPos), xTypeGenArgs, xMethodGenArgs);
              xILOpCode = new ILOpCodes.OpField(xOpCodeVal, xOpPos, xPos + 4, xValue, xCurrentHandler);
              xPos = xPos + 4;
              break;
            }

          // The operand is a 32-bit metadata token.
          case OperandType.InlineMethod: {
              var xValue = aMethod.Module.ResolveMethod(ReadInt32(xIL, xPos), xTypeGenArgs, xMethodGenArgs);
              xILOpCode = new ILOpCodes.OpMethod(xOpCodeVal, xOpPos, xPos + 4, xValue, xCurrentHandler);
              xPos = xPos + 4;
              break;
            }

          // 32-bit metadata signature token.
          case OperandType.InlineSig:
            xILOpCode = new ILOpCodes.OpSig(xOpCodeVal, xOpPos, xPos + 4, ReadInt32(xIL, xPos), xCurrentHandler);
            xPos = xPos + 4;
            break;

          case OperandType.InlineString:
            xILOpCode = new ILOpCodes.OpString(xOpCodeVal, xOpPos, xPos + 4, aMethod.Module.ResolveString(ReadInt32(xIL, xPos)), xCurrentHandler);
            xPos = xPos + 4;
            break;

          case OperandType.InlineSwitch: {
              int xCount = ReadInt32(xIL, xPos);
              xPos = xPos + 4;
              int xNextOpPos = xPos + xCount * 4;
              var xBranchLocations = new int[xCount];
              for (int i = 0; i < xCount; i++) {
                xBranchLocations[i] = xNextOpPos + ReadInt32(xIL, xPos + i * 4);
                CheckBranch(xBranchLocations[i], xIL.Length);
              }
              xILOpCode = new ILOpCodes.OpSwitch(xOpCodeVal, xOpPos, xNextOpPos, xBranchLocations, xCurrentHandler);
              xPos = xNextOpPos;
              break;
            }

          // The operand is a FieldRef, MethodRef, or TypeRef token.
          case OperandType.InlineTok:
              xILOpCode = new ILOpCodes.OpToken(xOpCodeVal, xOpPos, xPos + 4, ReadInt32(xIL, xPos), aMethod.Module, xTypeGenArgs, xMethodGenArgs, xCurrentHandler);
            xPos = xPos + 4;
            break;

          // 32-bit metadata token.
          case OperandType.InlineType: {
              var xValue = aMethod.Module.ResolveType(ReadInt32(xIL, xPos), xTypeGenArgs, xMethodGenArgs);
              xILOpCode = new ILOpCodes.OpType(xOpCodeVal, xOpPos, xPos + 4, xValue, xCurrentHandler);
              xPos = xPos + 4;
              break;
            }

          case OperandType.ShortInlineVar:
            switch (xOpCodeVal) {
              case ILOpCode.Code.Ldloc_S:
                    xILOpCode = new ILOpCodes.OpVar(ILOpCode.Code.Ldloc, xOpPos, xPos + 1, xIL[xPos], xCurrentHandler);
                break;
              case ILOpCode.Code.Ldloca_S:
                xILOpCode = new ILOpCodes.OpVar(ILOpCode.Code.Ldloca, xOpPos, xPos + 1, xIL[xPos], xCurrentHandler);
                break;
              case ILOpCode.Code.Ldarg_S:
                xILOpCode = new ILOpCodes.OpVar(ILOpCode.Code.Ldarg, xOpPos, xPos + 1, xIL[xPos], xCurrentHandler);
                break;
              case ILOpCode.Code.Ldarga_S:
                xILOpCode = new ILOpCodes.OpVar(ILOpCode.Code.Ldarga, xOpPos, xPos + 1, xIL[xPos], xCurrentHandler);
                break;
              case ILOpCode.Code.Starg_S:
                xILOpCode = new ILOpCodes.OpVar(ILOpCode.Code.Starg, xOpPos, xPos + 1, xIL[xPos], xCurrentHandler);
                break;
              case ILOpCode.Code.Stloc_S:
                xILOpCode = new ILOpCodes.OpVar(ILOpCode.Code.Stloc, xOpPos, xPos + 1, xIL[xPos], xCurrentHandler);
                break;
              default:
                xILOpCode = new ILOpCodes.OpVar(xOpCodeVal, xOpPos, xPos + 1, xIL[xPos], xCurrentHandler);
                break;
            }
            xPos = xPos + 1;
            break;
          case OperandType.InlineVar:
            xILOpCode = new ILOpCodes.OpVar(xOpCodeVal, xOpPos, xPos + 2, ReadUInt16(xIL, xPos), xCurrentHandler);
            xPos = xPos + 2;
            break;

          default:
            throw new Exception("Unknown OperandType");
        }
        xILOpCode.InitStackAnalysis(aMethod);
        xResult.Add(xILOpCode);
      }
      return xResult;
    }

    // We could use BitConvertor, unfortuantely they "hardcoded" endianness. Its fine for reading IL now...
    // but they essentially do the same as we do, just a bit slower.
    private UInt16 ReadUInt16(byte[] aBytes, int aPos) {
      return (UInt16)(aBytes[aPos + 1] << 8 | aBytes[aPos]);
    }

    private Int32 ReadInt32(byte[] aBytes, int aPos) {
      return aBytes[aPos + 3] << 24 | aBytes[aPos + 2] << 16 | aBytes[aPos + 1] << 8 | aBytes[aPos];
    }

    private UInt64 ReadUInt64(byte[] aBytes, int aPos) {
      //return (UInt64)(
      //  aBytes[aPos + 7] << 56 | aBytes[aPos + 6] << 48 | aBytes[aPos + 5] << 40 | aBytes[aPos + 4] << 32
      //  | aBytes[aPos + 3] << 24 | aBytes[aPos + 2] << 16 | aBytes[aPos + 1] << 8 | aBytes[aPos]);

        return BitConverter.ToUInt64(aBytes, aPos);
    }

  }
}