text:
import logging
l = logging.getLogger(__name__)

from .models import (AnonymousVisitor, Experiment,
                                            Participant)

class WebUser(object):
    """
    Wrapper class that implements an 'ExperimentUser' object from a web
    request.
    """
    def __init__(self, request):
        self.request = request
        self.user = request.user
        self.session = request.session

    def is_anonymous(self):
        return self.user.is_anonymous()

    def set_anonymous_id(self, anonymous_id):
        self.session['anonymous_id'] = anonymous_id

    def get_anonymous_id(self):
        return self.session.get('anonymous_id', None)

    def get_registered_user(self):
        if self.user.is_anonymous():
            return None
        return self.user

    def is_verified_human(self):
        return self.session.get('verified_human', False)

    def get_or_create_anonymous_visitor(self):
        anonymous_visitor = None
        anonymous_id = self.get_anonymous_id()
        if anonymous_id is not None:
            anonymous_visitors = AnonymousVisitor.objects.filter(
                id=anonymous_id
            )
            if len(anonymous_visitors) == 1:
                anonymous_visitor = anonymous_visitors[0]
        if not anonymous_visitor:
            anonymous_visitor = AnonymousVisitor.objects.create()
            self.set_anonymous_id(anonymous_visitor.id)
        return anonymous_visitor

    def confirm_human(self):
        self.session['verified_human'] = True
        enrollments = self.session.get('temporary_enrollments', {})
        if not enrollments:
            # nothing to do - no need to create an AnonymousVisitor.
            return

        anonymous_visitor = self.get_or_create_anonymous_visitor()
        for experiment_name, group_id in enrollments.items():
            try:
                experiment = Experiment.objects.get(name=experiment_name)
            except:
                continue
            try:
                Participant.objects.create(anonymous_visitor=anonymous_visitor,
                                           experiment=experiment,
                                           group=group_id)
            except:
                pass
            del self.session['temporary_enrollments'][experiment_name]

    def store_temporary_enrollment(self, experiment_name, group_id):
        enrollments = self.session.get('temporary_enrollments', None)
        if enrollments is None:
            self.session['temporary_enrollments'] = {}
        self.session['temporary_enrollments'][experiment_name] = group_id

    def get_added_enrollments(self):
        return self.session.get('temporary_enrollments', None)

    def get_temporary_enrollment(self, experiment_name):
        added_enrollments = self.get_added_enrollments()
        if not added_enrollments:
            return None
        else:
            return added_enrollments.get(experiment_name, None)

class StaticUser(WebUser):
    def __init__(self):
        from django.contrib.auth.models import AnonymousUser
        self.request = None
        self.user = AnonymousUser()
        self.session = {}

class WebUserFactory(object):
    """
    Factory that creates 'ExperimentUser' objects from a web context.
    """
    def create_user(self, context):
        request = context.get('request', None)
        if request is None:
            return StaticUser()
        return WebUser(request)


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<title>Python: module telemetry.timeline.flow_event</title>
<meta charset="utf-8">

<big><big>telemetry.timeline.flow_event</big></big>	index
telemetry/timeline/flow_event.py

<tt># Copyright 2014 The Chromium Authors. All rights reserved.

# Use of this source code is governed by a BSD-style license that can be

# found in the LICENSE file.</tt>

<big>Modules</big>

<tt>      </tt>

telemetry.timeline.event

<big>Classes</big>

<tt>      </tt>

telemetry.timeline.event.TimelineEvent(__builtin__.object)

FlowEvent

class FlowEvent(telemetry.timeline.event.TimelineEvent)

<tt>   </tt>
<tt>A FlowEvent represents an interval of time plus parameters associated

with that interval.
 </tt>

Method resolution order:

FlowEvent

telemetry.timeline.event.TimelineEvent

__builtin__.object

Methods defined here:

__init__(self, category, event_id, name, start, args=None)

Methods inherited from telemetry.timeline.event.TimelineEvent:

__repr__(self)

Data descriptors inherited from telemetry.timeline.event.TimelineEvent:

__dict__

<tt>dictionary for instance variables (if defined)</tt>

__weakref__

<tt>list of weak references to the object (if defined)</tt>

end

has_thread_timestamps

thread_end

<tt>Thread-specific CPU time when this event ended.

May be None if the trace event didn't have thread time data.</tt>

redpajama_set_name: RedPajamaGithub


text:
@implementation AnimalFactory

+ (Animal *)animal {
    return Animal.new;
}

+ (Dog *)dog {
    return Dog.new;
}

+ (Person *)person {
    return Person.new;
}

+ (MasterPerson *)masterPerson {
    return MasterPerson.new;
}

@end


text:
@interface LeEventChooseTimeView()
@property (weak, nonatomic) IBOutlet UIImageView *chooseImg;
@property (weak, nonatomic) IBOutlet UIButton *beginBtn;
@property (weak, nonatomic) IBOutlet UIButton *endBtn;
@property (weak, nonatomic) IBOutlet UIButton *chooseBtn;
@end

@implementation LeEventChooseTimeView

-(instancetype)initWithCoder:(NSCoder *)aDecoder {
    self = [super initWithCoder:aDecoder];
    return self;
}

-(void)awakeFromNib {
    [super awakeFromNib];

    self.chooseImg.layer.cornerRadius = CGRectGetWidth(self.chooseImg.bounds)/2;
    CAShapeLayer *borderLayer = [CAShapeLayer layer];
    borderLayer.bounds = CGRectMake(0, 0, self.chooseImg.le_width, self.chooseImg.le_height);
    borderLayer.position = CGPointMake(CGRectGetMidX(self.chooseImg.bounds), CGRectGetMidY(self.chooseImg.bounds));

    borderLayer.path = [UIBezierPath bezierPathWithRoundedRect:borderLayer.bounds cornerRadius:3].CGPath;
    borderLayer.lineWidth = 1. / [[UIScreen mainScreen] scale];
    borderLayer.lineDashPattern = @[@3, @3];
    borderLayer.fillColor = [UIColor clearColor].CGColor;
    borderLayer.strokeColor = [UIColor grayColor].CGColor;
    [self.chooseImg.layer addSublayer:borderLayer];
}

- (IBAction)chooseClick:(UIButton *)sender {
    if([self.delegate respondsToSelector:@selector(onChooseClick:)]) {
        [self.delegate onChooseClick:sender];
    }
}

- (IBAction)beginClick:(UIButton *)sender {
    if([self.delegate respondsToSelector:@selector(onBeginBtnClick:)]) {
        [self.delegate onBeginBtnClick:sender];
    }
}

- (IBAction)endClick:(UIButton *)sender {
    if([self.delegate respondsToSelector:@selector(onEndBtnClick:)]) {
        [self.delegate onEndBtnClick:sender];
    }
}

-(UIImageView *) getCoverImg {
    return self.chooseImg;
}

@end


text:
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using EntityFx.Gdcame.Test.PerfomanceFramework;
using EntityFX.Gdcame.Application.Contract.Model;
using EntityFX.Gdcame.Common.Application.Model;
using EntityFX.Gdcame.Infrastructure.Common;
using PerformanceCounter = EntityFx.Gdcame.Test.PerfomanceFramework.PerformanceCounter;

namespace EntityFx.Gdcame.Test.Perfomance
{
    class PerfomanceTester
    {
        private ClientConnectionInfo[] ClientConnections { get; set; }

        private const string DefaultPassword = "P@ssw0rd";

        private readonly Uri[] _serviceUri;

        private readonly ILogger _logger;
        private readonly int _parallelism;

        private readonly List<TestResultInfo> _testsInfo = new List<TestResultInfo>();

        private readonly PerformanceApi _performanceApi;

        public IReadOnlyList<TestResultInfo> TestInfo
        {
            get { return _testsInfo; }
        }

        public PerfomanceTester(Uri[] serviceUriList, ILogger logger, int parallelism)
        {
            _serviceUri = serviceUriList;
            _logger = logger;
            _parallelism = parallelism;
            _performanceApi = new PerformanceApi(serviceUriList, logger);
        }

        public Tuple<PerformanceAggregate, string[]> TestEchoAuth(int countAccounts, string text, bool isParallel)
        {
            var sw = new Stopwatch();
            Tuple<PerformanceAggregate, string[]> getGameDataResult = null;

            _logger.Info("\tStart register {0} accounts in parallel", countAccounts);
            sw.Restart();
            var registerManyAccountsResult = _performanceApi.RegisterManyAccounts(countAccounts, text, isParallel);
            PrintPerfomanceAggregateResults(registerManyAccountsResult);
            _logger.Info("\tDone register {0} accounts, elapsed: {1}, {2} milliseconds per one", countAccounts,
                sw.Elapsed, sw.Elapsed.TotalMilliseconds/countAccounts);

            _logger.Info("\tStart login {0} accounts in parallel", countAccounts);
            var loginManyAccountsResult = _performanceApi.LoginManyClients(countAccounts, text);
            PrintPerfomanceAggregateResults(loginManyAccountsResult.Item1);
            _logger.Info("\tDone login {0} accounts, elapsed: {1}, {2} milliseconds per one", countAccounts, sw.Elapsed,
                sw.Elapsed.TotalMilliseconds/countAccounts);

            _logger.Info("\tStart echo with auth {0} in parallel", countAccounts);
            sw.Restart();
            if (isParallel)
            {
                try
                {
                    getGameDataResult = _performanceApi.DoParallelTasks(0, countAccounts, _parallelism,
                        i => _performanceApi.Echo(loginManyAccountsResult.Item2[i], text)
                        , counter =>
                        {
                            if (counter%_parallelism == 0)
                            {
                                Console.WriteLine("Echoed {0} times", counter);
                            }
                        });
                }
                catch (Exception e)
                {
                    _logger.Error(e);
                }
            }
            else
            {
                try
                {
                    getGameDataResult = _performanceApi.DoSequenceTask(0, countAccounts,
                        i => _performanceApi.Echo(loginManyAccountsResult.Item2[i], text)
                        , counter =>
                        {
                            if (counter%_parallelism == 0)
                            {
                                Console.WriteLine("Echoed {0} times", counter);
                            }
                        });
                }
                catch (Exception e)
                {
                    _logger.Error(e);
                }
            }
            if (getGameDataResult != null) PrintPerfomanceAggregateResults(getGameDataResult.Item1);
            _logger.Info("\tDone echo for {0} accounts, elapsed: {1}, {2} milliseconds per one", countAccounts,
                sw.Elapsed, sw.Elapsed.TotalMilliseconds/countAccounts);

            var adminConnection = _performanceApi.LoginAsAdmin().Result.Item2;
            _performanceApi.StopAllGames(adminConnection);

            return getGameDataResult;
        }

