text:
<?php

namespace Drupal\field\Plugin\migrate\process\d6;

use Drupal\migrate\MigrateException;
use Drupal\migrate\ProcessPluginBase;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\Row;

/**
 * Gives us a chance to set per field defaults.
 *
 * @MigrateProcessPlugin(
 *   id = "field_type_defaults"
 * )
 */
class FieldTypeDefaults extends ProcessPluginBase {

  /**
   * {@inheritdoc}
   */
  public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
    if (is_array($value)) {
      if ($row->getSourceProperty('module') == 'date') {
        $value = 'datetime_default';
      }
      else {
        throw new MigrateException(sprintf('Failed to lookup field type %s in the static map.', var_export($value, TRUE)));
      }
    }
    return $value;
  }

}


text:
package net.java.sip.communicator.service.protocol;

/**
 * An Operation Set defining the encryption operations for telephony.
 *
 * @author Emanuel Onica
 * @author Romain Kuntz
 * @author Emil Ivov
 */
public interface OperationSetSecureTelephony
    extends OperationSet
{
    /**
     * Gets the secure state of the call session in which a specific peer
     * is involved
     *
     * @param peer the peer for who the call state is required
     * @return the call state
     */
    public boolean isSecure(CallPeer peer);
}

redpajama_set_name: RedPajamaGithub


text:
<?php
/* this file can be deleted */
?>


text:
package pl.codewise.geecon;

public class EscapeAnalysisTest {

    public static void main(String[] args) {
        Employee employee = new Employee("UNIT", new Person("The Doctor", 907));

        while (true) {
            Person person = employee.getPerson();
            // this caller does not modify the object, so defensive copy was unnecessary
            System.out.println("Employee's name: " + person.getName() + "; age: " + person.getAge());
        }
    }
}

class Person {

    private String name;
    private int age;

    public Person(String personName, int personAge) {
        name = personName;
        age = personAge;
    }

    public Person(Person p) {
        this(p.getName(), p.getAge());
    }

    public String getName() {
        return name;
    }

    public int getAge() {
        return age;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setAge(int age) {
        this.age = age;
    }
}

class Employee {

    private final String organisation;
    private final Person person;

    Employee(String organisation, Person person) {
        this.organisation = organisation;
        this.person = person;
    }

    public String getOrganisation() {
        return organisation;
    }

    // makes a defensive copy to protect against modifications by caller
    public Person getPerson() {
        return new Person(person);
    }
}


text:
#pragma once
#include <aws/redshift/Redshift_EXPORTS.h>
#include <aws/redshift/RedshiftRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <aws/redshift/model/Tag.h>

namespace Aws
{
namespace Redshift
{
namespace Model
{

  /**
   *

   */
  class AWS_REDSHIFT_API CreateHsmConfigurationRequest : public RedshiftRequest
  {
  public:
    CreateHsmConfigurationRequest();
    Aws::String SerializePayload() const override;

    /**
     *
The identifier to be assigned to the new Amazon Redshift HSM
     * configuration.

     */
    inline const Aws::String& GetHsmConfigurationIdentifier() const{ return m_hsmConfigurationIdentifier; }

    /**
     *
The identifier to be assigned to the new Amazon Redshift HSM
     * configuration.

     */
    inline void SetHsmConfigurationIdentifier(const Aws::String& value) { m_hsmConfigurationIdentifierHasBeenSet = true; m_hsmConfigurationIdentifier = value; }

    /**
     *
The identifier to be assigned to the new Amazon Redshift HSM
     * configuration.

     */
    inline void SetHsmConfigurationIdentifier(Aws::String&& value) { m_hsmConfigurationIdentifierHasBeenSet = true; m_hsmConfigurationIdentifier = value; }

    /**
     *
The identifier to be assigned to the new Amazon Redshift HSM
     * configuration.

     */
    inline void SetHsmConfigurationIdentifier(const char* value) { m_hsmConfigurationIdentifierHasBeenSet = true; m_hsmConfigurationIdentifier.assign(value); }

    /**
     *
The identifier to be assigned to the new Amazon Redshift HSM
     * configuration.

     */
    inline CreateHsmConfigurationRequest& WithHsmConfigurationIdentifier(const Aws::String& value) { SetHsmConfigurationIdentifier(value); return *this;}

    /**
     *
The identifier to be assigned to the new Amazon Redshift HSM
     * configuration.

     */
    inline CreateHsmConfigurationRequest& WithHsmConfigurationIdentifier(Aws::String&& value) { SetHsmConfigurationIdentifier(value); return *this;}

    /**
     *
The identifier to be assigned to the new Amazon Redshift HSM
     * configuration.

     */
    inline CreateHsmConfigurationRequest& WithHsmConfigurationIdentifier(const char* value) { SetHsmConfigurationIdentifier(value); return *this;}

    /**
     *
A text description of the HSM configuration to be created.

     */
    inline const Aws::String& GetDescription() const{ return m_description; }

    /**
     *
A text description of the HSM configuration to be created.

     */
    inline void SetDescription(const Aws::String& value) { m_descriptionHasBeenSet = true; m_description = value; }

    /**
     *
A text description of the HSM configuration to be created.

     */
    inline void SetDescription(Aws::String&& value) { m_descriptionHasBeenSet = true; m_description = value; }

    /**
     *
A text description of the HSM configuration to be created.

     */
    inline void SetDescription(const char* value) { m_descriptionHasBeenSet = true; m_description.assign(value); }

    /**
     *
A text description of the HSM configuration to be created.

     */
    inline CreateHsmConfigurationRequest& WithDescription(const Aws::String& value) { SetDescription(value); return *this;}

    /**
     *
A text description of the HSM configuration to be created.

     */
    inline CreateHsmConfigurationRequest& WithDescription(Aws::String&& value) { SetDescription(value); return *this;}

    /**
     *
A text description of the HSM configuration to be created.

     */
    inline CreateHsmConfigurationRequest& WithDescription(const char* value) { SetDescription(value); return *this;}

    /**
     *
The IP address that the Amazon Redshift cluster must use to access the
     * HSM.

     */
    inline const Aws::String& GetHsmIpAddress() const{ return m_hsmIpAddress; }

    /**
     *
The IP address that the Amazon Redshift cluster must use to access the
     * HSM.

     */
    inline void SetHsmIpAddress(const Aws::String& value) { m_hsmIpAddressHasBeenSet = true; m_hsmIpAddress = value; }

    /**
     *
The IP address that the Amazon Redshift cluster must use to access the
     * HSM.

     */
    inline void SetHsmIpAddress(Aws::String&& value) { m_hsmIpAddressHasBeenSet = true; m_hsmIpAddress = value; }

    /**
     *
The IP address that the Amazon Redshift cluster must use to access the
     * HSM.

     */
    inline void SetHsmIpAddress(const char* value) { m_hsmIpAddressHasBeenSet = true; m_hsmIpAddress.assign(value); }

    /**
     *
The IP address that the Amazon Redshift cluster must use to access the
     * HSM.

     */
    inline CreateHsmConfigurationRequest& WithHsmIpAddress(const Aws::String& value) { SetHsmIpAddress(value); return *this;}

    /**
     *
The IP address that the Amazon Redshift cluster must use to access the
     * HSM.

     */
    inline CreateHsmConfigurationRequest& WithHsmIpAddress(Aws::String&& value) { SetHsmIpAddress(value); return *this;}

    /**
     *
The IP address that the Amazon Redshift cluster must use to access the
     * HSM.

     */
    inline CreateHsmConfigurationRequest& WithHsmIpAddress(const char* value) { SetHsmIpAddress(value); return *this;}

    /**
     *
The name of the partition in the HSM where the Amazon Redshift clusters will
     * store their database encryption keys.

     */
    inline const Aws::String& GetHsmPartitionName() const{ return m_hsmPartitionName; }

    /**
     *
The name of the partition in the HSM where the Amazon Redshift clusters will
     * store their database encryption keys.

     */
    inline void SetHsmPartitionName(const Aws::String& value) { m_hsmPartitionNameHasBeenSet = true; m_hsmPartitionName = value; }

    /**
     *
The name of the partition in the HSM where the Amazon Redshift clusters will
     * store their database encryption keys.

     */
    inline void SetHsmPartitionName(Aws::String&& value) { m_hsmPartitionNameHasBeenSet = true; m_hsmPartitionName = value; }

    /**
     *
The name of the partition in the HSM where the Amazon Redshift clusters will
     * store their database encryption keys.

     */
    inline void SetHsmPartitionName(const char* value) { m_hsmPartitionNameHasBeenSet = true; m_hsmPartitionName.assign(value); }

    /**
     *
The name of the partition in the HSM where the Amazon Redshift clusters will
     * store their database encryption keys.

     */
    inline CreateHsmConfigurationRequest& WithHsmPartitionName(const Aws::String& value) { SetHsmPartitionName(value); return *this;}

    /**
     *
The name of the partition in the HSM where the Amazon Redshift clusters will
     * store their database encryption keys.

     */
    inline CreateHsmConfigurationRequest& WithHsmPartitionName(Aws::String&& value) { SetHsmPartitionName(value); return *this;}

    /**
     *
The name of the partition in the HSM where the Amazon Redshift clusters will
     * store their database encryption keys.

     */
    inline CreateHsmConfigurationRequest& WithHsmPartitionName(const char* value) { SetHsmPartitionName(value); return *this;}

    /**
     *
The password required to access the HSM partition.

     */
    inline const Aws::String& GetHsmPartitionPassword() const{ return m_hsmPartitionPassword; }

    /**
     *
The password required to access the HSM partition.

     */
    inline void SetHsmPartitionPassword(const Aws::String& value) { m_hsmPartitionPasswordHasBeenSet = true; m_hsmPartitionPassword = value; }

    /**
     *
The password required to access the HSM partition.

     */
    inline void SetHsmPartitionPassword(Aws::String&& value) { m_hsmPartitionPasswordHasBeenSet = true; m_hsmPartitionPassword = value; }

    /**
     *
The password required to access the HSM partition.

     */
    inline void SetHsmPartitionPassword(const char* value) { m_hsmPartitionPasswordHasBeenSet = true; m_hsmPartitionPassword.assign(value); }

    /**
     *
The password required to access the HSM partition.

     */
    inline CreateHsmConfigurationRequest& WithHsmPartitionPassword(const Aws::String& value) { SetHsmPartitionPassword(value); return *this;}

    /**
     *
The password required to access the HSM partition.

     */
    inline CreateHsmConfigurationRequest& WithHsmPartitionPassword(Aws::String&& value) { SetHsmPartitionPassword(value); return *this;}

    /**
     *
The password required to access the HSM partition.

     */
    inline CreateHsmConfigurationRequest& WithHsmPartitionPassword(const char* value) { SetHsmPartitionPassword(value); return *this;}