        public Tuple<PerformanceAggregate, string[]> TestEcho(int countAccounts, string text, bool isParallel)
        {
            var sw = new Stopwatch();
            Tuple<PerformanceAggregate, string[]> getGameDataResult = null;
            _logger.Info("\tStart echo  {0} in parallel={1}", countAccounts, isParallel);

            var serverConnections = _performanceApi.GetServerConnections(countAccounts);

            sw.Restart();

            if (isParallel)
            {
                try
                {
                    getGameDataResult = _performanceApi.DoParallelTasks(0, countAccounts, _parallelism,
                        i => _performanceApi.Echo(serverConnections[i], text), counter =>
                        {
                            if (counter% _parallelism == 0)
                            {
                                Console.WriteLine("Echoed {0} times", counter);
                            }
                        });
                }
                catch (Exception e)
                {
                    _logger.Error(e);
                }
            }
            else
            {
                try
                {
                    getGameDataResult = _performanceApi.DoSequenceTask(0, countAccounts,
                        i => _performanceApi.Echo(serverConnections[i], text)
                        , counter =>
                        {
                            if (counter % _parallelism == 0)
                            {
                                Console.WriteLine("Echoed {0} times", counter);
                            }
                        });
                }
                catch (Exception e)
                {
                    _logger.Error(e);
                }
            }

            if (getGameDataResult != null) PrintPerfomanceAggregateResults(getGameDataResult.Item1);
            _logger.Info("\tDone echo for {0} accounts, elapsed: {1}, {2} milliseconds per one", countAccounts, sw.Elapsed, sw.Elapsed.TotalMilliseconds / countAccounts);
            return getGameDataResult;
        }

        public void TestStartManyGames(int countAccounts, string accounLoginPrefix)
        {
            var testResult = new List<TestActionResultItem>();
            var sw = new Stopwatch();
            var adminConnection = _performanceApi.LoginAsAdmin().Result.Item2;

            _logger.Info("\tStart register {0} accounts in parallel", countAccounts);
            sw.Restart();
            var registerManyAccountsResult = _performanceApi.RegisterManyAccounts(countAccounts, accounLoginPrefix, true);
            PrintPerfomanceAggregateResults(registerManyAccountsResult);
            _logger.Info("\tDone register {0} accounts, elapsed: {1}, {2} milliseconds per one", countAccounts, sw.Elapsed, sw.Elapsed.TotalMilliseconds / countAccounts);

            _logger.Info("\tStart login {0} accounts in parallel", countAccounts);
            var loginManyAccountsResult = _performanceApi.LoginManyClients(countAccounts, accounLoginPrefix);
            PrintPerfomanceAggregateResults(loginManyAccountsResult.Item1);
            _logger.Info("\tDone login {0} accounts, elapsed: {1}, {2} milliseconds per one", countAccounts, sw.Elapsed, sw.Elapsed.TotalMilliseconds / countAccounts);
            sw.Restart();

            _logger.Info("\tStart get game data for {0} accounts in parallel", countAccounts);
            Tuple<PerformanceAggregate, GameDataModel[]> getGameDataResult = null;
            try
            {
                getGameDataResult = _performanceApi.DoParallelTasks(0, countAccounts, _parallelism, i =>
                    {
                        return loginManyAccountsResult.Item2[i] != null ? _performanceApi.GetGameData(loginManyAccountsResult.Item2[i]) : null;
                    }
                    , counter =>
                    {
                        if (counter % _parallelism == 0)
                        {
                            Console.WriteLine("Got game data for {0} accounts", counter);
                        }
                    });
            }
            catch (Exception e)
            {
                _logger.Error(e);
            }
            if (getGameDataResult != null) PrintPerfomanceAggregateResults(getGameDataResult.Item1);
            _logger.Info("\tDone get game data for {0} accounts, elapsed: {1}, {2} milliseconds per one", countAccounts, sw.Elapsed, sw.Elapsed.TotalMilliseconds / countAccounts);
        }

        private void PrintPerfomanceAggregateResults(PerformanceAggregate performanceAggregate)
        {
            Console.WriteLine("Total={0}, Min={1}, Max={2}, Avg={3} ms"
                , performanceAggregate.TotalElapsed, performanceAggregate.Min, performanceAggregate.Max, performanceAggregate.AvgMilliSeconds);
            Console.WriteLine("Statistics by server:");
            foreach (var serverErrorsCount in performanceAggregate.PerformanceStatisticsByServer)
            {
                Console.WriteLine("\t{0}:", serverErrorsCount.Key);
                Console.WriteLine("\t\tTotal={0}, Mi ={1}, Max={2}, Avg={3} ms",
                    serverErrorsCount.Value.TotalElapsed, serverErrorsCount.Value.Min, serverErrorsCount.Value.Max, serverErrorsCount.Value.AvgMilliSeconds);
                Console.WriteLine("\t\t Errors: {0}", serverErrorsCount.Value.CountErrors);
            }
        }

        public void TestGetGameData(int countAccounts, string accounLoginPrefix, bool useParallel)
        {
            var testResult = new List<TestActionResultItem>();
            var sw = new Stopwatch();
            var adminConnection = _performanceApi.LoginAsAdmin().Result.Item2;

            _performanceApi.RegisterManyAccounts(countAccounts, accounLoginPrefix, useParallel);
            Thread.Sleep(1000);

            ClientConnectionInfo[] clientLogins = _performanceApi.LoginManyClients(countAccounts, accounLoginPrefix).Item2;
            Thread.Sleep(1000);

            if (useParallel)
            {
                _logger.Info("\tStart get game data for {0} accounts in parallel", countAccounts);
                sw.Start();
                List<Task<Tuple<PerformanceCounter, GameDataModel>>> gemaDataTasks = new List<Task<Tuple<PerformanceCounter, GameDataModel>>>();
                try
                {
                    for (var i = 0; i < countAccounts; ++i)
                    {
                        gemaDataTasks.Add(_performanceApi.GetGameData(clientLogins[i]));
                    };
                    Task.WaitAll(gemaDataTasks.ToArray());
                }
                catch (Exception)
                {

                }
                _logger.Info("\tDone get game data for {0} accounts, elapsed: {1}, {2} milliseconds per one", countAccounts, sw.Elapsed, sw.Elapsed.TotalMilliseconds / countAccounts);
                testResult.Add(new TestActionResultItem { ActionName = "GetGameData (Parallel)", ElapsedMilliseconds = sw.Elapsed.TotalMilliseconds / countAccounts, TotalElapsed = sw.Elapsed });
            }
            else
            {
                _logger.Info("\tStart get game data for {0} accounts", countAccounts);
                sw.Restart();
                try
                {
                    for (var i = 0; i < countAccounts; ++i)
                    {
                        var result = _performanceApi.GetGameData(clientLogins[i]).Result;
                    };
                }
                catch (Exception)
                {

                }
                _logger.Info("\tDone get game data for {0} accounts, elapsed: {1}, {2} milliseconds per one", countAccounts, sw.Elapsed, sw.Elapsed.TotalMilliseconds / countAccounts);
                testResult.Add(new TestActionResultItem { ActionName = "GetGameData", ElapsedMilliseconds = sw.Elapsed.TotalMilliseconds / countAccounts, TotalElapsed = sw.Elapsed });
            }
            Thread.Sleep(1000);

            sw.Restart();
            _performanceApi.LogoutManyClients(clientLogins);
            testResult.Add(new TestActionResultItem { ActionName = "LogoutManyClients", ElapsedMilliseconds = sw.Elapsed.TotalMilliseconds / countAccounts, TotalElapsed = sw.Elapsed });
            Thread.Sleep(1000);

            sw.Restart();
            _performanceApi.DeleteManyAccounts(adminConnection, countAccounts, accounLoginPrefix, true);
            testResult.Add(new TestActionResultItem { ActionName = "DeleteManyAccounts", ElapsedMilliseconds = sw.Elapsed.TotalMilliseconds / countAccounts, TotalElapsed = sw.Elapsed });
            Thread.Sleep(1000);

            _performanceApi.Logout(adminConnection).Wait();
            Thread.Sleep(1000);

            _testsInfo.Add(new TestResultInfo { TestName = "TestGetGameData", TestActionResults = testResult.ToArray() });
        }

        public void TestPerformStepAction(int countAccounts, string accounLoginPrefix, bool useParallel)
        {
            var testResult = new List<TestActionResultItem>();
            var sw = new Stopwatch();
            var adminConnection = _performanceApi.LoginAsAdmin().Result.Item2;

            _performanceApi.RegisterManyAccounts(countAccounts, accounLoginPrefix, useParallel);
            Thread.Sleep(1000);

            ClientConnectionInfo[] clientLogins = _performanceApi.LoginManyClients(countAccounts, accounLoginPrefix).Item2;
            Thread.Sleep(1000);

            if (useParallel)
            {
                _logger.Info("\tStart perform step for {0} accounts in parallel", countAccounts);
                sw.Restart();
                List<Task<Tuple<PerformanceCounter, ManualStepResultModel>>> gemaDataTasks = new List<Task<Tuple<PerformanceCounter, ManualStepResultModel>>>();
                for (var i = 0; i < countAccounts; ++i)
                {
                    gemaDataTasks.Add(_performanceApi.PerformStep(clientLogins[i]));
                };
                Task.WaitAll(gemaDataTasks.ToArray());
                _logger.Info("\tDone perform step for {0} accounts, elapsed: {1}, {2} milliseconds per one", countAccounts, sw.Elapsed, sw.Elapsed.TotalMilliseconds / countAccounts);
                testResult.Add(new TestActionResultItem { ActionName = "PerformSte (Parallel)", ElapsedMilliseconds = sw.Elapsed.TotalMilliseconds / countAccounts, TotalElapsed = sw.Elapsed });
            }
            else
            {
                _logger.Info("\tStart perform step for {0} accounts", countAccounts);
                sw.Restart();
                for (var i = 0; i < countAccounts; ++i)
                {
                    var result = _performanceApi.GetGameData(clientLogins[i]).Result;
                };

                _logger.Info("\tDone perform step for {0} accounts, elapsed: {1}, {2} milliseconds per one", countAccounts, sw.Elapsed, sw.Elapsed.TotalMilliseconds / countAccounts);
                testResult.Add(new TestActionResultItem { ActionName = "PerformStep", ElapsedMilliseconds = sw.Elapsed.TotalMilliseconds / countAccounts, TotalElapsed = sw.Elapsed });
            }
            Thread.Sleep(1000);

            sw.Restart();
            _performanceApi.LogoutManyClients(clientLogins);
            testResult.Add(new TestActionResultItem { ActionName = "LogoutManyClients", ElapsedMilliseconds = sw.Elapsed.TotalMilliseconds / countAccounts, TotalElapsed = sw.Elapsed });
            Thread.Sleep(1000);

            sw.Restart();
            _performanceApi.DeleteManyAccounts(adminConnection, countAccounts, accounLoginPrefix, true);
            testResult.Add(new TestActionResultItem { ActionName = "DeleteManyAccounts", ElapsedMilliseconds = sw.Elapsed.TotalMilliseconds / countAccounts, TotalElapsed = sw.Elapsed });
            Thread.Sleep(1000);

            _performanceApi.Logout(adminConnection).Wait();
            Thread.Sleep(1000);
            _testsInfo.Add(new TestResultInfo { TestName = "TestPerformStepAction", TestActionResults = testResult.ToArray() });
        }

        public void TestPerformanceRegisterManyAccounts(int countAccounts, string accounLoginPrefix, bool useParallel)
        {
            var testResult = new List<TestActionResultItem>();
            var sw = new Stopwatch();
            var adminConnection = _performanceApi.LoginAsAdmin().Result.Item2;
            Thread.Sleep(1000);

            _logger.Info("\tStart register {0} accounts in parallel", countAccounts);
            sw.Start();
            _performanceApi.RegisterManyAccounts(countAccounts, accounLoginPrefix, useParallel);
            _logger.Info("\tDone register {0} accounts, elapsed: {1}, {2} milliseconds per one", countAccounts, sw.Elapsed, sw.Elapsed.TotalMilliseconds / countAccounts);
            testResult.Add(new TestActionResultItem { ActionName = "RegisterManyAccounts", ElapsedMilliseconds = sw.Elapsed.TotalMilliseconds / countAccounts, TotalElapsed = sw.Elapsed });

            sw.Restart();
            _logger.Info("\tStart delete {0} accounts", countAccounts);
            var deleteResult = _performanceApi.DeleteManyAccounts(adminConnection, countAccounts, accounLoginPrefix, useParallel);
            _logger.Info("\tSuccess deleted {0} accounts, Not found: {1}", countAccounts, 0);
            testResult.Add(new TestActionResultItem { ActionName = "DeleteManyAccounts", ElapsedMilliseconds = sw.Elapsed.TotalMilliseconds / countAccounts, TotalElapsed = sw.Elapsed });

            _performanceApi.Logout(adminConnection).Wait();
            Thread.Sleep(1000);
            _testsInfo.Add(new TestResultInfo { TestName = "TestPerformanceRegisterManyAccounts", TestActionResults = testResult.ToArray() });
        }
    }
}


text:
#include <Protocol/PciRootBridgeIo.h>

#include <Library/PciLib.h>
#include <Library/BaseLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/DebugLib.h>

/**
  Assert the validity of a PCI address. A valid PCI address should contain 1's
  only in the low 28 bits.

  @param  A The address to validate.
  @param  M Additional bits to assert to be zero.

**/
#define ASSERT_INVALID_PCI_ADDRESS(A,M) \
  ASSERT (((A) & (~0xfffffff | (M))) == 0)

/**
  Translate PCI Lib address into format of PCI Root Bridge I/O Protocol.

  @param  A  The address that encodes the PCI Bus, Device, Function and
             Register.

**/
#define PCI_TO_PCI_ROOT_BRIDGE_IO_ADDRESS(A) \
  ((((A) << 4) & 0xff000000) | (((A) >> 4) & 0x00000700) | (((A) << 1) & 0x001f0000) | (LShiftU64((A) & 0xfff, 32)))

//
// Global varible to cache pointer to PCI Root Bridge I/O protocol.
//
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL      *mPciRootBridgeIo = NULL;

/**
  The constructor function caches the pointer to PCI Root Bridge I/O protocol.

  The constructor function locates PCI Root Bridge I/O protocol from protocol database.
  It will ASSERT() if that operation fails and it will always return EFI_SUCCESS.

  @param  ImageHandle   The firmware allocated handle for the EFI image.
  @param  SystemTable   A pointer to the EFI System Table.

  @retval EFI_SUCCESS   The constructor always returns EFI_SUCCESS.

**/
EFI_STATUS
EFIAPI
PciLibConstructor (
  IN EFI_HANDLE                ImageHandle,
  IN EFI_SYSTEM_TABLE          *SystemTable
  )
{
  EFI_STATUS  Status;

  Status = gBS->LocateProtocol (&gEfiPciRootBridgeIoProtocolGuid, NULL, (VOID**) &mPciRootBridgeIo);
  ASSERT_EFI_ERROR (Status);
  ASSERT (mPciRootBridgeIo != NULL);

  return EFI_SUCCESS;
}

/**
  Internal worker function to read a PCI configuration register.

  This function wraps EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.Pci.Read() service.
  It reads and returns the PCI configuration register specified by Address,
  the width of data is specified by Width.

  @param  Address The address that encodes the PCI Bus, Device, Function and
                  Register.
  @param  Width   The width of data to read

  @return The value read from the PCI configuration register.

**/
UINT32
DxePciLibPciRootBridgeIoReadWorker (
  IN    UINTN                                  Address,
  IN    EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH  Width
  )
{
  UINT32  Data;

  mPciRootBridgeIo->Pci.Read (
                          mPciRootBridgeIo,
                          Width,
                          PCI_TO_PCI_ROOT_BRIDGE_IO_ADDRESS (Address),
                          1,
                          &Data
                          );

  return Data;
}

/**
  Internal worker function to writes a PCI configuration register.

  This function wraps EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.Pci.Write() service.
  It writes the PCI configuration register specified by Address with the
  value specified by Data. The width of data is specified by Width.
  Data is returned.

  @param  Address The address that encodes the PCI Bus, Device, Function and
                  Register.
  @param  Width   The width of data to write
  @param  Data    The value to write.

  @return The value written to the PCI configuration register.

**/
UINT32
DxePciLibPciRootBridgeIoWriteWorker (
  IN    UINTN                                  Address,
  IN    EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH  Width,
  IN    UINT32                                 Data
  )
{
  mPciRootBridgeIo->Pci.Write (
                          mPciRootBridgeIo,
                          Width,
                          PCI_TO_PCI_ROOT_BRIDGE_IO_ADDRESS (Address),
                          1,
                          &Data
                          );
  return Data;
}

/**
  Registers a PCI device so PCI configuration registers may be accessed after
  SetVirtualAddressMap().

  Registers the PCI device specified by Address so all the PCI configuration registers
  associated with that PCI device may be accessed after SetVirtualAddressMap() is called.

  If Address > 0x0FFFFFFF, then ASSERT().

  @param  Address The address that encodes the PCI Bus, Device, Function and
                  Register.

  @retval RETURN_SUCCESS           The PCI device was registered for runtime access.
  @retval RETURN_UNSUPPORTED       An attempt was made to call this function
                                   after ExitBootServices().
  @retval RETURN_UNSUPPORTED       The resources required to access the PCI device
                                   at runtime could not be mapped.
  @retval RETURN_OUT_OF_RESOURCES  There are not enough resources available to
                                   complete the registration.

**/
RETURN_STATUS
EFIAPI
PciRegisterForRuntimeAccess (
  IN UINTN  Address
  )
{
  ASSERT_INVALID_PCI_ADDRESS (Address, 0);
  return RETURN_UNSUPPORTED;
}

/**
  Reads an 8-bit PCI configuration register.

  Reads and returns the 8-bit PCI configuration register specified by Address.
  This function must guarantee that all PCI read and write operations are
  serialized.

  If Address > 0x0FFFFFFF, then ASSERT().

  @param  Address The address that encodes the PCI Bus, Device, Function and
                  Register.

  @return The read value from the PCI configuration register.

**/
UINT8
EFIAPI
PciRead8 (
  IN      UINTN                     Address
  )
{
  ASSERT_INVALID_PCI_ADDRESS (Address, 0);

  return (UINT8) DxePciLibPciRootBridgeIoReadWorker (Address, EfiPciWidthUint8);
}

/**
  Writes an 8-bit PCI configuration register.

  Writes the 8-bit PCI configuration register specified by Address with the
  value specified by Value. Value is returned. This function must guarantee
  that all PCI read and write operations are serialized.

  If Address > 0x0FFFFFFF, then ASSERT().

  @param  Address The address that encodes the PCI Bus, Device, Function and
                  Register.
  @param  Value   The value to write.

  @return The value written to the PCI configuration register.

**/
UINT8
EFIAPI
PciWrite8 (
  IN      UINTN                     Address,
  IN      UINT8                     Value
  )
{
  ASSERT_INVALID_PCI_ADDRESS (Address, 0);

  return (UINT8) DxePciLibPciRootBridgeIoWriteWorker (Address, EfiPciWidthUint8, Value);
}

/**
  Performs a bitwise OR of an 8-bit PCI configuration register with
  an 8-bit value.

  Reads the 8-bit PCI configuration register specified by Address, performs a
  bitwise OR between the read result and the value specified by
  OrData, and writes the result to the 8-bit PCI configuration register
  specified by Address. The value written to the PCI configuration register is
  returned. This function must guarantee that all PCI read and write operations
  are serialized.

  If Address > 0x0FFFFFFF, then ASSERT().

  @param  Address The address that encodes the PCI Bus, Device, Function and
                  Register.
  @param  OrData  The value to OR with the PCI configuration register.

  @return The value written back to the PCI configuration register.

**/
UINT8
EFIAPI
PciOr8 (
  IN      UINTN                     Address,
  IN      UINT8                     OrData
  )
{
  return PciWrite8 (Address, (UINT8) (PciRead8 (Address) | OrData));
}