    /**
     *
The HSMs public certificate file. When using Cloud HSM, the file name is
     * server.pem.

     */
    inline const Aws::String& GetHsmServerPublicCertificate() const{ return m_hsmServerPublicCertificate; }

    /**
     *
The HSMs public certificate file. When using Cloud HSM, the file name is
     * server.pem.

     */
    inline void SetHsmServerPublicCertificate(const Aws::String& value) { m_hsmServerPublicCertificateHasBeenSet = true; m_hsmServerPublicCertificate = value; }

    /**
     *
The HSMs public certificate file. When using Cloud HSM, the file name is
     * server.pem.

     */
    inline void SetHsmServerPublicCertificate(Aws::String&& value) { m_hsmServerPublicCertificateHasBeenSet = true; m_hsmServerPublicCertificate = value; }

    /**
     *
The HSMs public certificate file. When using Cloud HSM, the file name is
     * server.pem.

     */
    inline void SetHsmServerPublicCertificate(const char* value) { m_hsmServerPublicCertificateHasBeenSet = true; m_hsmServerPublicCertificate.assign(value); }

    /**
     *
The HSMs public certificate file. When using Cloud HSM, the file name is
     * server.pem.

     */
    inline CreateHsmConfigurationRequest& WithHsmServerPublicCertificate(const Aws::String& value) { SetHsmServerPublicCertificate(value); return *this;}

    /**
     *
The HSMs public certificate file. When using Cloud HSM, the file name is
     * server.pem.

     */
    inline CreateHsmConfigurationRequest& WithHsmServerPublicCertificate(Aws::String&& value) { SetHsmServerPublicCertificate(value); return *this;}

    /**
     *
The HSMs public certificate file. When using Cloud HSM, the file name is
     * server.pem.

     */
    inline CreateHsmConfigurationRequest& WithHsmServerPublicCertificate(const char* value) { SetHsmServerPublicCertificate(value); return *this;}

    /**
     *
A list of tag instances.

     */
    inline const Aws::Vector<Tag>& GetTags() const{ return m_tags; }

    /**
     *
A list of tag instances.

     */
    inline void SetTags(const Aws::Vector<Tag>& value) { m_tagsHasBeenSet = true; m_tags = value; }

    /**
     *
A list of tag instances.

     */
    inline void SetTags(Aws::Vector<Tag>&& value) { m_tagsHasBeenSet = true; m_tags = value; }

    /**
     *
A list of tag instances.

     */
    inline CreateHsmConfigurationRequest& WithTags(const Aws::Vector<Tag>& value) { SetTags(value); return *this;}

    /**
     *
A list of tag instances.

     */
    inline CreateHsmConfigurationRequest& WithTags(Aws::Vector<Tag>&& value) { SetTags(value); return *this;}

    /**
     *
A list of tag instances.

     */
    inline CreateHsmConfigurationRequest& AddTags(const Tag& value) { m_tagsHasBeenSet = true; m_tags.push_back(value); return *this; }

    /**
     *
A list of tag instances.

     */
    inline CreateHsmConfigurationRequest& AddTags(Tag&& value) { m_tagsHasBeenSet = true; m_tags.push_back(value); return *this; }

  private:
    Aws::String m_hsmConfigurationIdentifier;
    bool m_hsmConfigurationIdentifierHasBeenSet;
    Aws::String m_description;
    bool m_descriptionHasBeenSet;
    Aws::String m_hsmIpAddress;
    bool m_hsmIpAddressHasBeenSet;
    Aws::String m_hsmPartitionName;
    bool m_hsmPartitionNameHasBeenSet;
    Aws::String m_hsmPartitionPassword;
    bool m_hsmPartitionPasswordHasBeenSet;
    Aws::String m_hsmServerPublicCertificate;
    bool m_hsmServerPublicCertificateHasBeenSet;
    Aws::Vector<Tag> m_tags;
    bool m_tagsHasBeenSet;
  };

} // namespace Model
} // namespace Redshift
} // namespace Aws


text:
using System;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Net.Http;
using Owin;
using Microsoft.Owin.Testing;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json.Linq;
using Excess.Compiler;
using Excess.Compiler.Roslyn;
using Excess.Compiler.Core;
using Excess.Concurrent.Runtime;
using Excess.Server.Middleware;
using Excess.Runtime;
using xslang;

namespace Tests
{
    using ServerExtension = Excess.Server.Compiler.ServerExtension;
    using ConcurrentExtension = Excess.Concurrent.Compiler.ConcurrentExtension;
    using FactoryMethod = Func<IConcurrentApp, object[], IConcurrentObject>;
    using Compilation = Excess.Compiler.Roslyn.RoslynCompilation;
    using CompilationAnalysis = Excess.Compiler.ICompilationAnalysis<SyntaxToken, SyntaxNode, SemanticModel>;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using Microsoft.Owin;

    public static class Mock
    {
        public static SyntaxTree Compile(string code, out string output)
        {
            RoslynCompiler compiler = new RoslynCompiler(environment: null);

            ServerExtension.Apply(compiler, compiler.Scope);
            ConcurrentExtension.Apply(compiler);
            return compiler.ApplySemanticalPass(code, out output);
        }

        public static Compilation Build(string code,
            IPersistentStorage storage = null,
            List<string> errors = null,
            bool generateJSFiles = false)
        {
            var analysis = generateJSFiles
                ? new CompilationAnalysisBase<SyntaxToken, SyntaxNode, SemanticModel>()
                : null;

            var compilation = createCompilation(code,
                storage: storage ?? (generateJSFiles
                    ? new MockStorage()
                    : null),
                analysis: analysis);

            if (generateJSFiles)
            {
                var environment = compilation.Scope.get<ICompilerEnvironment>();
                Assert.IsNotNull(environment);

                environment.setting("servicePath", "");
            }

            if (compilation.build() == null && errors != null)
            {
                foreach (var error in compilation.errors())
                    errors.Add(error.ToString());
            }

            return compilation;
        }

        public static TestServer CreateHttpServer(string code, Guid instanceId, string instanceClass)
        {
            return CreateHttpServer(code, new Dictionary<string, Guid>()
            {
                { instanceClass, instanceId }
            });
        }

        public static TestServer CreateHttpServer(string code, IDictionary<string, Guid> instances)
        {
            var errors = new List<Diagnostic>();
            var assembly = buildServer(code, errors: errors);
            if (errors.Any())
                return null;

            var app = appFromAssembly(assembly, userInstances: instances);
            return TestServer.Create(appBuilder =>
            {
                appBuilder.UseExcess(app);
            });
        }

        public static TestServer CreateFunctionalServer(string code)
        {
            var errors = new List<Diagnostic>();
            var assembly = buildServer(code, errors: errors);
            if (errors.Any())
                return null;

            var functionTypes = assembly
                .ExportedTypes
                .Where(type => type.Name == "Functions");

            var scope = new __Scope(null);
            return TestServer.Create(appBuilder =>
            {
                appBuilder.UseExcess(scope, functional: functionTypes);
            });
        }

        public static TestServer CreateServer(string code, string configuration, IDictionary<string, Guid> instances)
        {
            var errors = new List<Diagnostic>();
            var configurations = new List<Type>();
            var assembly = buildServer(code,
                errors: errors,
                configurations: configurations);

            if (errors.Any())
                return null;

            var config = configurations
                .Single(cfg => cfg.Name == configuration);

            var nodeConfigs = configurations
                .Where(cfg => cfg.Name.StartsWith(configuration + "__"))
                .ToArray();

            var remoteTypes = null as IEnumerable<Type>;
            var clients = 0;
            var startNodes = false;
            if (config != null)
            {
                remoteTypes = (IEnumerable<Type>)config
                    .GetMethod("RemoteTypes")
                    .Invoke(null, new object[] { });

                clients = nodeConfigs.Length;
                startNodes = clients > 0;
            }

            var classes = new List<Type>();
            var app = appFromAssembly(assembly,
                allInstances: instances,
                remoteTypes: remoteTypes,
                commonClasses: classes);

            app.Connect = _ =>
            {
                if (startNodes)
                    Task.Run(() => config
                        .GetMethod("StartNodes")
                        .Invoke(null, new object[] { classes }));

                var waiter = new ManualResetEvent(false);
                var error = null as Exception;
                NetMQFunctions.StartServer(app, "tcp://localhost:5000", clients,
                    connected: ex =>
                    {
                        error = ex;
                        waiter.Set();
                    });

                waiter.WaitOne();
                return error;
            };

            return TestServer.Create(builder => builder.UseExcess(app));
        }

        private static IDistributedApp appFromAssembly(Assembly assembly,
            IDictionary<string, Guid> userInstances = null,
            IDictionary<string, Guid> allInstances = null,
            IEnumerable<Type> remoteTypes = null,
            IList<Type> commonClasses = null)
        {
            var types = new Dictionary<string, FactoryMethod>();
            var concurrentApp = new TestConcurrentApp(types, new DefaultInstantiator());
            var app = new DistributedApp(concurrentApp);

            foreach (var type in assembly.GetTypes())
            {
                if (type.BaseType != typeof(ConcurrentObject))
                    continue;

                Guid id;
                if (remoteTypes != null && remoteTypes.Contains(type))
                {
                    if (allInstances != null && isService(type, out id))
                        allInstances[type.Name] = id;
                    continue;
                }

                commonClasses?.Add(type);
                app.RegisterClass(type);

                if (userInstances != null)
                {
                    if (userInstances.TryGetValue(type.Name, out id))
                        app.RegisterInstance(id, (IConcurrentObject)Activator.CreateInstance(type));
                }
                else if (type.IsConcurrentSingleton(out id))
                {
                    var instance = (IConcurrentObject)Activator.CreateInstance(type);
                    app.RegisterInstance(id, (IConcurrentObject)Activator.CreateInstance(type));

                    if (allInstances != null)
                        allInstances[type.Name] = id;
                }
            }

            return app;
        }

        private static bool isService(Type type, out Guid id)
        {
            var attribute = type
                .CustomAttributes
                .Where(attr => attr.AttributeType.Name == "Service")
                .SingleOrDefault();

            if (attribute != null)
            {
                attribute = type
                    .CustomAttributes
                    .Where(attr => attr.AttributeType.Name == "Concurrent")
                    .Single();

                id = Guid.Parse((string)attribute.NamedArguments[0].TypedValue.Value);
                return true;
            }

            id = Guid.Empty;
            return false;
        }

        public static dynamic ParseResponse(HttpResponseMessage response)
        {
            var json = JObject.Parse(response
                .Content
                .ReadAsStringAsync()
                .Result) as dynamic;

            if (json.__res != null)
                return json.__res;

            return json
                .Property("__ex")
                .Value;
        }