/**
  Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit
  value.

  Reads the 8-bit PCI configuration register specified by Address, performs a
  bitwise AND between the read result and the value specified by AndData, and
  writes the result to the 8-bit PCI configuration register specified by
  Address. The value written to the PCI configuration register is returned.
  This function must guarantee that all PCI read and write operations are
  serialized.

  If Address > 0x0FFFFFFF, then ASSERT().

  @param  Address The address that encodes the PCI Bus, Device, Function and
                  Register.
  @param  AndData The value to AND with the PCI configuration register.

  @return The value written back to the PCI configuration register.

**/
UINT8
EFIAPI
PciAnd8 (
  IN      UINTN                     Address,
  IN      UINT8                     AndData
  )
{
  return PciWrite8 (Address, (UINT8) (PciRead8 (Address) & AndData));
}

/**
  Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit
  value, followed a  bitwise OR with another 8-bit value.

  Reads the 8-bit PCI configuration register specified by Address, performs a
  bitwise AND between the read result and the value specified by AndData,
  performs a bitwise OR between the result of the AND operation and
  the value specified by OrData, and writes the result to the 8-bit PCI
  configuration register specified by Address. The value written to the PCI
  configuration register is returned. This function must guarantee that all PCI
  read and write operations are serialized.

  If Address > 0x0FFFFFFF, then ASSERT().

  @param  Address The address that encodes the PCI Bus, Device, Function and
                  Register.
  @param  AndData The value to AND with the PCI configuration register.
  @param  OrData  The value to OR with the result of the AND operation.

  @return The value written back to the PCI configuration register.

**/
UINT8
EFIAPI
PciAndThenOr8 (
  IN      UINTN                     Address,
  IN      UINT8                     AndData,
  IN      UINT8                     OrData
  )
{
  return PciWrite8 (Address, (UINT8) ((PciRead8 (Address) & AndData) | OrData));
}

/**
  Reads a bit field of a PCI configuration register.

  Reads the bit field in an 8-bit PCI configuration register. The bit field is
  specified by the StartBit and the EndBit. The value of the bit field is
  returned.

  If Address > 0x0FFFFFFF, then ASSERT().
  If StartBit is greater than 7, then ASSERT().
  If EndBit is greater than 7, then ASSERT().
  If EndBit is less than StartBit, then ASSERT().

  @param  Address   The PCI configuration register to read.
  @param  StartBit  The ordinal of the least significant bit in the bit field.
                    Range 0..7.
  @param  EndBit    The ordinal of the most significant bit in the bit field.
                    Range 0..7.

  @return The value of the bit field read from the PCI configuration register.

**/
UINT8
EFIAPI
PciBitFieldRead8 (
  IN      UINTN                     Address,
  IN      UINTN                     StartBit,
  IN      UINTN                     EndBit
  )
{
  return BitFieldRead8 (PciRead8 (Address), StartBit, EndBit);
}

/**
  Writes a bit field to a PCI configuration register.

  Writes Value to the bit field of the PCI configuration register. The bit
  field is specified by the StartBit and the EndBit. All other bits in the
  destination PCI configuration register are preserved. The new value of the
  8-bit register is returned.

  If Address > 0x0FFFFFFF, then ASSERT().
  If StartBit is greater than 7, then ASSERT().
  If EndBit is greater than 7, then ASSERT().
  If EndBit is less than StartBit, then ASSERT().
  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().

  @param  Address   The PCI configuration register to write.
  @param  StartBit  The ordinal of the least significant bit in the bit field.
                    Range 0..7.
  @param  EndBit    The ordinal of the most significant bit in the bit field.
                    Range 0..7.
  @param  Value     The new value of the bit field.

  @return The value written back to the PCI configuration register.

**/
UINT8
EFIAPI
PciBitFieldWrite8 (
  IN      UINTN                     Address,
  IN      UINTN                     StartBit,
  IN      UINTN                     EndBit,
  IN      UINT8                     Value
  )
{
  return PciWrite8 (
           Address,
           BitFieldWrite8 (PciRead8 (Address), StartBit, EndBit, Value)
           );
}

/**
  Reads a bit field in an 8-bit PCI configuration, performs a bitwise OR, and
  writes the result back to the bit field in the 8-bit port.

  Reads the 8-bit PCI configuration register specified by Address, performs a
  bitwise OR between the read result and the value specified by
  OrData, and writes the result to the 8-bit PCI configuration register
  specified by Address. The value written to the PCI configuration register is
  returned. This function must guarantee that all PCI read and write operations
  are serialized. Extra left bits in OrData are stripped.

  If Address > 0x0FFFFFFF, then ASSERT().
  If StartBit is greater than 7, then ASSERT().
  If EndBit is greater than 7, then ASSERT().
  If EndBit is less than StartBit, then ASSERT().
  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().

  @param  Address   The PCI configuration register to write.
  @param  StartBit  The ordinal of the least significant bit in the bit field.
                    Range 0..7.
  @param  EndBit    The ordinal of the most significant bit in the bit field.
                    Range 0..7.
  @param  OrData    The value to OR with the PCI configuration register.

  @return The value written back to the PCI configuration register.

**/
UINT8
EFIAPI
PciBitFieldOr8 (
  IN      UINTN                     Address,
  IN      UINTN                     StartBit,
  IN      UINTN                     EndBit,
  IN      UINT8                     OrData
  )
{
  return PciWrite8 (
           Address,
           BitFieldOr8 (PciRead8 (Address), StartBit, EndBit, OrData)
           );
}

/**
  Reads a bit field in an 8-bit PCI configuration register, performs a bitwise
  AND, and writes the result back to the bit field in the 8-bit register.

  Reads the 8-bit PCI configuration register specified by Address, performs a
  bitwise AND between the read result and the value specified by AndData, and
  writes the result to the 8-bit PCI configuration register specified by
  Address. The value written to the PCI configuration register is returned.
  This function must guarantee that all PCI read and write operations are
  serialized. Extra left bits in AndData are stripped.

  If Address > 0x0FFFFFFF, then ASSERT().
  If StartBit is greater than 7, then ASSERT().
  If EndBit is greater than 7, then ASSERT().
  If EndBit is less than StartBit, then ASSERT().
  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().

  @param  Address   The PCI configuration register to write.
  @param  StartBit  The ordinal of the least significant bit in the bit field.
                    Range 0..7.
  @param  EndBit    The ordinal of the most significant bit in the bit field.
                    Range 0..7.
  @param  AndData   The value to AND with the PCI configuration register.

  @return The value written back to the PCI configuration register.

**/
UINT8
EFIAPI
PciBitFieldAnd8 (
  IN      UINTN                     Address,
  IN      UINTN                     StartBit,
  IN      UINTN                     EndBit,
  IN      UINT8                     AndData
  )
{
  return PciWrite8 (
           Address,
           BitFieldAnd8 (PciRead8 (Address), StartBit, EndBit, AndData)
           );
}

/**
  Reads a bit field in an 8-bit port, performs a bitwise AND followed by a
  bitwise OR, and writes the result back to the bit field in the
  8-bit port.

  Reads the 8-bit PCI configuration register specified by Address, performs a
  bitwise AND followed by a bitwise OR between the read result and
  the value specified by AndData, and writes the result to the 8-bit PCI
  configuration register specified by Address. The value written to the PCI
  configuration register is returned. This function must guarantee that all PCI
  read and write operations are serialized. Extra left bits in both AndData and
  OrData are stripped.

  If Address > 0x0FFFFFFF, then ASSERT().
  If StartBit is greater than 7, then ASSERT().
  If EndBit is greater than 7, then ASSERT().
  If EndBit is less than StartBit, then ASSERT().
  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().

  @param  Address   The PCI configuration register to write.
  @param  StartBit  The ordinal of the least significant bit in the bit field.
                    Range 0..7.
  @param  EndBit    The ordinal of the most significant bit in the bit field.
                    Range 0..7.
  @param  AndData   The value to AND with the PCI configuration register.
  @param  OrData    The value to OR with the result of the AND operation.

  @return The value written back to the PCI configuration register.

**/
UINT8
EFIAPI
PciBitFieldAndThenOr8 (
  IN      UINTN                     Address,
  IN      UINTN                     StartBit,
  IN      UINTN                     EndBit,
  IN      UINT8                     AndData,
  IN      UINT8                     OrData
  )
{
  return PciWrite8 (
           Address,
           BitFieldAndThenOr8 (PciRead8 (Address), StartBit, EndBit, AndData, OrData)
           );
}

/**
  Reads a 16-bit PCI configuration register.

  Reads and returns the 16-bit PCI configuration register specified by Address.
  This function must guarantee that all PCI read and write operations are
  serialized.

  If Address > 0x0FFFFFFF, then ASSERT().
  If Address is not aligned on a 16-bit boundary, then ASSERT().

  @param  Address The address that encodes the PCI Bus, Device, Function and
                  Register.

  @return The read value from the PCI configuration register.

**/
UINT16
EFIAPI
PciRead16 (
  IN      UINTN                     Address
  )
{
  ASSERT_INVALID_PCI_ADDRESS (Address, 1);

  return (UINT16) DxePciLibPciRootBridgeIoReadWorker (Address, EfiPciWidthUint16);
}

/**
  Writes a 16-bit PCI configuration register.

  Writes the 16-bit PCI configuration register specified by Address with the
  value specified by Value. Value is returned. This function must guarantee
  that all PCI read and write operations are serialized.

  If Address > 0x0FFFFFFF, then ASSERT().
  If Address is not aligned on a 16-bit boundary, then ASSERT().

  @param  Address The address that encodes the PCI Bus, Device, Function and
                  Register.
  @param  Value   The value to write.

  @return The value written to the PCI configuration register.

**/
UINT16
EFIAPI
PciWrite16 (
  IN      UINTN                     Address,
  IN      UINT16                    Value
  )
{
  ASSERT_INVALID_PCI_ADDRESS (Address, 1);

  return (UINT16) DxePciLibPciRootBridgeIoWriteWorker (Address, EfiPciWidthUint16, Value);
}

/**
  Performs a bitwise OR of a 16-bit PCI configuration register with
  a 16-bit value.

  Reads the 16-bit PCI configuration register specified by Address, performs a
  bitwise OR between the read result and the value specified by
  OrData, and writes the result to the 16-bit PCI configuration register
  specified by Address. The value written to the PCI configuration register is
  returned. This function must guarantee that all PCI read and write operations
  are serialized.

  If Address > 0x0FFFFFFF, then ASSERT().
  If Address is not aligned on a 16-bit boundary, then ASSERT().

  @param  Address The address that encodes the PCI Bus, Device, Function and
                  Register.
  @param  OrData  The value to OR with the PCI configuration register.

  @return The value written back to the PCI configuration register.

**/
UINT16
EFIAPI
PciOr16 (
  IN      UINTN                     Address,
  IN      UINT16                    OrData
  )
{
  return PciWrite16 (Address, (UINT16) (PciRead16 (Address) | OrData));
}

/**
  Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit
  value.

  Reads the 16-bit PCI configuration register specified by Address, performs a
  bitwise AND between the read result and the value specified by AndData, and
  writes the result to the 16-bit PCI configuration register specified by
  Address. The value written to the PCI configuration register is returned.
  This function must guarantee that all PCI read and write operations are
  serialized.

  If Address > 0x0FFFFFFF, then ASSERT().
  If Address is not aligned on a 16-bit boundary, then ASSERT().

  @param  Address The address that encodes the PCI Bus, Device, Function and
                  Register.
  @param  AndData The value to AND with the PCI configuration register.

  @return The value written back to the PCI configuration register.

**/
UINT16
EFIAPI
PciAnd16 (
  IN      UINTN                     Address,
  IN      UINT16                    AndData
  )
{
  return PciWrite16 (Address, (UINT16) (PciRead16 (Address) & AndData));
}

/**
  Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit
  value, followed a  bitwise OR with another 16-bit value.

  Reads the 16-bit PCI configuration register specified by Address, performs a
  bitwise AND between the read result and the value specified by AndData,
  performs a bitwise OR between the result of the AND operation and
  the value specified by OrData, and writes the result to the 16-bit PCI
  configuration register specified by Address. The value written to the PCI
  configuration register is returned. This function must guarantee that all PCI
  read and write operations are serialized.

  If Address > 0x0FFFFFFF, then ASSERT().
  If Address is not aligned on a 16-bit boundary, then ASSERT().

  @param  Address The address that encodes the PCI Bus, Device, Function and
                  Register.
  @param  AndData The value to AND with the PCI configuration register.
  @param  OrData  The value to OR with the result of the AND operation.

  @return The value written back to the PCI configuration register.

**/
UINT16
EFIAPI
PciAndThenOr16 (
  IN      UINTN                     Address,
  IN      UINT16                    AndData,
  IN      UINT16                    OrData
  )
{
  return PciWrite16 (Address, (UINT16) ((PciRead16 (Address) & AndData) | OrData));
}

/**
  Reads a bit field of a PCI configuration register.

  Reads the bit field in a 16-bit PCI configuration register. The bit field is
  specified by the StartBit and the EndBit. The value of the bit field is
  returned.

  If Address > 0x0FFFFFFF, then ASSERT().
  If Address is not aligned on a 16-bit boundary, then ASSERT().
  If StartBit is greater than 15, then ASSERT().
  If EndBit is greater than 15, then ASSERT().
  If EndBit is less than StartBit, then ASSERT().

  @param  Address   The PCI configuration register to read.
  @param  StartBit  The ordinal of the least significant bit in the bit field.
                    Range 0..15.
  @param  EndBit    The ordinal of the most significant bit in the bit field.
                    Range 0..15.

  @return The value of the bit field read from the PCI configuration register.

**/
UINT16
EFIAPI
PciBitFieldRead16 (
  IN      UINTN                     Address,
  IN      UINTN                     StartBit,
  IN      UINTN                     EndBit
  )
{
  return BitFieldRead16 (PciRead16 (Address), StartBit, EndBit);
}

/**
  Writes a bit field to a PCI configuration register.

  Writes Value to the bit field of the PCI configuration register. The bit
  field is specified by the StartBit and the EndBit. All other bits in the
  destination PCI configuration register are preserved. The new value of the
  16-bit register is returned.

  If Address > 0x0FFFFFFF, then ASSERT().
  If Address is not aligned on a 16-bit boundary, then ASSERT().
  If StartBit is greater than 15, then ASSERT().
  If EndBit is greater than 15, then ASSERT().
  If EndBit is less than StartBit, then ASSERT().
  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().

  @param  Address   The PCI configuration register to write.
  @param  StartBit  The ordinal of the least significant bit in the bit field.
                    Range 0..15.
  @param  EndBit    The ordinal of the most significant bit in the bit field.
                    Range 0..15.
  @param  Value     The new value of the bit field.

  @return The value written back to the PCI configuration register.

**/
UINT16
EFIAPI
PciBitFieldWrite16 (
  IN      UINTN                     Address,
  IN      UINTN                     StartBit,
  IN      UINTN                     EndBit,
  IN      UINT16                    Value
  )
{
  return PciWrite16 (
           Address,
           BitFieldWrite16 (PciRead16 (Address), StartBit, EndBit, Value)
           );
}

/**
  Reads a bit field in a 16-bit PCI configuration, performs a bitwise OR, and
  writes the result back to the bit field in the 16-bit port.

  Reads the 16-bit PCI configuration register specified by Address, performs a
  bitwise OR between the read result and the value specified by
  OrData, and writes the result to the 16-bit PCI configuration register
  specified by Address. The value written to the PCI configuration register is
  returned. This function must guarantee that all PCI read and write operations
  are serialized. Extra left bits in OrData are stripped.

  If Address > 0x0FFFFFFF, then ASSERT().
  If Address is not aligned on a 16-bit boundary, then ASSERT().
  If StartBit is greater than 15, then ASSERT().
  If EndBit is greater than 15, then ASSERT().
  If EndBit is less than StartBit, then ASSERT().
  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().

  @param  Address   The PCI configuration register to write.
  @param  StartBit  The ordinal of the least significant bit in the bit field.
                    Range 0..15.
  @param  EndBit    The ordinal of the most significant bit in the bit field.
                    Range 0..15.
  @param  OrData    The value to OR with the PCI configuration register.

  @return The value written back to the PCI configuration register.

**/
UINT16
EFIAPI
PciBitFieldOr16 (
  IN      UINTN                     Address,
  IN      UINTN                     StartBit,
  IN      UINTN                     EndBit,
  IN      UINT16                    OrData
  )
{
  return PciWrite16 (
           Address,
           BitFieldOr16 (PciRead16 (Address), StartBit, EndBit, OrData)
           );
}

/**
  Reads a bit field in a 16-bit PCI configuration register, performs a bitwise
  AND, and writes the result back to the bit field in the 16-bit register.

  Reads the 16-bit PCI configuration register specified by Address, performs a
  bitwise AND between the read result and the value specified by AndData, and
  writes the result to the 16-bit PCI configuration register specified by
  Address. The value written to the PCI configuration register is returned.
  This function must guarantee that all PCI read and write operations are
  serialized. Extra left bits in AndData are stripped.

  If Address > 0x0FFFFFFF, then ASSERT().
  If Address is not aligned on a 16-bit boundary, then ASSERT().
  If StartBit is greater than 15, then ASSERT().
  If EndBit is greater than 15, then ASSERT().
  If EndBit is less than StartBit, then ASSERT().
  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().

  @param  Address   The PCI configuration register to write.
  @param  StartBit  The ordinal of the least significant bit in the bit field.
                    Range 0..15.
  @param  EndBit    The ordinal of the most significant bit in the bit field.
                    Range 0..15.
  @param  AndData   The value to AND with the PCI configuration register.

  @return The value written back to the PCI configuration register.

**/
UINT16
EFIAPI
PciBitFieldAnd16 (
  IN      UINTN                     Address,
  IN      UINTN                     StartBit,
  IN      UINTN                     EndBit,
  IN      UINT16                    AndData
  )
{
  return PciWrite16 (
           Address,
           BitFieldAnd16 (PciRead16 (Address), StartBit, EndBit, AndData)
           );
}

/**
  Reads a bit field in a 16-bit port, performs a bitwise AND followed by a
  bitwise OR, and writes the result back to the bit field in the
  16-bit port.

  Reads the 16-bit PCI configuration register specified by Address, performs a
  bitwise AND followed by a bitwise OR between the read result and
  the value specified by AndData, and writes the result to the 16-bit PCI
  configuration register specified by Address. The value written to the PCI
  configuration register is returned. This function must guarantee that all PCI
  read and write operations are serialized. Extra left bits in both AndData and
  OrData are stripped.

  If Address > 0x0FFFFFFF, then ASSERT().
  If Address is not aligned on a 16-bit boundary, then ASSERT().
  If StartBit is greater than 15, then ASSERT().
  If EndBit is greater than 15, then ASSERT().
  If EndBit is less than StartBit, then ASSERT().
  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().

  @param  Address   The PCI configuration register to write.
  @param  StartBit  The ordinal of the least significant bit in the bit field.
                    Range 0..15.
  @param  EndBit    The ordinal of the most significant bit in the bit field.
                    Range 0..15.
  @param  AndData   The value to AND with the PCI configuration register.
  @param  OrData    The value to OR with the result of the AND operation.

  @return The value written back to the PCI configuration register.

**/
UINT16
EFIAPI
PciBitFieldAndThenOr16 (
  IN      UINTN                     Address,
  IN      UINTN                     StartBit,
  IN      UINTN                     EndBit,
  IN      UINT16                    AndData,
  IN      UINT16                    OrData
  )
{
  return PciWrite16 (
           Address,
           BitFieldAndThenOr16 (PciRead16 (Address), StartBit, EndBit, AndData, OrData)
           );
}

/**
  Reads a 32-bit PCI configuration register.

  Reads and returns the 32-bit PCI configuration register specified by Address.
  This function must guarantee that all PCI read and write operations are
  serialized.

  If Address > 0x0FFFFFFF, then ASSERT().
  If Address is not aligned on a 32-bit boundary, then ASSERT().

  @param  Address The address that encodes the PCI Bus, Device, Function and
                  Register.

  @return The read value from the PCI configuration register.

**/
UINT32
EFIAPI
PciRead32 (
  IN      UINTN                     Address
  )
{
  ASSERT_INVALID_PCI_ADDRESS (Address, 3);

  return DxePciLibPciRootBridgeIoReadWorker (Address, EfiPciWidthUint32);
}