        private static Compilation createCompilation(string text,
            List<Diagnostic> errors = null,
            IPersistentStorage storage = null,
            CompilationAnalysis analysis = null)
        {
            var injector = new CompositeInjector<SyntaxToken, SyntaxNode, SemanticModel>(new[]
            {
                new DelegateInjector<SyntaxToken, SyntaxNode, SemanticModel>(compiler => compiler
                    .Environment()
                        .dependency<ExcessOwinMiddleware>("Excess.Server.Middleware")
                        .dependency<IAppBuilder>("Owin")
                        .dependency<IOwinRequest>("Microsoft.Owin")
                        .dependency<__Scope>("Excess.Runtime")),

                new DelegateInjector<SyntaxToken, SyntaxNode, SemanticModel>(
                    compiler => ConcurrentExtension.Apply((RoslynCompiler)compiler)),

                new DelegateInjector<SyntaxToken, SyntaxNode, SemanticModel>(
                    compiler => ServerExtension.Apply(compiler, new Scope(null))),

                new DelegateInjector<SyntaxToken, SyntaxNode, SemanticModel>(
                    compiler => Functions.Apply(compiler))
            });

            if (analysis != null)
                ServerExtension.Compilation(analysis);

            var compilation = new Compilation(storage, analysis: analysis);
            compilation.addDocument("test", text, injector);
            return compilation;
        }

        private static Assembly buildServer(string text,
            List<Diagnostic> errors = null,
            List<Type> configurations = null,
            IPersistentStorage storage = null)
        {
            var compilation = createCompilation(text, errors, storage);
            var assembly = compilation.build();
            if (assembly == null)
            {
                if (errors != null)
                    errors.AddRange(compilation.errors());

                return null;
            }

            foreach (var type in assembly.GetTypes())
            {
                if (type.BaseType != typeof(IConcurrentObject) && configurations != null)
                    checkForConfiguration(type, configurations);
            }

            return assembly;
        }

        private static void checkForConfiguration(Type type, List<Type> configurations)
        {
            if (type
                .CustomAttributes
                .Any(attr => attr.AttributeType.Name == "ServerConfiguration"))
            {
                configurations.Add(type);
            }
        }
    }
}


text:
package net.acomputerdog.core.logger;

import java.io.PrintStream;

public interface Logger {

    /**
     * Prints out a message in the format [{name}] {message}/n.  This will always log, irregardless of the minium log level.
     *
     * @param message The message to print.
     */
    public void logRaw(String message);

    /**
     * Logs a message with the specified LogLevel, if that level is >= this logger's minimum level
     *
     * @param level   The level to log at.
     * @param message The message to log.
     * @return Return true if the logging as allowed, false otherwise
     */
    public boolean log(LogLevel level, String message);

    /**
     * Prints out a message in the format [{name}][DEBUG] {message}/n, if Debug logging is allowed.
     *
     * @param message The message to print.
     * @return Return true if the logging as allowed, false otherwise
     */
    public boolean logDebug(String message);

    /**
     * Prints out a message in the format [{name}][DETAIL] {message}/n, if Detail logging is enabled.
     *
     * @param message The message to print.
     * @return Return true if the logging as allowed, false otherwise
     */
    public boolean logDetail(String message);

    /**
     * Prints out a message in the format [{name}][INFO] {message}/n, if Info logging is enabled.
     *
     * @param message The message to print.
     * @return Return true if the logging as allowed, false otherwise
     */
    public boolean logInfo(String message);

    /**
     * Prints out a message in the format [{name}][WARNING] {message}/n, if Warning logging is enabled.
     *
     * @param message The message to print.
     * @return Return true if the logging as allowed, false otherwise
     */
    public boolean logWarning(String message, Throwable... throwables);

    /**
     * Prints out a message in the format [{name}][ERROR] {message}/n, if Error logging is enabled.
     *
     * @param message The message to print.
     * @param throwables       Optional parameter. Exception that has occurred
     * @return Return true if the logging as allowed, false otherwise
     */
    public boolean logError(String message, Throwable... throwables);

    /**
     * Prints out a message in the format [{name}][FATAL] {message}/n, if Fatal logging is enabled.
     *
     * @param message The message to print.
     * @param throwables       Optional parameter. Exception that has occurred
     * @return Return true if the logging as allowed, false otherwise
     */
    public boolean logFatal(String message, Throwable... throwables);

    /**
     * Prints out a message on the provided logging level followed by exceptions me
     *
     * @param message The message to print.
     * @param throwables       Optional parameter. Exception that has occurred
     * @return Return true if the logging as allowed, false otherwise
     */
    public boolean logExceptions(String message, LogLevel level, Throwable... throwables);

    /**
     * Checks if this logger will include the date
     * @return Return true if this logger will include the date.
     */
    public boolean doesIncludeDate();

    /**
     * Sets if this logger will include the date.
     * @param includeDate  If true, this logger will include the date.  If false, it will not.
     */
    public void setIncludeDate(boolean includeDate);

    /**
     * Checks if this logger will include the time
     * @return Return true if this logger will include the time.
     */
    public boolean doesIncludeTime();

    /**
     * Sets if this logger will include the time.
     * @param includeTime  If true, this logger will include the time.  If false, it will not.
     */
    public void setIncludeTime(boolean includeTime);

    /**
     * Gets the minimum logging level of this CLogger.
     * LogLevels below this amount will be hidden.
     * @return Return the LogLevel of this CLogger.
     */
    public LogLevel getMinimumLogLevel();

    /**
     * Sets the minimum logging level of this CLogger.
     * LogLevels below this amount will be hidden.
     * @param minimumLogLevel The minimum LogLevel to set
     */
    public void setMinimumLogLevel(LogLevel minimumLogLevel);

    /**
     * Gets the name of this CLogger
     * @return Return the name of this CLogger
     */
    public String getName();

    /**
     * Gets the PrintStream that this CLogger prints to.
     *
     * @return Return the PrintStream that this CLogger prints to.
     */
    public PrintStream getLoggerOutput();

    /**
     * Sets the PrintStream that this CLogger will print to.
     * @param loggerOutput The PrintStream that this CLogger will output to.  Cannot be null.
     */
    public void setLoggerOutput(PrintStream loggerOutput);
}


text:
Imports System.Runtime.InteropServices

Module Module1

    Sub Main()
        Dim objApp As SolidEdgeFramework.Application = Nothing
        Dim objDoc As SolidEdgePart.PartDocument = Nothing
        Dim objBaseProfile(0 To 2) As SolidEdgePart.Profile
        Dim objLine1 As SolidEdgeFrameworkSupport.Line2d = Nothing
        Dim objLine2 As SolidEdgeFrameworkSupport.Line2d = Nothing
        Dim objArc1 As SolidEdgeFrameworkSupport.Arc2d = Nothing
        Dim objArc2 As SolidEdgeFrameworkSupport.Arc2d = Nothing
        Dim objModel As SolidEdgePart.Model
        Dim objExtProtrusion As SolidEdgePart.ExtrudedProtrusion = Nothing
        Dim objRelations As SolidEdgeFrameworkSupport.Relations2d = Nothing
        Dim objTraceRefPlane As SolidEdgePart.RefPlane = Nothing
        Dim objTraceprofile(0 To 2) As SolidEdgePart.Profile
        Dim objCSRefPlane As SolidEdgePart.RefPlane = Nothing
        Dim objCSProfile(0 To 2) As SolidEdgePart.Profile
        Dim vOriginArray(2) As Object
        Dim objSweptProtrusion As SolidEdgePart.SweptProtrusion = Nothing
        Dim lngStatus As Long
        Dim lngTraceCurveTypes(0 To 2) As Long
        Dim lngCrossSectionTypes(0 To 2) As Long

        Try
            Console.WriteLine("Starting Solid Edge")
            ' Create the application with specific settings
            objApp = Activator.CreateInstance(Type.GetTypeFromProgID("SolidEdge.Application"))
            Console.WriteLine("Creating new part file")
            objDoc = objApp.Documents.Add("SolidEdge.PartDocument")
            objApp.Visible = True
            'Create an Extruded Protrusion as Base feature
            objBaseProfile(0) = objDoc.ProfileSets.Add.Profiles.Add(pRefPlaneDisp:=objDoc.RefPlanes(1))
            objLine1 = objBaseProfile(0).Lines2d.AddBy2Points(x1:=0.05, y1:=0, x2:=0.05, y2:=0.15)
            objArc1 = objBaseProfile(0).Arcs2d.AddByCenterStartEnd(xCenter:=0.025, yCenter:=0.15, _
                                                                       xStart:=0.05, yStart:=0.15, xEnd:=0, yEnd:=0.15)
            objLine2 = objBaseProfile(0).Lines2d.AddBy2Points(x1:=0, y1:=0.15, x2:=0, y2:=0)
            objArc2 = objBaseProfile(0).Arcs2d.AddByCenterStartEnd(xCenter:=0.025, yCenter:=0, _
                                                                       xStart:=0, yStart:=0, xEnd:=0.05, yEnd:=0)
            objRelations = objBaseProfile(0).Relations2d
            objRelations.AddKeypoint(Object1:=objLine1, Index1:=SolidEdgeConstants.KeypointIndexConstants.igLineEnd, Object2:=objArc1, Index2:=SolidEdgeConstants.KeypointIndexConstants.igArcStart)
            objRelations.AddKeypoint(Object1:=objArc1, Index1:=SolidEdgeConstants.KeypointIndexConstants.igArcEnd, Object2:=objLine2, Index2:=SolidEdgeConstants.KeypointIndexConstants.igLineStart)
            objRelations.AddKeypoint(Object1:=objLine2, Index1:=SolidEdgeConstants.KeypointIndexConstants.igLineEnd, Object2:=objArc2, Index2:=SolidEdgeConstants.KeypointIndexConstants.igArcStart)
            objRelations.AddKeypoint(Object1:=objArc2, Index1:=SolidEdgeConstants.KeypointIndexConstants.igArcEnd, Object2:=objLine1, Index2:=SolidEdgeConstants.KeypointIndexConstants.igLineStart)
            lngStatus = objBaseProfile(0).End(ValidationCriteria:=SolidEdgeConstants.ProfileValidationType.igProfileClosed)
            If lngStatus <> 0 Then
                MsgBox("Base feature profile is not closed")
            End If