/**
  Writes a 32-bit PCI configuration register.

  Writes the 32-bit PCI configuration register specified by Address with the
  value specified by Value. Value is returned. This function must guarantee
  that all PCI read and write operations are serialized.

  If Address > 0x0FFFFFFF, then ASSERT().
  If Address is not aligned on a 32-bit boundary, then ASSERT().

  @param  Address The address that encodes the PCI Bus, Device, Function and
                  Register.
  @param  Value   The value to write.

  @return The value written to the PCI configuration register.

**/
UINT32
EFIAPI
PciWrite32 (
  IN      UINTN                     Address,
  IN      UINT32                    Value
  )
{
  ASSERT_INVALID_PCI_ADDRESS (Address, 3);

  return DxePciLibPciRootBridgeIoWriteWorker (Address, EfiPciWidthUint32, Value);
}

/**
  Performs a bitwise OR of a 32-bit PCI configuration register with
  a 32-bit value.

  Reads the 32-bit PCI configuration register specified by Address, performs a
  bitwise OR between the read result and the value specified by
  OrData, and writes the result to the 32-bit PCI configuration register
  specified by Address. The value written to the PCI configuration register is
  returned. This function must guarantee that all PCI read and write operations
  are serialized.

  If Address > 0x0FFFFFFF, then ASSERT().
  If Address is not aligned on a 32-bit boundary, then ASSERT().

  @param  Address The address that encodes the PCI Bus, Device, Function and
                  Register.
  @param  OrData  The value to OR with the PCI configuration register.

  @return The value written back to the PCI configuration register.

**/
UINT32
EFIAPI
PciOr32 (
  IN      UINTN                     Address,
  IN      UINT32                    OrData
  )
{
  return PciWrite32 (Address, PciRead32 (Address) | OrData);
}

/**
  Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit
  value.

  Reads the 32-bit PCI configuration register specified by Address, performs a
  bitwise AND between the read result and the value specified by AndData, and
  writes the result to the 32-bit PCI configuration register specified by
  Address. The value written to the PCI configuration register is returned.
  This function must guarantee that all PCI read and write operations are
  serialized.

  If Address > 0x0FFFFFFF, then ASSERT().
  If Address is not aligned on a 32-bit boundary, then ASSERT().

  @param  Address The address that encodes the PCI Bus, Device, Function and
                  Register.
  @param  AndData The value to AND with the PCI configuration register.

  @return The value written back to the PCI configuration register.

**/
UINT32
EFIAPI
PciAnd32 (
  IN      UINTN                     Address,
  IN      UINT32                    AndData
  )
{
  return PciWrite32 (Address, PciRead32 (Address) & AndData);
}

/**
  Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit
  value, followed a  bitwise OR with another 32-bit value.

  Reads the 32-bit PCI configuration register specified by Address, performs a
  bitwise AND between the read result and the value specified by AndData,
  performs a bitwise OR between the result of the AND operation and
  the value specified by OrData, and writes the result to the 32-bit PCI
  configuration register specified by Address. The value written to the PCI
  configuration register is returned. This function must guarantee that all PCI
  read and write operations are serialized.

  If Address > 0x0FFFFFFF, then ASSERT().
  If Address is not aligned on a 32-bit boundary, then ASSERT().

  @param  Address The address that encodes the PCI Bus, Device, Function and
                  Register.
  @param  AndData The value to AND with the PCI configuration register.
  @param  OrData  The value to OR with the result of the AND operation.

  @return The value written back to the PCI configuration register.

**/
UINT32
EFIAPI
PciAndThenOr32 (
  IN      UINTN                     Address,
  IN      UINT32                    AndData,
  IN      UINT32                    OrData
  )
{
  return PciWrite32 (Address, (PciRead32 (Address) & AndData) | OrData);
}

/**
  Reads a bit field of a PCI configuration register.

  Reads the bit field in a 32-bit PCI configuration register. The bit field is
  specified by the StartBit and the EndBit. The value of the bit field is
  returned.

  If Address > 0x0FFFFFFF, then ASSERT().
  If Address is not aligned on a 32-bit boundary, then ASSERT().
  If StartBit is greater than 31, then ASSERT().
  If EndBit is greater than 31, then ASSERT().
  If EndBit is less than StartBit, then ASSERT().

  @param  Address   The PCI configuration register to read.
  @param  StartBit  The ordinal of the least significant bit in the bit field.
                    Range 0..31.
  @param  EndBit    The ordinal of the most significant bit in the bit field.
                    Range 0..31.

  @return The value of the bit field read from the PCI configuration register.

**/
UINT32
EFIAPI
PciBitFieldRead32 (
  IN      UINTN                     Address,
  IN      UINTN                     StartBit,
  IN      UINTN                     EndBit
  )
{
  return BitFieldRead32 (PciRead32 (Address), StartBit, EndBit);
}

/**
  Writes a bit field to a PCI configuration register.

  Writes Value to the bit field of the PCI configuration register. The bit
  field is specified by the StartBit and the EndBit. All other bits in the
  destination PCI configuration register are preserved. The new value of the
  32-bit register is returned.

  If Address > 0x0FFFFFFF, then ASSERT().
  If Address is not aligned on a 32-bit boundary, then ASSERT().
  If StartBit is greater than 31, then ASSERT().
  If EndBit is greater than 31, then ASSERT().
  If EndBit is less than StartBit, then ASSERT().
  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().

  @param  Address   The PCI configuration register to write.
  @param  StartBit  The ordinal of the least significant bit in the bit field.
                    Range 0..31.
  @param  EndBit    The ordinal of the most significant bit in the bit field.
                    Range 0..31.
  @param  Value     The new value of the bit field.

  @return The value written back to the PCI configuration register.

**/
UINT32
EFIAPI
PciBitFieldWrite32 (
  IN      UINTN                     Address,
  IN      UINTN                     StartBit,
  IN      UINTN                     EndBit,
  IN      UINT32                    Value
  )
{
  return PciWrite32 (
           Address,
           BitFieldWrite32 (PciRead32 (Address), StartBit, EndBit, Value)
           );
}

/**
  Reads a bit field in a 32-bit PCI configuration, performs a bitwise OR, and
  writes the result back to the bit field in the 32-bit port.

  Reads the 32-bit PCI configuration register specified by Address, performs a
  bitwise OR between the read result and the value specified by
  OrData, and writes the result to the 32-bit PCI configuration register
  specified by Address. The value written to the PCI configuration register is
  returned. This function must guarantee that all PCI read and write operations
  are serialized. Extra left bits in OrData are stripped.

  If Address > 0x0FFFFFFF, then ASSERT().
  If Address is not aligned on a 32-bit boundary, then ASSERT().
  If StartBit is greater than 31, then ASSERT().
  If EndBit is greater than 31, then ASSERT().
  If EndBit is less than StartBit, then ASSERT().
  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().

  @param  Address   The PCI configuration register to write.
  @param  StartBit  The ordinal of the least significant bit in the bit field.
                    Range 0..31.
  @param  EndBit    The ordinal of the most significant bit in the bit field.
                    Range 0..31.
  @param  OrData    The value to OR with the PCI configuration register.

  @return The value written back to the PCI configuration register.

**/
UINT32
EFIAPI
PciBitFieldOr32 (
  IN      UINTN                     Address,
  IN      UINTN                     StartBit,
  IN      UINTN                     EndBit,
  IN      UINT32                    OrData
  )
{
  return PciWrite32 (
           Address,
           BitFieldOr32 (PciRead32 (Address), StartBit, EndBit, OrData)
           );
}

/**
  Reads a bit field in a 32-bit PCI configuration register, performs a bitwise
  AND, and writes the result back to the bit field in the 32-bit register.

  Reads the 32-bit PCI configuration register specified by Address, performs a
  bitwise AND between the read result and the value specified by AndData, and
  writes the result to the 32-bit PCI configuration register specified by
  Address. The value written to the PCI configuration register is returned.
  This function must guarantee that all PCI read and write operations are
  serialized. Extra left bits in AndData are stripped.

  If Address > 0x0FFFFFFF, then ASSERT().
  If Address is not aligned on a 32-bit boundary, then ASSERT().
  If StartBit is greater than 31, then ASSERT().
  If EndBit is greater than 31, then ASSERT().
  If EndBit is less than StartBit, then ASSERT().
  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().

  @param  Address   The PCI configuration register to write.
  @param  StartBit  The ordinal of the least significant bit in the bit field.
                    Range 0..31.
  @param  EndBit    The ordinal of the most significant bit in the bit field.
                    Range 0..31.
  @param  AndData   The value to AND with the PCI configuration register.

  @return The value written back to the PCI configuration register.

**/
UINT32
EFIAPI
PciBitFieldAnd32 (
  IN      UINTN                     Address,
  IN      UINTN                     StartBit,
  IN      UINTN                     EndBit,
  IN      UINT32                    AndData
  )
{
  return PciWrite32 (
           Address,
           BitFieldAnd32 (PciRead32 (Address), StartBit, EndBit, AndData)
           );
}

/**
  Reads a bit field in a 32-bit port, performs a bitwise AND followed by a
  bitwise OR, and writes the result back to the bit field in the
  32-bit port.

  Reads the 32-bit PCI configuration register specified by Address, performs a
  bitwise AND followed by a bitwise OR between the read result and
  the value specified by AndData, and writes the result to the 32-bit PCI
  configuration register specified by Address. The value written to the PCI
  configuration register is returned. This function must guarantee that all PCI
  read and write operations are serialized. Extra left bits in both AndData and
  OrData are stripped.

  If Address > 0x0FFFFFFF, then ASSERT().
  If Address is not aligned on a 32-bit boundary, then ASSERT().
  If StartBit is greater than 31, then ASSERT().
  If EndBit is greater than 31, then ASSERT().
  If EndBit is less than StartBit, then ASSERT().
  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().

  @param  Address   The PCI configuration register to write.
  @param  StartBit  The ordinal of the least significant bit in the bit field.
                    Range 0..31.
  @param  EndBit    The ordinal of the most significant bit in the bit field.
                    Range 0..31.
  @param  AndData   The value to AND with the PCI configuration register.
  @param  OrData    The value to OR with the result of the AND operation.

  @return The value written back to the PCI configuration register.

**/
UINT32
EFIAPI
PciBitFieldAndThenOr32 (
  IN      UINTN                     Address,
  IN      UINTN                     StartBit,
  IN      UINTN                     EndBit,
  IN      UINT32                    AndData,
  IN      UINT32                    OrData
  )
{
  return PciWrite32 (
           Address,
           BitFieldAndThenOr32 (PciRead32 (Address), StartBit, EndBit, AndData, OrData)
           );
}

/**
  Reads a range of PCI configuration registers into a caller supplied buffer.

  Reads the range of PCI configuration registers specified by StartAddress and
  Size into the buffer specified by Buffer. This function only allows the PCI
  configuration registers from a single PCI function to be read. Size is
  returned. When possible 32-bit PCI configuration read cycles are used to read
  from StartAdress to StartAddress + Size. Due to alignment restrictions, 8-bit
  and 16-bit PCI configuration read cycles may be used at the beginning and the
  end of the range.

  If StartAddress > 0x0FFFFFFF, then ASSERT().
  If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT().
  If Size > 0 and Buffer is NULL, then ASSERT().

  @param  StartAddress  The starting address that encodes the PCI Bus, Device,
                        Function and Register.
  @param  Size          The size in bytes of the transfer.
  @param  Buffer        The pointer to a buffer receiving the data read.

  @return Size

**/
UINTN
EFIAPI
PciReadBuffer (
  IN      UINTN                     StartAddress,
  IN      UINTN                     Size,
  OUT     VOID                      *Buffer
  )
{
  UINTN                             ReturnValue;

  ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0);
  ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);

  if (Size == 0) {
    return Size;
  }

  ASSERT (Buffer != NULL);

  //
  // Save Size for return
  //
  ReturnValue = Size;

  if ((StartAddress & BIT0) != 0) {
    //
    // Read a byte if StartAddress is byte aligned
    //
    *(volatile UINT8 *)Buffer = PciRead8 (StartAddress);
    StartAddress += sizeof (UINT8);
    Size -= sizeof (UINT8);
    Buffer = (UINT8*)Buffer + 1;
  }

  if (Size >= sizeof (UINT16) && (StartAddress & BIT1) != 0) {
    //
    // Read a word if StartAddress is word aligned
    //
    WriteUnaligned16 (Buffer, PciRead16 (StartAddress));
    StartAddress += sizeof (UINT16);
    Size -= sizeof (UINT16);
    Buffer = (UINT16*)Buffer + 1;
  }

  while (Size >= sizeof (UINT32)) {
    //
    // Read as many double words as possible
    //
    WriteUnaligned32 (Buffer, PciRead32 (StartAddress));
    StartAddress += sizeof (UINT32);
    Size -= sizeof (UINT32);
    Buffer = (UINT32*)Buffer + 1;
  }

  if (Size >= sizeof (UINT16)) {
    //
    // Read the last remaining word if exist
    //
    WriteUnaligned16 (Buffer, PciRead16 (StartAddress));
    StartAddress += sizeof (UINT16);
    Size -= sizeof (UINT16);
    Buffer = (UINT16*)Buffer + 1;
  }

  if (Size >= sizeof (UINT8)) {
    //
    // Read the last remaining byte if exist
    //
    *(volatile UINT8 *)Buffer = PciRead8 (StartAddress);
  }

  return ReturnValue;
}

/**
  Copies the data in a caller supplied buffer to a specified range of PCI
  configuration space.

  Writes the range of PCI configuration registers specified by StartAddress and
  Size from the buffer specified by Buffer. This function only allows the PCI
  configuration registers from a single PCI function to be written. Size is
  returned. When possible 32-bit PCI configuration write cycles are used to
  write from StartAdress to StartAddress + Size. Due to alignment restrictions,
  8-bit and 16-bit PCI configuration write cycles may be used at the beginning
  and the end of the range.

  If StartAddress > 0x0FFFFFFF, then ASSERT().
  If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT().
  If Size > 0 and Buffer is NULL, then ASSERT().

  @param  StartAddress  The starting address that encodes the PCI Bus, Device,
                        Function and Register.
  @param  Size          The size in bytes of the transfer.
  @param  Buffer        The pointer to a buffer containing the data to write.

  @return Size written to StartAddress.

**/
UINTN
EFIAPI
PciWriteBuffer (
  IN      UINTN                     StartAddress,
  IN      UINTN                     Size,
  IN      VOID                      *Buffer
  )
{
  UINTN                             ReturnValue;

  ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0);
  ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);

  if (Size == 0) {
    return 0;
  }

  ASSERT (Buffer != NULL);

  //
  // Save Size for return
  //
  ReturnValue = Size;

  if ((StartAddress & BIT0) != 0) {
    //
    // Write a byte if StartAddress is byte aligned
    //
    PciWrite8 (StartAddress, *(UINT8*)Buffer);
    StartAddress += sizeof (UINT8);
    Size -= sizeof (UINT8);
    Buffer = (UINT8*)Buffer + 1;
  }

  if (Size >= sizeof (UINT16) && (StartAddress & BIT1) != 0) {
    //
    // Write a word if StartAddress is word aligned
    //
    PciWrite16 (StartAddress, ReadUnaligned16 (Buffer));
    StartAddress += sizeof (UINT16);
    Size -= sizeof (UINT16);
    Buffer = (UINT16*)Buffer + 1;
  }

  while (Size >= sizeof (UINT32)) {
    //
    // Write as many double words as possible
    //
    PciWrite32 (StartAddress, ReadUnaligned32 (Buffer));
    StartAddress += sizeof (UINT32);
    Size -= sizeof (UINT32);
    Buffer = (UINT32*)Buffer + 1;
  }

  if (Size >= sizeof (UINT16)) {
    //
    // Write the last remaining word if exist
    //
    PciWrite16 (StartAddress, ReadUnaligned16 (Buffer));
    StartAddress += sizeof (UINT16);
    Size -= sizeof (UINT16);
    Buffer = (UINT16*)Buffer + 1;
  }

  if (Size >= sizeof (UINT8)) {
    //
    // Write the last remaining byte if exist
    //
    PciWrite8 (StartAddress, *(UINT8*)Buffer);
  }

  return ReturnValue;
}


text:
package com.imu.coursenet.service;

import java.util.List;

import com.imu.coursenet.domain.*;

public interface MessageManager {
	public static final int OP_SUCC = 1;
	public static final int OP_FAIL = -1;

	List<Message> listAllMessage();

	List<Message> listAllMessage(int offset,int pageSize);

	int addMessage(String content, int userId);

	int deleteMessage(int messageId);

	// int updateMessage(Message message);

	Message getMessage(int messageId);

	int getTotalMessageCounts();
}


text:
package com.planet_ink.coffee_mud.Commands;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Areas.interfaces.*;
import com.planet_ink.coffee_mud.Behaviors.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.*;
import com.planet_ink.coffee_mud.Commands.interfaces.*;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Exits.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.*;
import com.planet_ink.coffee_mud.Races.interfaces.*;

import java.util.*;

@SuppressWarnings("unchecked")
public class Vassals extends StdCommand
{
	public Vassals(){}

	private String[] access={"VASSALS"};
	public String[] getAccessWords(){return access;}
	public boolean execute(MOB mob, Vector commands, int metaFlags)
		throws java.io.IOException
	{
		mob.tell("The following players are in your service:");
		CMLib.database().vassals(mob,mob.Name());
		return false;
	}

	public boolean canBeOrdered(){return true;}

}


text:
    <button type="button" class="close" ng-click="ctrl.cancel()" data-dismiss="modal" aria-label="Close">×</button>

Asignación de cablemodem

            <form name="extensionForm">

                    Servicios de Internet por Asignar

                            <input type="checkbox" ng-model="x.selectedMac" ng-disabled="ctrl.editar" ng-checked="x.checado" value={{x.ContratoNet}} ng-change="ctrl.saveContratoNet(x)">{{ x.Mac }}
{{ x.Detalle }}

            </form>

    <button class="btn btn-success" type="button" ng-click="ctrl.ok()" ng-show="ctrl.mostrarBoton">Guardar</button>
    <button class="btn btn-primary" type="button" ng-click="ctrl.cancel()">Cancelar</button>