            objModel = objDoc.Models.AddFiniteExtrudedProtrusion(NumberOfProfiles:=1, ProfileArray:=objBaseProfile, _
                                                                     ProfilePlaneSide:=SolidEdgePart.FeaturePropertyConstants.igRight, ExtrusionDistance:=0.05)
            objBaseProfile(0).Visible = False
            objExtProtrusion = objModel.ExtrudedProtrusions(0)
            If objExtProtrusion.Status <> SolidEdgePart.FeatureStatusConstants.igFeatureOK Then
                MsgBox("Base Feature is not created properly")
            End If
            'Create SweptProtrusion with Add method
            objTraceRefPlane = objDoc.RefPlanes.AddParallelByDistance(ParentPlane:=objDoc.RefPlanes(1), _
                                                                          Distance:=0.05, NormalSide:=SolidEdgePart.FeaturePropertyConstants.igRight, Local:=True)
            objTraceprofile(0) = objDoc.ProfileSets.Add.Profiles.Add(pRefPlaneDisp:=objTraceRefPlane)
            objLine1 = objTraceprofile(0).Lines2d.AddBy2Points(x1:=0.05, y1:=0, x2:=0.05, y2:=0.15)
            objArc1 = objTraceprofile(0).Arcs2d.AddByCenterStartEnd(xCenter:=0.025, yCenter:=0.15, _
                                                                        xStart:=0.05, yStart:=0.15, xEnd:=0, yEnd:=0.15)
            objLine2 = objTraceprofile(0).Lines2d.AddBy2Points(x1:=0, y1:=0.15, x2:=0, y2:=0)
            objArc2 = objTraceprofile(0).Arcs2d.AddByCenterStartEnd(xCenter:=0.025, yCenter:=0, _
                                                                        xStart:=0, yStart:=0, xEnd:=0.05, yEnd:=0)
            objRelations = objTraceprofile(0).Relations2d
            objRelations.AddKeypoint(Object1:=objLine1, Index1:=SolidEdgeConstants.KeypointIndexConstants.igLineEnd, Object2:=objArc1, Index2:=SolidEdgeConstants.KeypointIndexConstants.igArcStart)
            objRelations.AddKeypoint(Object1:=objArc1, Index1:=SolidEdgeConstants.KeypointIndexConstants.igArcEnd, Object2:=objLine2, Index2:=SolidEdgeConstants.KeypointIndexConstants.igLineStart)
            objRelations.AddKeypoint(Object1:=objLine2, Index1:=SolidEdgeConstants.KeypointIndexConstants.igLineEnd, Object2:=objArc2, Index2:=SolidEdgeConstants.KeypointIndexConstants.igArcStart)
            objRelations.AddKeypoint(Object1:=objArc2, Index1:=SolidEdgeConstants.KeypointIndexConstants.igArcEnd, Object2:=objLine1, Index2:=SolidEdgeConstants.KeypointIndexConstants.igLineStart)
            lngStatus = objTraceprofile(0).End(ValidationCriteria:=SolidEdgeConstants.ProfileValidationType.igProfileClosed)
            If lngStatus <> 0 Then
                MsgBox("Trace profile is not closed")
            End If
            objCSRefPlane = objDoc.RefPlanes.AddNormalToCurve( _
                                Curve:=objLine1, _
                                PlanePoint:=SolidEdgePart.ReferenceElementConstants.igCurveStart, _
                                OrientationPlaneOrPivot:=objDoc.RefPlanes(1), _
                                PivotOrigin:=SolidEdgePart.ReferenceElementConstants.igPivotEnd, _
                                Local:=True, _
                                ParentCurve:=objTraceprofile(0))
            objCSProfile(0) = objDoc.ProfileSets.Add.Profiles.Add(pRefPlaneDisp:=objCSRefPlane)
            Call objCSProfile(0).Circles2d.AddByCenterRadius(x:=0, y:=0, Radius:=0.01)
            lngStatus = objCSProfile(0).End(ValidationCriteria:=SolidEdgePart.ProfileValidationType.igProfileClosed)
            If lngStatus <> 0 Then
                MsgBox("Cross-section profile is not closed")
            End If
            lngTraceCurveTypes(0) = SolidEdgeConstants.FeaturePropertyConstants.igProfileBasedCrossSection
            lngCrossSectionTypes(0) = SolidEdgeConstants.FeaturePropertyConstants.igProfileBasedCrossSection
            vOriginArray(1) = 0
            objSweptProtrusion = objModel.SweptProtrusions.Add(NumCurves:=1, _
                                                                   TraceCurves:=objTraceprofile, TraceCurveTypes:=lngTraceCurveTypes, NumSections:=1, _
                                                                   CrossSections:=objCSProfile, CrossSectionTypes:=lngCrossSectionTypes, _
                                                                   Origins:=vOriginArray, SegmentMaps:=0, MaterialSide:=SolidEdgePart.FeaturePropertyConstants.igLeft, StartExtentType:=SolidEdgePart.FeaturePropertyConstants.igNone, _
                                                                   StartExtentDistance:=0, StartSurfaceOrRefPlane:=Nothing, EndExtentType:=SolidEdgePart.FeaturePropertyConstants.igNone, _
                                                                   EndExtentDistance:=0, EndSurfaceOrRefPlane:=Nothing)

            objTraceprofile(0).Visible = False
            objCSProfile(0).Visible = False
            If objSweptProtrusion.Status <> SolidEdgePart.FeatureStatusConstants.igFeatureOK Then
                MsgBox("SweptProtrusion Feature Failed")
            End If

        Catch ex As Exception
            Console.WriteLine(ex.ToString)
        Finally
            ' USER DISPLAY
            ' Release objects
            objApp = Nothing
            objDoc = Nothing
            objBaseProfile(0) = Nothing
            objLine1 = Nothing
            objLine2 = Nothing
            objArc1 = Nothing
            objArc2 = Nothing
            objModel = Nothing
            objExtProtrusion = Nothing
            objRelations = Nothing
            objTraceRefPlane = Nothing
            objTraceprofile(0) = Nothing
            objCSRefPlane = Nothing
            objCSProfile(0) = Nothing
            vOriginArray(1) = Nothing
            vOriginArray(2) = Nothing
            objSweptProtrusion = Nothing
        End Try
    End Sub

End Module


text:
import socket, threading, pickle, sys

################################################################################
# Message content classes
################################################################################

class Message( object ):
    def __init__( self, message ):
        super().__init__();
        self.message = message

    def GetMessage( self ):
        return self.message

class Event( object ):
    def __init__( self ):
        super().__init__();
        self.event = 0
        self.description = ''

    def SetDescription( self, descr ):
        self.description = descr

    def SetEvent( self, event ):
        self.event = event

    def GetDescription( self ):
        return self.description

    def GetEvent( self ):
        return self.event

################################################################################
# Server
################################################################################

class Server( object ):
    def __init__( self, host, port ):
        super().__init__()
        self.host = host
        self.port = port
        self.socket = None
        self.app    = None
        self.threads = []
        self.run     = False

    def __exit__( self ):
        self.Stop()

    def SetApplication( self, app ):
        if not self.socket:
            self.app = app
        else:
            print( 'Server is running. Please stop it before changing main application.' )

    def Start( self ):
        self.run = True
        self.socket = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
        self.socket.bind( (self.host, self.port) )
        #self.socket.settimeout(1)
        self.socket.listen(1)

        try:
            while True:
                print( f'Waiting for connection on {self.host}:{self.port}' )
                conn, addr = self.socket.accept()
                print( f'Connection from {addr}' )
                thread = threading.Thread(
                    target = self.HandleConnection,
                    args   = (conn, addr)
                )
                self.threads.append(thread)
                thread.start()
        except KeyboardInterrupt:
            print( 'KeyboardInterrupt, stopping server' )
        finally:
            self.Stop()

    def HandleConnection( self, client, address ):
        size = 1024
        app = self.DefaultApp
        if self.app:
            app = self.app
        client.settimeout(1)
        while self.run:
            try:
                data = client.recv( size )
                if data:
                    response = app( data )
                    if response:
                        client.sendall( response )
                else:
                    raise Exception( 'Client disconnected' )
            except socket.timeout as to:
                #print( 'No message in the last second, time to check if i shall die or not...' )
                pass
            except:
                print( f'[{address}] disconnected!' )
                client.close()
                return False

    def Stop( self ):
        # Inform threads to die
        self.run = False
        for i,thread in enumerate(self.threads):
            print( f'Waiting for thread {i}' )
            thread.join()
        if self.socket:
            print( 'Closing socket...')
            self.socket.close()
        self.threads = []

    def DefaultApp( self, data ):
        # Simple print-and-return
        print(data.decode())
        return data

################################################################################
# Client
################################################################################

class Client( object ):
    def __init__( self, host, port ):
        super().__init__()
        self.host = host
        self.port = port
        self.socket = None

    def __exit__( self ):
        self.Disconnect()

    def Connect( self ):
        print( f'Connecting to {self.host}:{self.port}')
        self.socket = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
        self.socket.connect( (self.host, self.port) )

    def Disconnect( self ):
        if self.socket:
            self.socket.close()

    def Send( self, data ):
        if self.socket:
            self.socket.sendall( data )

    def Receive( self ):
        return self.socket.recv( 1024 )

################################################################################
# Custom app
################################################################################
def MyApp( data ):
    # Data is pickled, unpickle
    msg = pickle.loads( data )
    if isinstance( msg, Event ):
        print( 'Event got!' )
    elif isinstance( msg, Message ):
        print( 'Message get!' )
        print( msg.GetMessage() )

################################################################################
# Command line stuff
################################################################################

if __name__ == '__main__':
    if len(sys.argv) == 2:
        if sys.argv[1] == 's':
            server = Server( 'localhost', 10000 )
            server.SetApplication(MyApp)
            server.Start()
        elif sys.argv[1] == 'c':
            client = Client( 'localhost', 10000 )
            try:
                client.Connect()
                while True:
                    data = None
                    t = input('Type (m/e): ')
                    if t == 'e':
                        data = Event()
                    else:
                        msg = input('Message: ')
                        data = Message( msg )
                    client.Send( pickle.dumps(data) )
            except KeyboardInterrupt:
                print()
                print( 'Client shutdown' )
                client.Disconnect()
    else:
        print( f'Usage:  {sys.argv[0]} [s][c]' )


text:
void printVector(std::strstream & str, char* name, double vec[], size_t len);

void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
	EnergyFunction* pModel;

	if(nrhs<2) {
	    mexErrMsgIdAndTxt("mexEmpiricalMarginals:init",
                      "Usage: mexEmpiricalMarginals(x,model,[probabilities])");
	}

	mkl_disable_fast_mm(); // make MKL use simple and safe memory management

	// get the set of inputs
	void * px = (uint32_t*)mxGetData(prhs[0]);
	size_t nsamples = mxGetN(prhs[0]);
	size_t ndims = mxGetM(prhs[0]);
	mxClassID sampleClassid = mxGetClassID(prhs[0]);

	// Process structure containing information about the model
	const mxArray * model_struct = prhs[1];

	EnergyFunctionFactory factory;
	pModel = factory.createEnergyFunction(model_struct);

	if (pModel->getDim() != ndims)
	{
		mexErrMsgIdAndTxt("mexEmpiricalMarginals:init",
			"model dimension does not match sample dimension");
	}

	// Check if the probabilities of patterns were inputed.
	// If they were not, treat them as all ones.
	bool bInputedProbabilities = false;
	double * pInputProbabilities = NULL;
	double uniform_prob = (double)1/nsamples;
	if(nrhs>=3) {
		bInputedProbabilities = true;

		const mxArray * mxProbabilities = prhs[2];

		// Check the datatype - probabilities must be zero
		mxClassID probsClassid = mxGetClassID(mxProbabilities);
		if (probsClassid != mxDOUBLE_CLASS)
		{
			mexErrMsgIdAndTxt("mexEmpiricalMarginals:init",
							  "pattern probabilities must be of type double");
		}

		// Check that it is the same length as the number of samples. We will allow it to be
		// either a row or column vector (because it is transparent to us anyway)
		if (!(((mxGetN(mxProbabilities) == nsamples) && (mxGetM(mxProbabilities) == 1)) ||
			((mxGetM(mxProbabilities) == nsamples) && (mxGetN(mxProbabilities) == 1))))
		{
			mexErrMsgIdAndTxt("mexEmpiricalMarginals:init",
							  "number of probabilities not equal to number of samples");
		}

		pInputProbabilities = (double*)mxGetData(mxProbabilities);
	}

	// debug prints of the arguments
#ifdef DEBUG_PRINTS
	std::strstream strOut;
	strOut << "Number of samples: " << (uint32_t)nsamples << "\n";
	strOut << "Number of dimensions: " << (uint32_t)ndims << "\n";
	strOut.clear();

	// print lambdas
	//printVector(strOut,"x",px,ndims);

	mexPrintf(strOut.str());
	mexEvalString("drawnow;"); // force it to update the screen so we can see the text
#endif

	// Allocate a result array
	uint32_t nFactors = pModel->getNumFactors();
	mxArray * mxMarginals= mxCreateNumericMatrix(1,nFactors, mxDOUBLE_CLASS, mxREAL);
	double * pMarginals = (double*)mxGetData(mxMarginals);
	plhs[0] = mxMarginals;

	// make sure that the datatype is correct
	uint32_t * pInputArray = reallocate_uint32(px, sampleClassid, nsamples*ndims);

	// build a temp output array that is aligned to 64-bit boundaries
	double * sum_factors = (double*)mkl_malloc(sizeof(double)*nFactors, 64);

	// run the main function and get the marginals
	getEmpiricalMarginals(pModel, nsamples, pInputArray, pInputProbabilities, sum_factors);

	// copy the result to the output array and release the temp array
	memcpy(pMarginals, sum_factors, sizeof(double) * nFactors);
	mkl_free(sum_factors);

	// Delete the model that we had previously allocated
	delete pModel;

	// if we needed to translate the input datatype, delete that temporary buffer too
	if (pInputArray != px)
	{
		delete[] pInputArray;
	}

}

// Prints the beginning and end of a vector to the display
void printVector(std::strstream & str, char* name, double vec[], size_t len)
{

	str  << name << ": [ ";
	for (size_t i=0; i < std::min<size_t>(len,4); i++)
	{
		str << vec[i] << " ";
	}

	if (len>1)
	{
		str  << "... " << vec[len-1] << " ]\n";
	}
}


text:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using Avalonia.Collections;
using Avalonia.Controls;
using Avalonia.PropertyStore;

namespace Avalonia.Styling
{
    /// <summary>
    /// A style that consists of a number of child styles.
    /// </summary>
    public class Styles : AvaloniaObject,
        IAvaloniaList<IStyle>,
        IStyle,
        IResourceProvider
    {
        private readonly AvaloniaList<IStyle> _styles = new();
        private IResourceHost? _owner;
        private IResourceDictionary? _resources;

        public Styles()
        {
            _styles.ResetBehavior = ResetBehavior.Remove;
            _styles.CollectionChanged += OnCollectionChanged;
            _styles.Validate = i =>
            {
                if (i is ControlTheme)
                    throw new InvalidOperationException("ControlThemes cannot be added to a Styles collection.");
            };
        }

        public Styles(IResourceHost owner)
            : this()
        {
            Owner = owner;
        }

        public event NotifyCollectionChangedEventHandler? CollectionChanged;
        public event EventHandler? OwnerChanged;

        public int Count => _styles.Count;

        public IResourceHost? Owner
        {
            get => _owner;
            private set
            {
                if (_owner != value)
                {
                    _owner = value;
                    OwnerChanged?.Invoke(this, EventArgs.Empty);
                }
            }
        }

        /// <summary>
        /// Gets or sets a dictionary of style resources.
        /// </summary>
        public IResourceDictionary Resources
        {
            get => _resources ?? (Resources = new ResourceDictionary());
            set
            {
                value = value ?? throw new ArgumentNullException(nameof(Resources));

                var currentOwner = Owner;

                if (currentOwner is not null)
                {
                    _resources?.RemoveOwner(currentOwner);
                }

                _resources = value;

                if (currentOwner is not null)
                {
                    _resources.AddOwner(currentOwner);
                }
            }
        }

        bool ICollection<IStyle>.IsReadOnly => false;

        bool IResourceNode.HasResources
        {
            get
            {
                if (_resources?.Count > 0)
                {
                    return true;
                }

                foreach (var i in this)
                {
                    if (i is IResourceProvider { HasResources: true })
                    {
                        return true;
                    }
                }

                return false;
            }
        }

        IStyle IReadOnlyList<IStyle>.this[int index] => _styles[index];

        IReadOnlyList<IStyle> IStyle.Children => this;

        public IStyle this[int index]
        {
            get => _styles[index];
            set => _styles[index] = value;
        }

        /// <inheritdoc/>
        public bool TryGetResource(object key, out object? value)
        {
            if (_resources != null && _resources.TryGetResource(key, out value))
            {
                return true;
            }

            for (var i = Count - 1; i >= 0; --i)
            {
                if (this[i].TryGetResource(key, out value))
                {
                    return true;
                }
            }

            value = null;
            return false;
        }

        /// <inheritdoc/>
        public void AddRange(IEnumerable<IStyle> items) => _styles.AddRange(items);

        /// <inheritdoc/>
        public void InsertRange(int index, IEnumerable<IStyle> items) => _styles.InsertRange(index, items);

        /// <inheritdoc/>
        public void Move(int oldIndex, int newIndex) => _styles.Move(oldIndex, newIndex);

        /// <inheritdoc/>
        public void MoveRange(int oldIndex, int count, int newIndex) => _styles.MoveRange(oldIndex, count, newIndex);

        /// <inheritdoc/>
        public void RemoveAll(IEnumerable<IStyle> items) => _styles.RemoveAll(items);

        /// <inheritdoc/>
        public void RemoveRange(int index, int count) => _styles.RemoveRange(index, count);

        /// <inheritdoc/>
        public int IndexOf(IStyle item) => _styles.IndexOf(item);

        /// <inheritdoc/>
        public void Insert(int index, IStyle item) => _styles.Insert(index, item);

        /// <inheritdoc/>
        public void RemoveAt(int index) => _styles.RemoveAt(index);

        /// <inheritdoc/>
        public void Add(IStyle item) => _styles.Add(item);

        /// <inheritdoc/>
        public void Clear() => _styles.Clear();

        /// <inheritdoc/>
        public bool Contains(IStyle item) => _styles.Contains(item);

        /// <inheritdoc/>
        public void CopyTo(IStyle[] array, int arrayIndex) => _styles.CopyTo(array, arrayIndex);

        /// <inheritdoc/>
        public bool Remove(IStyle item) => _styles.Remove(item);

        public AvaloniaList<IStyle>.Enumerator GetEnumerator() => _styles.GetEnumerator();

        /// <inheritdoc/>
        IEnumerator<IStyle> IEnumerable<IStyle>.GetEnumerator() => _styles.GetEnumerator();

        /// <inheritdoc/>
        IEnumerator IEnumerable.GetEnumerator() => _styles.GetEnumerator();

        /// <inheritdoc/>
        void IResourceProvider.AddOwner(IResourceHost owner)
        {
            owner = owner ?? throw new ArgumentNullException(nameof(owner));

            if (Owner is not null)
            {
                throw new InvalidOperationException("The Styles already has a owner.");
            }

            Owner = owner;
            _resources?.AddOwner(owner);

            foreach (var child in this)
            {
                if (child is IResourceProvider r)
                {
                    r.AddOwner(owner);
                }
            }
        }

        /// <inheritdoc/>
        void IResourceProvider.RemoveOwner(IResourceHost owner)
        {
            owner = owner ?? throw new ArgumentNullException(nameof(owner));

            if (Owner == owner)
            {
                Owner = null;
                _resources?.RemoveOwner(owner);

                foreach (var child in this)
                {
                    if (child is IResourceProvider r)
                    {
                        r.RemoveOwner(owner);
                    }
                }
            }
        }

        internal SelectorMatchResult TryAttach(IStyleable target, object? host)
        {
            var result = SelectorMatchResult.NeverThisType;

            foreach (var s in this)
            {
                if (s is not Style style)
                    continue;
                var r = style.TryAttach(target, host, FrameType.Style);
                if (r > result)
                    result = r;
            }

            return result;
        }

        private static IReadOnlyList<T> ToReadOnlyList<T>(ICollection list)
        {
            if (list is IReadOnlyList<T> readOnlyList)
            {
                return readOnlyList;
            }

            var result = new T[list.Count];
            list.CopyTo(result, 0);
            return result;
        }

        private static void InternalAdd(IList items, IResourceHost? owner)
        {
            if (owner is not null)
            {
                for (var i = 0; i < items.Count; ++i)
                {
                    if (items[i] is IResourceProvider provider)
                    {
                        provider.AddOwner(owner);
                    }
                }

                (owner as IStyleHost)?.StylesAdded(ToReadOnlyList<IStyle>(items));
            }
        }

        private static void InternalRemove(IList items, IResourceHost? owner)
        {
            if (owner is not null)
            {
                for (var i = 0; i < items.Count; ++i)
                {
                    if (items[i] is IResourceProvider provider)
                    {
                        provider.RemoveOwner(owner);
                    }
                }

                (owner as IStyleHost)?.StylesRemoved(ToReadOnlyList<IStyle>(items));
            }
        }

        private void OnCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e)
        {
            if (e.Action == NotifyCollectionChangedAction.Reset)
            {
                throw new InvalidOperationException("Reset should not be called on Styles.");
            }

            var currentOwner = Owner;

            switch (e.Action)
            {
                case NotifyCollectionChangedAction.Add:
                    InternalAdd(e.NewItems!, currentOwner);
                    break;
                case NotifyCollectionChangedAction.Remove:
                    InternalRemove(e.OldItems!, currentOwner);
                    break;
                case NotifyCollectionChangedAction.Replace:
                    InternalRemove(e.OldItems!, currentOwner);
                    InternalAdd(e.NewItems!, currentOwner);
                    break;
            }

            CollectionChanged?.Invoke(this, e);
        }
    }
}


text:
var v = function () {
   return true;
   return bar();
};

function bar(): void {
}


text:
import { getAnalyzeToolsConfig } from "./config";