text:
'use strict';
// =========================================================================
//
// complaint routes
//
// =========================================================================
angular.module('complaints').config(['$stateProvider', 'RELEASE', function ($stateProvider, RELEASE) {
	if (RELEASE.enableComplaints) {
		$stateProvider
		// -------------------------------------------------------------------------
		//
		// this is the abstract, top level view for complaints.
		// since it is a child of p (project), the project injection has already
		// been resolved and is available to subsequent child states as 'project'
		// here we will resolve the list of complaints for this project, which will
		// also become available to child states as 'complaints'
		//
		// -------------------------------------------------------------------------
		.state('p.complaint', {
			abstract:true,
			url: '/complaint',
			template: '<ui-view></ui-view>',
			resolve: {
				complaints: function ($stateParams, ComplaintModel, project) {
					return ComplaintModel.forProject (project._id);
				},
				vcs: function(VcModel, project) {
					return VcModel.forProject(project._id);
				}
			}
		})
		// -------------------------------------------------------------------------
		//
		// the list state for complaints and project are guaranteed to
		// already be resolved
		//
		// -------------------------------------------------------------------------
		.state('p.complaint.list', {
			url: '/list',
			templateUrl: 'modules/project-complaints/client/views/complaint-list.html',
			controller: function ($scope, NgTableParams, complaints, vcs, project, CE_STAGES) {
				$scope.tableParams = new NgTableParams ({count:10}, {dataset: complaints});
				$scope.project = project;
				$scope.stages = CE_STAGES;
			}
		})
		// -------------------------------------------------------------------------
		//
		// this is the add, or create state. it is defined before the others so that
		// it does not conflict
		//
		// -------------------------------------------------------------------------
		.state('p.complaint.create', {
			url: '/create',
			templateUrl: 'modules/project-complaints/client/views/complaint-edit.html',
			resolve: {
				complaint: function (ComplaintModel) {
					return ComplaintModel.getNew ();
				}
			},
			controller: function ($scope, $state, project, complaint, vcs, ComplaintModel, CE_STAGES) {
				$scope.complaint = complaint;
				$scope.complaint.project = project._id;
				$scope.project = project;
				$scope.stages = CE_STAGES;
				$scope.save = function (isValid) {
					if (!isValid) {
						$scope.$broadcast('show-errors-check-validity', 'complaintForm');
						return false;
					}
					ComplaintModel.add ($scope.complaint)
					.then (function (model) {
						$state.transitionTo('p.complaint.list', {projectid:project.code}, {
				  			reload: true, inherit: false, notify: true
						});
					})
					.catch (function (err) {
						console.error (err);
						// alert (err.message);
					});
				};
			}
		})
		// -------------------------------------------------------------------------
		//
		// this is the edit state
		//
		// -------------------------------------------------------------------------
		.state('p.complaint.edit', {
			url: '/:complaintId/edit',
			templateUrl: 'modules/project-complaints/client/views/complaint-edit.html',
			resolve: {
				complaint: function ($stateParams, ComplaintModel) {
					return ComplaintModel.getModel ($stateParams.complaintId);
				}
			},
			controller: function ($scope, $state, complaint, project, vcs, ComplaintModel, CE_STAGES) {
				$scope.complaint = complaint;
				$scope.project = project;
				$scope.stages = CE_STAGES;
				$scope.vcs = vcs;

				$scope.save = function (isValid) {
					if (!isValid) {
						$scope.$broadcast('show-errors-check-validity', 'complaintForm');
						return false;
					}
					ComplaintModel.save ($scope.complaint)
					.then (function (model) {
						// console.log ('complaint was saved',model);
						// console.log ('now going to reload state');
						$state.transitionTo('p.complaint.list', {projectid:project.code}, {
				  			reload: true, inherit: false, notify: true
						});
					})
					.catch (function (err) {
						console.error (err);
						// alert (err.message);
					});
				};
			}
		})
		// -------------------------------------------------------------------------
		//
		// this is the 'view' mode of a complaint. here we are just simply
		// looking at the information for this specific object
		//
		// -------------------------------------------------------------------------
		.state('p.complaint.detail', {
			url: '/:complaintId',
			templateUrl: 'modules/project-complaints/client/views/complaint-view.html',
			resolve: {
				complaint: function ($stateParams, ComplaintModel) {
					return ComplaintModel.getModel ($stateParams.complaintId);
				}
			},
			controller: function ($scope, complaint, project) {
				$scope.complaint = complaint;
				$scope.project = project;
			}
		});
}
}]);


text:
package io.undertow.security.handlers;

import io.undertow.server.HttpHandler;
import io.undertow.server.HttpServerExchange;

import java.net.URI;
import java.net.URISyntaxException;

/**
 * An extension to {@link AbstractConfidentialityHandler} that uses the Host header from the incoming message and specifies the
 * confidential address by just switching the port.
 *
 * @author Darran Lofthouse
 */
public class SinglePortConfidentialityHandler extends AbstractConfidentialityHandler {

    private final int redirectPort;

    public SinglePortConfidentialityHandler(final HttpHandler next, final int redirectPort) {
        super(next);
        this.redirectPort = redirectPort == 443 ? -1 : redirectPort;
    }

    @Override
    protected URI getRedirectURI(HttpServerExchange exchange) throws URISyntaxException {
        return getRedirectURI(exchange, redirectPort);
    }

    protected URI getRedirectURI(HttpServerExchange exchange, int port) throws URISyntaxException {
        String host = exchange.getHostName();

        String queryString = exchange.getQueryString();
        return new URI("https", null, host, port, exchange.getRequestURI(),
                queryString == null || queryString.length() == 0 ? null : queryString, null);
    }

}


text:
#import <Foundation/Foundation.h>
#import "ASPObject.h"

/**
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen
 * Do not edit the class manually.
 */

#import "ASPExifData.h"
#import "ASPTiffOptions.h"

@protocol ASPTiffFrame
@end

@interface ASPTiffFrame : ASPObject

@property(nonatomic) ASPTiffOptions* frameOptions;

@property(nonatomic) NSNumber* height;

@property(nonatomic) NSNumber* width;

@property(nonatomic) ASPExifData* exifData;

@end


text:
CREATE TABLE TYPETEST (
  TYPE1 BIGINT,
  TYPE2 BIGSERIAL,
  TYPE4 BOOL,
  TYPE6 CHAR(10),
  TYPE7 DATE,
  TYPE8 FLOAT8,
  TYPE9 INTEGER,
  TYPE10 NUMERIC(10,2),
  TYPE11 REAL,
  TYPE12 SERIAL,
  TYPE13 SMALLINT,
  TYPE14 TEXT,
  TYPE15 TIMESTAMP(20),
  TYPE16 VARCHAR(10)
);
COMMENT ON table TYPETEST is 'タイプテスト';
COMMENT ON column TYPETEST.TYPE1 is 'TYPE1';
COMMENT ON column TYPETEST.TYPE2 is 'TYPE2';
COMMENT ON column TYPETEST.TYPE4 is 'TYPE4';
COMMENT ON column TYPETEST.TYPE6 is 'TYPE6';
COMMENT ON column TYPETEST.TYPE7 is 'TYPE7';
COMMENT ON column TYPETEST.TYPE8 is 'TYPE8';
COMMENT ON column TYPETEST.TYPE9 is 'TYPE9';
COMMENT ON column TYPETEST.TYPE10 is 'TYPE10';
COMMENT ON column TYPETEST.TYPE11 is 'TYPE11';
COMMENT ON column TYPETEST.TYPE12 is 'TYPE12';
COMMENT ON column TYPETEST.TYPE13 is 'TYPE13';
COMMENT ON column TYPETEST.TYPE14 is 'TYPE14';
COMMENT ON column TYPETEST.TYPE15 is 'TYPE15';
COMMENT ON column TYPETEST.TYPE16 is 'TYPE16';


text:
int main() {

	using namespace AliRec;
	const auto& data = AliRec::IO::load("data.txt");

	auto engine = RecEngine::instance(Mode::PC, Strategy::UserBased);
	engine->init(data);
	engine->start();
	const auto& result = engine->result();

	IO::printTo("out.txt", result);

	return 0;
}


text:
package com.itelg.texin.domain.exception;

public class ParsingFailedException extends Exception
{
	private static final long serialVersionUID = 6802209096277301767L;
	private int rowNumber;

	public ParsingFailedException(int rowNumber, Throwable e)
	{
		super("Failed to parse row " + rowNumber + ": " + e.getMessage(), e);
		this.rowNumber = rowNumber;
	}

	public int getRowNumber()
	{
		return rowNumber;
	}
}


text:
"""ThreatConnect TI Event"""
from ..group import Group

class Event(Group):
    """Unique API calls for Event API Endpoints

    Valid status:
    + Escalated
    + False Positive
    + Needs Review
    + No Further Action

    Args:
        tcex (TcEx): An instantiated instance of TcEx object.
        event_date (str, kwargs): The event "event date" datetime expression for this Group.
        name (str, kwargs): [Required for Create] The name for this Group.
        owner (str, kwargs): The name for this Group. Default to default Org when not provided
        status (str, kwargs): The status for this Group.
    """

    def __init__(self, tcex, **kwargs):
        """Initialize Class Properties."""
        super().__init__(tcex, sub_type='Event', api_entity='event', api_branch='events', **kwargs)

    def event_date(self, event_date):
        """Update the event date for the Event.

        Args:
            event_date (str): The event datetime expression for this Group.

        Returns:
            requests.Response: The response from the API call.
        """
        if not self.can_update():
            self._tcex.handle_error(910, [self.type])

        event_date = self._utils.datetime.format_datetime(
            event_date, date_format='%Y-%m-%dT%H:%M:%SZ'
        )
        self._data['eventDate'] = event_date
        request = {'eventDate': event_date}
        return self.tc_requests.update(self.api_type, self.api_branch, self.unique_id, request)

    def status(self, status):
        """Update the event date for the Event.

        Valid status:
        + Escalated
        + False Positive
        + Needs Review
        + No Further Action

        Args:
            status (str, kwargs): The status for this Group.

        Returns:
            requests.Response: The response from the API call.
        """
        if not self.can_update():
            self._tcex.handle_error(910, [self.type])

        self._data['status'] = status
        request = {'status': status}
        return self.tc_requests.update(self.api_type, self.api_branch, self.unique_id, request)


text:
@interface GMUSidebarController : NSObject <NSOutlineViewDataSource, NSOutlineViewDelegate>

@property(weak) IBOutlet NSOutlineView *sidebar;

@end


text:
package de.uni_hannover.sra.minimax_simulator.ui.gui.util.undo.commands;

import de.uni_hannover.sra.minimax_simulator.model.signal.SignalRow;
import de.uni_hannover.sra.minimax_simulator.model.signal.SignalTable;

/**
 * This {@link Command} is used to modify {@link SignalRow}s.
 *
 * @author Philipp Rohde
 */
public class SignalRowModifiedCommand extends Command {

    private final int index;
    private final SignalRow oldValue;
    private final SignalRow newValue;
    private final SignalTable table;

    /**
     * Creates the {@code SignalRowModifiedCommand} instance for the change.
     *
     * @param index
     *         the index of the modified {@code SignalRow}
     * @param oldValue
     *         the old value of the {@code SignalRow}
     * @param newValue
     *         the new value of the {@code SignalRow}
     * @param table
     *         the {@code SignalTable} of the simulated machine
     */
    public SignalRowModifiedCommand(int index, SignalRow oldValue, SignalRow newValue, SignalTable table) {
        super("signal.modified");
        this.index = index;
        this.oldValue = oldValue;
        this.newValue = newValue;
        this.table = table;
    }

    @Override
    public void execute() {
        table.setSignalRow(index, newValue);
    }

    @Override
    public void undo() {
        table.setSignalRow(index, oldValue);
    }
}


text:
using System.IO;
using System.Threading.Tasks;

namespace Odachi.Abstractions
{
	/// <summary>
	/// Named binary data.
	/// </summary>
	public interface IBlob
	{
		/// <summary>
		/// Name.
		/// </summary>
		string Name { get; }

		/// <summary>
		/// Returns whether it is preffered to use async. Not respecting this value can lead to degraded perfromance.
		/// </summary>
		bool PreferAsync { get; }

		/// <summary>
		/// Opens stream for reading.
		/// </summary>
		Stream OpenRead();

		/// <summary>
		/// Opens stream for reading.
		/// </summary>
		Task<Stream> OpenReadAsync();
	}
}