describe("getAnalyzeToolsConfig", () => {
  let config;

  beforeEach(() => {
    config = {
      analyzeTools: {
        tableau: { enabled: false },
        powerbi: { enabled: true },
        qlik: { enabled: false },
      },
    };
  });

  it("should fetch analyze tools settings from config", () => {
    const result = getAnalyzeToolsConfig(config);
    expect(result.tableau.enabled).to.equal(false);
    expect(result.powerbi.enabled).to.equal(true);
    expect(result.qlik.enabled).to.equal(false);
  });
});


text:
package com.datastax.dse.driver.internal.core.type.codec.geometry;

import com.datastax.dse.driver.api.core.data.geometry.Point;
import com.tngtech.java.junit.dataprovider.DataProvider;
import com.tngtech.java.junit.dataprovider.DataProviderRunner;
import com.tngtech.java.junit.dataprovider.UseDataProvider;
import org.junit.Test;
import org.junit.runner.RunWith;

@RunWith(DataProviderRunner.class)
public class PointCodecTest extends GeometryCodecTest<Point, PointCodec> {

  public PointCodecTest() {
    super(new PointCodec());
  }

  @DataProvider
  public static Object[][] serde() {
    return new Object[][] {
      {null, null},
      {Point.fromCoordinates(1, 2), Point.fromCoordinates(1, 2)},
      {Point.fromCoordinates(-1.1, -2.2), Point.fromCoordinates(-1.1, -2.2)}
    };
  }

  @DataProvider
  public static Object[][] format() {
    return new Object[][] {
      {null, "NULL"},
      {Point.fromCoordinates(1, 2), "'POINT (1 2)'"},
      {Point.fromCoordinates(-1.1, -2.2), "'POINT (-1.1 -2.2)'"}
    };
  }

  @DataProvider
  public static Object[][] parse() {
    return new Object[][] {
      {null, null},
      {"", null},
      {" ", null},
      {"NULL", null},
      {" NULL ", null},
      {"'POINT ( 1 2 )'", Point.fromCoordinates(1, 2)},
      {"'POINT ( 1.0 2.0 )'", Point.fromCoordinates(1, 2)},
      {"' point ( -1.1 -2.2 )'", Point.fromCoordinates(-1.1, -2.2)},
      {" ' Point ( -1.1 -2.2 ) ' ", Point.fromCoordinates(-1.1, -2.2)}
    };
  }

  @Test
  @UseDataProvider("format")
  @Override
  public void should_format(Point input, String expected) {
    super.should_format(input, expected);
  }

  @Test
  @UseDataProvider("parse")
  @Override
  public void should_parse(String input, Point expected) {
    super.should_parse(input, expected);
  }
}


text:
package ru.doxhost.newhost.server.web.menu;

import io.vertx.core.json.Json;
import ru.doxhost.newhost.server.routing.jaxy.GET;
import ru.doxhost.newhost.server.routing.jaxy.Order;
import ru.doxhost.newhost.server.routing.jaxy.Path;
import ru.doxhost.newhost.server.routing.Param;

import ru.doxhost.newhost.server.routing.Result;
import ru.doxhost.newhost.server.web.meta.MetaTag;

/**
 * This controller represents main menu.
 * @author Eugene Kirin on 20.11.2015.
 */
public class MainMenuController {

    /**
     * Returns main menu structure.
     * @param currentItem Selected menu item when user clicked on some item. Used to mark as active.
     * @return Json representation.
     */
    public Result json(@Param("item") String currentItem) {

        Menu menu = MenuHandler.getInstance().getMenu();

        menu.setCurrent(currentItem);

        return Result.JSON().display(Json.encodePrettily(menu));
    }
}


text:
@interface HMChannelCollectionModel ()

@property (nonatomic,strong)NSMutableArray *idArray;

@end

@implementation HMChannelCollectionModel

+ (NSString *)tableName {

    return @"channelCollection";
}

+ (NSArray*)columns
{
    return @[
             column("channelCollectionId", "text"),
             column("uid", "text"),
             column("deviceId", "text"),
             column("channelId", "integer"),
             column("isHd", "integer"),
             column("countryId", "text"),
             column("createTime", "text"),
             column("updateTime", "text"),
             column("updateTimeSec", "integer"),
             column("delFlag", "integer")
             ];

}

+ (NSString*)constrains
{
    return @"UNIQUE (channelCollectionId) ON CONFLICT REPLACE";
}

-(void)setInsertWithDb:(FMDatabase *)db
{
    [self insertModel:db];
}

- (BOOL)deleteObject {

    NSString *sql = [NSString stringWithFormat:@"delete from channelCollection where channelCollectionId = '%@'",_channelCollectionId];
    return [self executeUpdate:sql];
}

- (NSArray *)readAllCollectChannelWithDeviceId:(NSString *)deviceId {

    __weak typeof(self) weakSelf = self;
    __block NSMutableArray *dataArray;
    NSString *sql = [NSString stringWithFormat:@"select * from channelCollection where deviceId = '%@' and delFlag == 0",deviceId];
    queryDatabase(sql, ^(FMResultSet *rs) {
        if (!dataArray) {
            dataArray = [[NSMutableArray alloc] init];
        }
        HMChannelCollectionModel *model = [HMChannelCollectionModel object:rs];
        if (!weakSelf.idArray) {
            weakSelf.idArray = [NSMutableArray array];
        }
        [weakSelf.idArray addObject:@(model.channelId)];
        [dataArray addObject:model];
    });

    return [self sortArrayWithCreateTime:dataArray];
}

- (NSArray *)getAllCollectChannelId {
    return _idArray;
}

- (NSArray *)sortArrayWithCreateTime:(NSArray *)array {
    if (!array || array.count == 0) {
        return array;
    }
    NSMutableArray *dataArray = [NSMutableArray arrayWithArray:array];

    for (NSInteger i = 0; i < dataArray.count; i++) {
        for (NSInteger j = i + 1; j < dataArray.count; j++) {

            NSString *dateString = [dataArray[i] valueForKey:@"createTime"];
            NSString *nextDateString = [dataArray[j] valueForKey:@"createTime"];

            NSInteger value = [self transformDate:[dataArray[i] valueForKey:@"createTime"]];
            NSInteger nextValue = [self transformDate:[dataArray[j] valueForKey:@"createTime"]];

            DLog(@"%@:   %d----%@:    %d",dateString, value, nextDateString, nextValue);

            if (value < nextValue) {  // 由大到小排列
                [dataArray exchangeObjectAtIndex:i withObjectAtIndex:j];
            }
        }
    }
    return dataArray;
}

- (NSInteger)transformDate:(NSString *)dateTime {
        NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
        [formatter setDateStyle:NSDateFormatterMediumStyle];
        [formatter setTimeStyle:NSDateFormatterShortStyle];
        [formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
        NSDate *date = [formatter dateFromString:dateTime];
        NSString *timeSp = [NSString stringWithFormat:@"%ld", (long)[date timeIntervalSince1970]];
        return [timeSp integerValue];
}

@end


text:
@interface LectureServiceTests : XCTestCase

@property (nonatomic, strong) LectureServiceImplementation *lectureService;

@end

@implementation LectureServiceTests

- (void)setUp {
    [super setUp];

    [MagicalRecord setDefaultModelFromClass:[self class]];
    [MagicalRecord setupCoreDataStackWithInMemoryStore];

    self.lectureService = [LectureServiceImplementation new];
}

- (void)tearDown {
    [MagicalRecord cleanUp];

    self.lectureService = nil;

    [super tearDown];
}

- (void)testSuccessUpdateLectureWithPredicate {
    // given
    LectureModelObject *lecture = [LectureModelObject MR_createEntity];
    [MagicalRecord saveWithBlockAndWait:^(NSManagedObjectContext * _Nonnull localContext) {}];
    NSArray *expectedLectures = @[lecture];

    // when
    NSArray *lectures = [self.lectureService obtainLectureWithPredicate:nil];

    // then
    XCTAssertEqualObjects(expectedLectures, lectures);
}

- (void)testSuccessUpdateLectureWithObjectId {
    // given
    NSString *lectureId = @"0";
    LectureModelObject *expectedLecture = [LectureModelObject MR_createEntity];
    expectedLecture.lectureId = lectureId;
    [MagicalRecord saveWithBlockAndWait:^(NSManagedObjectContext * _Nonnull localContext) {}];

    // when
    LectureModelObject *lecture = [self.lectureService obtainLectureWithLectureId:lectureId];

    // then
    XCTAssertEqualObjects(expectedLecture, lecture);
}

@end


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>uk.co.automatictester</groupId>
    <artifactId>lightning</artifactId>
    <packaging>pom</packaging>
    <version>1.0.0</version>
    <name>lightning</name>

    <modules>
        <module>jmeter-lightning-maven-plugin</module>
        <module>lightning-core</module>
        <module>lightning-standalone</module>
    </modules>

</project>


text:
require "spec_helper"

class SomeModel < ActiveRecord::Base
end

describe MergedDefaultScopes do
  before(:each) { SomeModel.__send__ :clear_default_scope }

  describe "#clear_default_scope" do
    it "clears scope" do
      SomeModel.class_eval do
        default_scope :order => :name
        default_scope :conditions => {:deleted_at => nil}
        clear_default_scope
      end
      SomeModel.__send__(:scope, :find).
        should be_nil
    end

    it "clears for new threads" do
      monitor = Monitor.new
      condition = monitor.new_cond
      counter = 0
      t1 = Thread.new do
        SomeModel.class_eval do
          default_scope :order => :name
        end
        counter += 1
      end

      t2 = Thread.new do
        monitor.synchronize do
          condition.wait_until { counter == 1 }
          SomeModel.class_eval do
            clear_default_scope
          end
          counter += 1
        end
      end

      t3 = Thread.new do
        monitor.synchronize do
          condition.wait_until { counter == 2 }
          SomeModel.__send__(:scope, :find).
            should be_nil
        end
      end
      [t1,t2,t3].each { |t| t.join }
    end
  end

  describe "#default_scope" do
    it "merges multiple calls" do
      SomeModel.class_eval do
        default_scope :conditions => {:deleted_at => nil}
        default_scope :order => :name
      end
      SomeModel.__send__(:scope, :find).
        should == {:order => :name, :conditions => {:deleted_at => nil}}
    end

    it "persists merges across threads" do
      monitor = Monitor.new
      condition = monitor.new_cond
      counter = 0
      t1 = Thread.new do
        SomeModel.class_eval do
          default_scope :order => :name
        end
        SomeModel.__send__(:scope, :find).
          should == {:order => :name}
        counter += 1
      end

      t2 = Thread.new do
        monitor.synchronize do
          condition.wait_until { counter == 1 }
          SomeModel.__send__(:scope, :find).
            should == {:order => :name}
        end
      end
      [t1,t2].each { |t| t.join }
    end
  end
end


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Routing;

namespace Orchard.MPUnovo.Components
{
    public class UnovoRoute : Route
    {
        public UnovoRoute(
           IRouter target,
           string routeTemplate,
           IInlineConstraintResolver inlineConstraintResolver)
            : this(
                target,
                routeTemplate,
                defaults: null,
                constraints: null,
                dataTokens: null,
                inlineConstraintResolver: inlineConstraintResolver)
        {
        }

        public UnovoRoute(
            IRouter target,
            string routeTemplate,
            RouteValueDictionary defaults,
            IDictionary<string, object> constraints,
            RouteValueDictionary dataTokens,
            IInlineConstraintResolver inlineConstraintResolver)
            : this(target, null, routeTemplate, defaults, constraints, dataTokens, inlineConstraintResolver)
        {
        }

        public UnovoRoute(
            IRouter target,
            string routeName,
            string routeTemplate,
            RouteValueDictionary defaults,
            IDictionary<string, object> constraints,
            RouteValueDictionary dataTokens,
            IInlineConstraintResolver inlineConstraintResolver)
            : base(target,
                   routeName,
                  routeTemplate,
                  defaults,
                  constraints,
                  dataTokens,
                  inlineConstraintResolver)
        {
        }
        /// <summary>
        /// 用于生成URL
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override VirtualPathData GetVirtualPath(VirtualPathContext context)
        {
            return base.GetVirtualPath(context);
        }
        protected override VirtualPathData OnVirtualPathGenerated(VirtualPathContext context)
        {
            return base.OnVirtualPathGenerated(context);
        }
        public override Task RouteAsync(RouteContext context)
        {
            return base.RouteAsync(context);
        }
        /// <summary>
        /// 由RouteBase中的RouteAsync中调用
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        protected override Task OnRouteMatched(RouteContext context)
        {
            context.RouteData.Values["action"] = "Mobile" + context.RouteData.Values["action"];
            //在Route的OnRouteMatched方法中会调用target的RouteAsync,target(MvcRouteHandler)的RouteAsync不会调用OnRouteMatched,会给context.Handler赋予委托
            return base.OnRouteMatched(context);
        }
    }
}


text:
<?php

namespace DeliciousBrains\WP_Offload_SES\Aws3\Aws;

/**
 * Represents a simple cache interface.
 */
interface CacheInterface
{
    /**
     * Get a cache item by key.
     *
     * @param string $key Key to retrieve.
     *
     * @return mixed|null Returns the value or null if not found.
     */
    public function get($key);
    /**
     * Set a cache key value.
     *
     * @param string $key   Key to set
     * @param mixed  $value Value to set.
     * @param int    $ttl   Number of seconds the item is allowed to live. Set
     *                      to 0 to allow an unlimited lifetime.
     */
    public function set($key, $value, $ttl = 0);
    /**
     * Remove a cache key.
     *
     * @param string $key Key to remove.
     */
    public function remove($key);
}


text:
var Polyglot = require('polyglot');

var polyglot;

module.exports = (function () {
    return {
        init: function (translations) {
            polyglot = new Polyglot({phrases: translations});
        },
        translate: function () {
            if (!polyglot) {
                return null;
            }

            return polyglot.t.apply(polyglot, arguments);
        }
    };
})();


text:
"""A tool for running diffing tools and measuring patch sizes."""

import argparse
import logging
import os
import subprocess
import sys
import tempfile

class Error(Exception):
  """Puffin general processing error."""

def ParseArguments(argv):
  """Parses and Validates command line arguments.

  Args:
    argv: command line arguments to parse.

  Returns:
    The arguments list.
  """
  parser = argparse.ArgumentParser()

  parser.add_argument('--src-corpus', metavar='DIR',
                      help='The source corpus directory with compressed files.')
  parser.add_argument('--tgt-corpus', metavar='DIR',
                      help='The target corpus directory with compressed files.')
  parser.add_argument('--debug', action='store_true',
                      help='Turns on verbosity.')

  # Parse command-line arguments.
  args = parser.parse_args(argv)

  for corpus in (args.src_corpus, args.tgt_corpus):
    if not corpus or not os.path.isdir(corpus):
      raise Error('Corpus directory {} is non-existent or inaccesible'
                  .format(corpus))
  return args

def main(argv):
  """The main function."""
  args = ParseArguments(argv[1:])

  if args.debug:
    logging.getLogger().setLevel(logging.DEBUG)

  # Construct list of appropriate files.
  src_files = list(filter(os.path.isfile,
                          [os.path.join(args.src_corpus, f)
                           for f in os.listdir(args.src_corpus)]))
  tgt_files = list(filter(os.path.isfile,
                          [os.path.join(args.tgt_corpus, f)
                           for f in os.listdir(args.tgt_corpus)]))

  # Check if all files in src_files have a target file in tgt_files.
  files_mismatch = (set(map(os.path.basename, src_files)) -
                    set(map(os.path.basename, tgt_files)))
  if files_mismatch:
    raise Error('Target files {} do not exist in corpus: {}'
                .format(files_mismatch, args.tgt_corpus))

  for src in src_files:
    with tempfile.NamedTemporaryFile() as puffdiff_patch, \
         tempfile.NamedTemporaryFile() as bsdiff_patch:

      tgt = os.path.join(args.tgt_corpus, os.path.basename(src))

      operation = 'puffdiff'
      cmd = ['puffin',
             '--operation={}'.format(operation),
             '--src_file={}'.format(src),
             '--dst_file={}'.format(tgt),
             '--patch_file={}'.format(puffdiff_patch.name)]
      # Running the puffdiff operation
      if subprocess.call(cmd) != 0:
        raise Error('Puffin failed to do {} command: {}'
                    .format(operation, cmd))

      operation = 'bsdiff'
      cmd = ['bsdiff', '--type', 'bz2', src, tgt, bsdiff_patch.name]
      # Running the bsdiff operation
      if subprocess.call(cmd) != 0:
        raise Error('Failed to do {} command: {}'
                    .format(operation, cmd))

      logging.debug('%s(%d -> %d) : bsdiff(%d), puffdiff(%d)',
                    os.path.basename(src),
                    os.stat(src).st_size, os.stat(tgt).st_size,
                    os.stat(bsdiff_patch.name).st_size,
                    os.stat(puffdiff_patch.name).st_size)

  return 0

if __name__ == '__main__':
  sys.exit(main(sys.argv))


text:
class Rewards < ActiveRecord::Base
end


text:
// Copyright 2017 by PeopleWare n.v..
// 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;

using NHibernate;

using PPWCode.Vernacular.Persistence.IV;

namespace PPWCode.Vernacular.NHibernate.III.MappingByCode
{
    public abstract class AuditLogMapper<T, TId> : PersistentObjectMapper<T, TId>
        where T : AuditLog<TId>
        where TId : IEquatable<TId>
    {
        protected AuditLogMapper()
        {
            Property(x => x.EntryType, m => m.NotNullable(true));
            Property(x => x.EntityName, m => m.NotNullable(true));
            Property(x => x.EntityId, m => m.NotNullable(true));
            Property(x => x.PropertyName);
            Property(x => x.OldValue, m => m.Type(NHibernateUtil.StringClob));
            Property(x => x.NewValue, m => m.Type(NHibernateUtil.StringClob));
            Property(x => x.CreatedAt, m => m.NotNullable(true));
            Property(x => x.CreatedBy, m => m.NotNullable(true));
        }
    }
}


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Persistencia.DAO.Implementacion;

import Persistencia.DAO.Interface.ITipoPropiedad;
import Persistencia.DAO.Util.GenericDAO;
import Persistencia.Modelo.TipoPropiedad;
import java.util.ArrayList;
import java.util.List;
import org.hibernate.Session;
import org.hibernate.Transaction;

/**
 *
 * @author Angelo
 */
public class TipoPropiedadDAO extends GenericDAO<TipoPropiedad, Integer> implements ITipoPropiedad {

    @Override
    public List<TipoPropiedad> listar() {
        Session session = getHibernateTemplate();
        List<TipoPropiedad> objetos = new ArrayList<TipoPropiedad>();
        Transaction tx = null;
        try {

            //   tx = session.beginTransaction();
            objetos = session.createQuery("from TipoPropiedad").list();
            //   tx.commit();
        } catch (RuntimeException e) {
            e.printStackTrace();
        }
        return objetos;
    }

    public List<TipoPropiedad> buscar(String nombre) {
        Session session = getHibernateTemplate();
        List<TipoPropiedad> objetos = new ArrayList<TipoPropiedad>();
        try {
            String sql = "from TipoPropiedad where nombre = :nombre";
            objetos = session.createQuery(sql).setParameter("nombre", nombre).list();
        } catch (RuntimeException e) {
            e.printStackTrace();
        }
        return objetos;
    }

    public List<TipoPropiedad> tipoPropiedadEnUso(int id) {

        Session session = getHibernateTemplate();
        List<TipoPropiedad> objetos = new ArrayList<TipoPropiedad>();
        try {
            String sql = "select * from TipoPropiedad s inner join propiedad sp ON s.id_tipoPropiedad = sp.tipoPropiedad WHERE s.id_tipoPropiedad LIKE :id ";
            objetos = session.createSQLQuery(sql).addEntity(TipoPropiedad.class).setParameter("id", id).list();
        } catch (RuntimeException e) {
            e.printStackTrace();
        }
        return objetos;
    }
}


text:
package io.plasmap.model

case class OsmProperties(
                          osmId: OsmId,
                          user: Option[OsmUser] = None,
                          version: OsmVersion
                          ) {
  override def toString = StringBuilder.newBuilder.++=(osmId.toString).++=(user.getOrElse("unknown").toString).++=(version.toString).toString()
}


text:
package route53iface

import (
	"github.com/aws/aws-sdk-go/aws/service"
	"github.com/aws/aws-sdk-go/service/route53"
)

// Route53API is the interface type for route53.Route53.
type Route53API interface {
	AssociateVPCWithHostedZoneRequest(*route53.AssociateVPCWithHostedZoneInput) (*service.Request, *route53.AssociateVPCWithHostedZoneOutput)

	AssociateVPCWithHostedZone(*route53.AssociateVPCWithHostedZoneInput) (*route53.AssociateVPCWithHostedZoneOutput, error)

	ChangeResourceRecordSetsRequest(*route53.ChangeResourceRecordSetsInput) (*service.Request, *route53.ChangeResourceRecordSetsOutput)

	ChangeResourceRecordSets(*route53.ChangeResourceRecordSetsInput) (*route53.ChangeResourceRecordSetsOutput, error)

	ChangeTagsForResourceRequest(*route53.ChangeTagsForResourceInput) (*service.Request, *route53.ChangeTagsForResourceOutput)

	ChangeTagsForResource(*route53.ChangeTagsForResourceInput) (*route53.ChangeTagsForResourceOutput, error)

	CreateHealthCheckRequest(*route53.CreateHealthCheckInput) (*service.Request, *route53.CreateHealthCheckOutput)

	CreateHealthCheck(*route53.CreateHealthCheckInput) (*route53.CreateHealthCheckOutput, error)

	CreateHostedZoneRequest(*route53.CreateHostedZoneInput) (*service.Request, *route53.CreateHostedZoneOutput)

	CreateHostedZone(*route53.CreateHostedZoneInput) (*route53.CreateHostedZoneOutput, error)

	CreateReusableDelegationSetRequest(*route53.CreateReusableDelegationSetInput) (*service.Request, *route53.CreateReusableDelegationSetOutput)

	CreateReusableDelegationSet(*route53.CreateReusableDelegationSetInput) (*route53.CreateReusableDelegationSetOutput, error)

	DeleteHealthCheckRequest(*route53.DeleteHealthCheckInput) (*service.Request, *route53.DeleteHealthCheckOutput)

	DeleteHealthCheck(*route53.DeleteHealthCheckInput) (*route53.DeleteHealthCheckOutput, error)

	DeleteHostedZoneRequest(*route53.DeleteHostedZoneInput) (*service.Request, *route53.DeleteHostedZoneOutput)

	DeleteHostedZone(*route53.DeleteHostedZoneInput) (*route53.DeleteHostedZoneOutput, error)

	DeleteReusableDelegationSetRequest(*route53.DeleteReusableDelegationSetInput) (*service.Request, *route53.DeleteReusableDelegationSetOutput)

	DeleteReusableDelegationSet(*route53.DeleteReusableDelegationSetInput) (*route53.DeleteReusableDelegationSetOutput, error)

	DisassociateVPCFromHostedZoneRequest(*route53.DisassociateVPCFromHostedZoneInput) (*service.Request, *route53.DisassociateVPCFromHostedZoneOutput)

	DisassociateVPCFromHostedZone(*route53.DisassociateVPCFromHostedZoneInput) (*route53.DisassociateVPCFromHostedZoneOutput, error)

	GetChangeRequest(*route53.GetChangeInput) (*service.Request, *route53.GetChangeOutput)

	GetChange(*route53.GetChangeInput) (*route53.GetChangeOutput, error)

	GetCheckerIPRangesRequest(*route53.GetCheckerIPRangesInput) (*service.Request, *route53.GetCheckerIPRangesOutput)

	GetCheckerIPRanges(*route53.GetCheckerIPRangesInput) (*route53.GetCheckerIPRangesOutput, error)

	GetGeoLocationRequest(*route53.GetGeoLocationInput) (*service.Request, *route53.GetGeoLocationOutput)

	GetGeoLocation(*route53.GetGeoLocationInput) (*route53.GetGeoLocationOutput, error)

	GetHealthCheckRequest(*route53.GetHealthCheckInput) (*service.Request, *route53.GetHealthCheckOutput)

	GetHealthCheck(*route53.GetHealthCheckInput) (*route53.GetHealthCheckOutput, error)

	GetHealthCheckCountRequest(*route53.GetHealthCheckCountInput) (*service.Request, *route53.GetHealthCheckCountOutput)

	GetHealthCheckCount(*route53.GetHealthCheckCountInput) (*route53.GetHealthCheckCountOutput, error)

	GetHealthCheckLastFailureReasonRequest(*route53.GetHealthCheckLastFailureReasonInput) (*service.Request, *route53.GetHealthCheckLastFailureReasonOutput)

	GetHealthCheckLastFailureReason(*route53.GetHealthCheckLastFailureReasonInput) (*route53.GetHealthCheckLastFailureReasonOutput, error)

	GetHealthCheckStatusRequest(*route53.GetHealthCheckStatusInput) (*service.Request, *route53.GetHealthCheckStatusOutput)

	GetHealthCheckStatus(*route53.GetHealthCheckStatusInput) (*route53.GetHealthCheckStatusOutput, error)

	GetHostedZoneRequest(*route53.GetHostedZoneInput) (*service.Request, *route53.GetHostedZoneOutput)

	GetHostedZone(*route53.GetHostedZoneInput) (*route53.GetHostedZoneOutput, error)

	GetHostedZoneCountRequest(*route53.GetHostedZoneCountInput) (*service.Request, *route53.GetHostedZoneCountOutput)

	GetHostedZoneCount(*route53.GetHostedZoneCountInput) (*route53.GetHostedZoneCountOutput, error)

	GetReusableDelegationSetRequest(*route53.GetReusableDelegationSetInput) (*service.Request, *route53.GetReusableDelegationSetOutput)

	GetReusableDelegationSet(*route53.GetReusableDelegationSetInput) (*route53.GetReusableDelegationSetOutput, error)

	ListGeoLocationsRequest(*route53.ListGeoLocationsInput) (*service.Request, *route53.ListGeoLocationsOutput)

	ListGeoLocations(*route53.ListGeoLocationsInput) (*route53.ListGeoLocationsOutput, error)

	ListHealthChecksRequest(*route53.ListHealthChecksInput) (*service.Request, *route53.ListHealthChecksOutput)

	ListHealthChecks(*route53.ListHealthChecksInput) (*route53.ListHealthChecksOutput, error)

	ListHealthChecksPages(*route53.ListHealthChecksInput, func(*route53.ListHealthChecksOutput, bool) bool) error

	ListHostedZonesRequest(*route53.ListHostedZonesInput) (*service.Request, *route53.ListHostedZonesOutput)

	ListHostedZones(*route53.ListHostedZonesInput) (*route53.ListHostedZonesOutput, error)

	ListHostedZonesPages(*route53.ListHostedZonesInput, func(*route53.ListHostedZonesOutput, bool) bool) error

	ListHostedZonesByNameRequest(*route53.ListHostedZonesByNameInput) (*service.Request, *route53.ListHostedZonesByNameOutput)

	ListHostedZonesByName(*route53.ListHostedZonesByNameInput) (*route53.ListHostedZonesByNameOutput, error)

	ListResourceRecordSetsRequest(*route53.ListResourceRecordSetsInput) (*service.Request, *route53.ListResourceRecordSetsOutput)

	ListResourceRecordSets(*route53.ListResourceRecordSetsInput) (*route53.ListResourceRecordSetsOutput, error)

	ListResourceRecordSetsPages(*route53.ListResourceRecordSetsInput, func(*route53.ListResourceRecordSetsOutput, bool) bool) error

	ListReusableDelegationSetsRequest(*route53.ListReusableDelegationSetsInput) (*service.Request, *route53.ListReusableDelegationSetsOutput)

	ListReusableDelegationSets(*route53.ListReusableDelegationSetsInput) (*route53.ListReusableDelegationSetsOutput, error)

	ListTagsForResourceRequest(*route53.ListTagsForResourceInput) (*service.Request, *route53.ListTagsForResourceOutput)

	ListTagsForResource(*route53.ListTagsForResourceInput) (*route53.ListTagsForResourceOutput, error)

	ListTagsForResourcesRequest(*route53.ListTagsForResourcesInput) (*service.Request, *route53.ListTagsForResourcesOutput)

	ListTagsForResources(*route53.ListTagsForResourcesInput) (*route53.ListTagsForResourcesOutput, error)

	UpdateHealthCheckRequest(*route53.UpdateHealthCheckInput) (*service.Request, *route53.UpdateHealthCheckOutput)

	UpdateHealthCheck(*route53.UpdateHealthCheckInput) (*route53.UpdateHealthCheckOutput, error)

	UpdateHostedZoneCommentRequest(*route53.UpdateHostedZoneCommentInput) (*service.Request, *route53.UpdateHostedZoneCommentOutput)

	UpdateHostedZoneComment(*route53.UpdateHostedZoneCommentInput) (*route53.UpdateHostedZoneCommentOutput, error)
}


text:
@interface VLDRegExpValidator : NSObject <VLDTextValidator>

@property (nonatomic, copy) NSString *text;

// Override this method to implement custom validator
+ (NSString *)regExpPattern;

@end


text:
<?php

/**
 * Model_QueueTable
 *
 * This class has been auto-generated by the Doctrine ORM Framework
 */
class Model_QueueTable extends Ext_Doctrine_Table
{
    /**
     * Returns an instance of this class.
     *
     * @return object Model_QueueTable
     */
    public static function getInstance()
    {
        return Doctrine_Core::getTable('Model_Queue');
    }
}


text:
package io.github.factoryfx.javafx.factoryviewmanager;

import io.github.factoryfx.factory.FactoryBase;
import io.github.factoryfx.factory.SimpleFactoryBase;
import io.github.factoryfx.javafx.RichClientRoot;

/**
 *
 * @param <RS> Server root
 *
 */
public abstract class FactoryAwareWidgetFactory<RS extends FactoryBase<?,RS>> extends SimpleFactoryBase<FactoryAwareWidget<RS>,RichClientRoot> {

    @Override
    protected FactoryAwareWidget<RS> createImpl() {
        return createWidget();
    }

    protected abstract FactoryAwareWidget<RS> createWidget() ;
}


text:
<!--[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-RxParse-brightgreen.svg?style=flat)](http://android-arsenal.com/details/1/1670)-->
<!--[![Download](https://api.bintray.com/packages/yongjhih/maven/kotlin-system-services/images/download.svg) ](https://bintray.com/yongjhih/maven/kotlin-system-services/_latestVersion)-->
[![JitPack](https://img.shields.io/github/tag/yongjhih/kotlin-system-services.svg?label=JitPack)](https://jitpack.io/#yongjhih/kotlin-system-services)
[![javadoc](https://img.shields.io/github/tag/yongjhih/kotlin-system-services.svg?label=javadoc)](https://jitpack.io/com/github/yongjhih/kotlin-system-services/-SNAPSHOT/javadoc/)
[![Build Status](https://travis-ci.org/yongjhih/kotlin-system-services.svg)](https://travis-ci.org/yongjhih/kotlin-system-services)
[![Join the chat at https://gitter.im/yongjhih/kotlin-system-services](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/yongjhih/kotlin-system-services?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

![](art/kotlin-system-services.png)

## Deprecated

Please use android-ktx instead. (ref. https://android.github.io/android-ktx/core-ktx/androidx.content/android.content.-context/system-service.html)

```kotlin
val notificationManager = context.systemService<NotificationManager>();
```

## Usage

Before:

```java
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
```

After:

```kotlin
val notificationManager = context.getNotificationManager()
```

## Installation

jcenter:

```gradle
dependencies {
    compile 'com.infstory:kotlin-system-services:1.0.0'
}
```

jitpack:

```gradle
repositories {
    // ...
    maven { url "https://jitpack.io" }
}
dependencies {
    compile 'com.github.yongjhih:kotlin-system-services:-SNAPSHOT'
}
```

## License

```
Copyright 2015 8tory, Inc.

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.
```