text:
#include <iostream>
#include <sstream>
#include <string>

#include "arch/tlb.hh"
#include "base/loader/symtab.hh"
#include "base/cprintf.hh"
#include "base/misc.hh"
#include "base/output.hh"
#include "base/trace.hh"
#include "cpu/checker/cpu.hh"
#include "cpu/base.hh"
#include "cpu/cpuevent.hh"
#include "cpu/profile.hh"
#include "cpu/thread_context.hh"
#include "debug/Mwait.hh"
#include "debug/SyscallVerbose.hh"
#include "mem/page_table.hh"
#include "params/BaseCPU.hh"
#include "sim/full_system.hh"
#include "sim/process.hh"
#include "sim/sim_events.hh"
#include "sim/sim_exit.hh"
#include "sim/system.hh"

// Hack
#include "sim/stat_control.hh"

using namespace std;

vector<BaseCPU *> BaseCPU::cpuList;

// This variable reflects the max number of threads in any CPU.  Be
// careful to only use it once all the CPUs that you care about have
// been initialized
int maxThreadsPerCPU = 1;

CPUProgressEvent::CPUProgressEvent(BaseCPU *_cpu, Tick ival)
    : Event(Event::Progress_Event_Pri), _interval(ival), lastNumInst(0),
      cpu(_cpu), _repeatEvent(true)
{
    if (_interval)
        cpu->schedule(this, curTick() + _interval);
}

void
CPUProgressEvent::process()
{
    Counter temp = cpu->totalOps();

    if (_repeatEvent)
      cpu->schedule(this, curTick() + _interval);

    if(cpu->switchedOut()) {
      return;
    }

#ifndef NDEBUG
    double ipc = double(temp - lastNumInst) / (_interval / cpu->clockPeriod());

    DPRINTFN("%s progress event, total committed:%i, progress insts committed: "
             "%lli, IPC: %0.8d\n", cpu->name(), temp, temp - lastNumInst,
             ipc);
    ipc = 0.0;
#else
    cprintf("%lli: %s progress event, total committed:%i, progress insts "
            "committed: %lli\n", curTick(), cpu->name(), temp,
            temp - lastNumInst);
#endif
    lastNumInst = temp;
}

const char *
CPUProgressEvent::description() const
{
    return "CPU Progress";
}

BaseCPU::BaseCPU(Params *p, bool is_checker)
    : MemObject(p), instCnt(0), _cpuId(p->cpu_id), _socketId(p->socket_id),
      _instMasterId(p->system->getMasterId(name() + ".inst")),
      _dataMasterId(p->system->getMasterId(name() + ".data")),
      _taskId(ContextSwitchTaskId::Unknown), _pid(Request::invldPid),
      _switchedOut(p->switched_out), _cacheLineSize(p->system->cacheLineSize()),
      interrupts(p->interrupts), profileEvent(NULL),
      numThreads(p->numThreads), system(p->system),
      functionTraceStream(nullptr), currentFunctionStart(0),
      currentFunctionEnd(0), functionEntryTick(0),
      addressMonitor()
{
    // if Python did not provide a valid ID, do it here
    if (_cpuId == -1 ) {
        _cpuId = cpuList.size();
    }

    // add self to global list of CPUs
    cpuList.push_back(this);

    DPRINTF(SyscallVerbose, "Constructing CPU with id %d, socket id %d\n",
                _cpuId, _socketId);

    if (numThreads > maxThreadsPerCPU)
        maxThreadsPerCPU = numThreads;

    // allocate per-thread instruction-based event queues
    comInstEventQueue = new EventQueue *[numThreads];
    for (ThreadID tid = 0; tid < numThreads; ++tid)
        comInstEventQueue[tid] =
            new EventQueue("instruction-based event queue");

    //
    // set up instruction-count-based termination events, if any
    //
    if (p->max_insts_any_thread != 0) {
        const char *cause = "a thread reached the max instruction count";
        for (ThreadID tid = 0; tid < numThreads; ++tid)
            scheduleInstStop(tid, p->max_insts_any_thread, cause);
    }

    // Set up instruction-count-based termination events for SimPoints
    // Typically, there are more than one action points.
    // Simulation.py is responsible to take the necessary actions upon
    // exitting the simulation loop.
    if (!p->simpoint_start_insts.empty()) {
        const char *cause = "simpoint starting point found";
        for (size_t i = 0; i < p->simpoint_start_insts.size(); ++i)
            scheduleInstStop(0, p->simpoint_start_insts[i], cause);
    }

    if (p->max_insts_all_threads != 0) {
        const char *cause = "all threads reached the max instruction count";

        // allocate & initialize shared downcounter: each event will
        // decrement this when triggered; simulation will terminate
        // when counter reaches 0
        int *counter = new int;
        *counter = numThreads;
        for (ThreadID tid = 0; tid < numThreads; ++tid) {
            Event *event = new CountedExitEvent(cause, *counter);
            comInstEventQueue[tid]->schedule(event, p->max_insts_all_threads);
        }
    }

    // allocate per-thread load-based event queues
    comLoadEventQueue = new EventQueue *[numThreads];
    for (ThreadID tid = 0; tid < numThreads; ++tid)
        comLoadEventQueue[tid] = new EventQueue("load-based event queue");

    //
    // set up instruction-count-based termination events, if any
    //
    if (p->max_loads_any_thread != 0) {
        const char *cause = "a thread reached the max load count";
        for (ThreadID tid = 0; tid < numThreads; ++tid)
            scheduleLoadStop(tid, p->max_loads_any_thread, cause);
    }

    if (p->max_loads_all_threads != 0) {
        const char *cause = "all threads reached the max load count";
        // allocate & initialize shared downcounter: each event will
        // decrement this when triggered; simulation will terminate
        // when counter reaches 0
        int *counter = new int;
        *counter = numThreads;
        for (ThreadID tid = 0; tid < numThreads; ++tid) {
            Event *event = new CountedExitEvent(cause, *counter);
            comLoadEventQueue[tid]->schedule(event, p->max_loads_all_threads);
        }
    }

    functionTracingEnabled = false;
    if (p->function_trace) {
        const string fname = csprintf("ftrace.%s", name());
        functionTraceStream = simout.find(fname);
        if (!functionTraceStream)
            functionTraceStream = simout.create(fname);

        currentFunctionStart = currentFunctionEnd = 0;
        functionEntryTick = p->function_trace_start;

        if (p->function_trace_start == 0) {
            functionTracingEnabled = true;
        } else {
            typedef EventWrapper<BaseCPU, &BaseCPU::enableFunctionTrace> wrap;
            Event *event = new wrap(this, true);
            schedule(event, p->function_trace_start);
        }
    }

    // The interrupts should always be present unless this CPU is
    // switched in later or in case it is a checker CPU
    if (!params()->switched_out && !is_checker) {
        if (interrupts) {
            interrupts->setCPU(this);
        } else {
            fatal("CPU %s has no interrupt controller.\n"
                  "Ensure createInterruptController() is called.\n", name());
        }
    }

    if (FullSystem) {
        if (params()->profile)
            profileEvent = new ProfileEvent(this, params()->profile);
    }
    tracer = params()->tracer;

    if (params()->isa.size() != numThreads) {
        fatal("Number of ISAs (%i) assigned to the CPU does not equal number "
              "of threads (%i).\n", params()->isa.size(), numThreads);
    }

    lat_vdev.resize(0);
    status_vdev.resize(0);
}

void
BaseCPU::enableFunctionTrace()
{
    functionTracingEnabled = true;
}

BaseCPU::~BaseCPU()
{
    delete profileEvent;
    delete[] comLoadEventQueue;
    delete[] comInstEventQueue;
}

void
BaseCPU::armMonitor(Addr address)
{
    addressMonitor.armed = true;
    addressMonitor.vAddr = address;
    addressMonitor.pAddr = 0x0;
    DPRINTF(Mwait,"Armed monitor (vAddr=0x%lx)\n", address);
}

bool
BaseCPU::mwait(PacketPtr pkt)
{
    if(addressMonitor.gotWakeup == false) {
        int block_size = cacheLineSize();
        uint64_t mask = ~((uint64_t)(block_size - 1));

        assert(pkt->req->hasPaddr());
        addressMonitor.pAddr = pkt->getAddr() & mask;
        addressMonitor.waiting = true;

        DPRINTF(Mwait,"mwait called (vAddr=0x%lx, line's paddr=0x%lx)\n",
                addressMonitor.vAddr, addressMonitor.pAddr);
        return true;
    } else {
        addressMonitor.gotWakeup = false;
        return false;
    }
}

void
BaseCPU::mwaitAtomic(ThreadContext *tc, TheISA::TLB *dtb)
{
    Request req;
    Addr addr = addressMonitor.vAddr;
    int block_size = cacheLineSize();
    uint64_t mask = ~((uint64_t)(block_size - 1));
    int size = block_size;

    //The address of the next line if it crosses a cache line boundary.
    Addr secondAddr = roundDown(addr + size - 1, block_size);

    if (secondAddr > addr)
        size = secondAddr - addr;

    req.setVirt(0, addr, size, 0x0, dataMasterId(), tc->instAddr());

    // translate to physical address
    Fault fault = dtb->translateAtomic(&req, tc, BaseTLB::Read);
    assert(fault == NoFault);

    addressMonitor.pAddr = req.getPaddr() & mask;
    addressMonitor.waiting = true;

    DPRINTF(Mwait,"mwait called (vAddr=0x%lx, line's paddr=0x%lx)\n",
            addressMonitor.vAddr, addressMonitor.pAddr);
}

void
BaseCPU::init()
{
    if (!params()->switched_out) {
        registerThreadContexts();

        verifyMemoryMode();
    }
}

void
BaseCPU::startup()
{
    if (FullSystem) {
        if (!params()->switched_out && profileEvent)
            schedule(profileEvent, curTick());
    }

    if (params()->progress_interval) {
        new CPUProgressEvent(this, params()->progress_interval);
    }
}

ProbePoints::PMUUPtr
BaseCPU::pmuProbePoint(const char *name)
{
    ProbePoints::PMUUPtr ptr;
    ptr.reset(new ProbePoints::PMU(getProbeManager(), name));

    return ptr;
}

void
BaseCPU::regProbePoints()
{
    ppCycles = pmuProbePoint("Cycles");

    ppRetiredInsts = pmuProbePoint("RetiredInsts");
    ppRetiredLoads = pmuProbePoint("RetiredLoads");
    ppRetiredStores = pmuProbePoint("RetiredStores");
    ppRetiredBranches = pmuProbePoint("RetiredBranches");
}

void
BaseCPU::probeInstCommit(const StaticInstPtr &inst)
{
    if (!inst->isMicroop() || inst->isLastMicroop())
        ppRetiredInsts->notify(1);

    if (inst->isLoad())
        ppRetiredLoads->notify(1);

    if (inst->isStore())
        ppRetiredStores->notify(1);

    if (inst->isControl())
        ppRetiredBranches->notify(1);
}

void
BaseCPU::regStats()
{
    using namespace Stats;

    numCycles
        .name(name() + ".numCycles")
        .desc("number of cpu cycles simulated")
        ;

    numWorkItemsStarted
        .name(name() + ".numWorkItemsStarted")
        .desc("number of work items this cpu started")
        ;

    numWorkItemsCompleted
        .name(name() + ".numWorkItemsCompleted")
        .desc("number of work items this cpu completed")
        ;

    int size = threadContexts.size();
    if (size > 1) {
        for (int i = 0; i < size; ++i) {
            stringstream namestr;
            ccprintf(namestr, "%s.ctx%d", name(), i);
            threadContexts[i]->regStats(namestr.str());
        }
    } else if (size == 1)
        threadContexts[0]->regStats(name());
}

BaseMasterPort &
BaseCPU::getMasterPort(const string &if_name, PortID idx)
{
    // Get the right port based on name. This applies to all the
    // subclasses of the base CPU and relies on their implementation
    // of getDataPort and getInstPort. In all cases there methods
    // return a MasterPort pointer.
    if (if_name == "dcache_port")
        return getDataPort();
    else if (if_name == "icache_port")
        return getInstPort();
    else
        return MemObject::getMasterPort(if_name, idx);
}

void
BaseCPU::registerThreadContexts()
{
    ThreadID size = threadContexts.size();
    for (ThreadID tid = 0; tid < size; ++tid) {
        ThreadContext *tc = threadContexts[tid];

        /** This is so that contextId and cpuId match where there is a
         * 1cpu:1context relationship.  Otherwise, the order of registration
         * could affect the assignment and cpu 1 could have context id 3, for
         * example.  We may even want to do something like this for SMT so that
         * cpu 0 has the lowest thread contexts and cpu N has the highest, but
         * I'll just do this for now
         */
        if (numThreads == 1)
            tc->setContextId(system->registerThreadContext(tc, _cpuId));
        else
            tc->setContextId(system->registerThreadContext(tc));

        if (!FullSystem)
            tc->getProcessPtr()->assignThreadContext(tc->contextId());
    }
}

int
BaseCPU::findContext(ThreadContext *tc)
{
    ThreadID size = threadContexts.size();
    for (ThreadID tid = 0; tid < size; ++tid) {
        if (tc == threadContexts[tid])
            return tid;
    }
    return 0;
}

void
BaseCPU::switchOut()
{
    assert(!_switchedOut);
    _switchedOut = true;
    if (profileEvent && profileEvent->scheduled())
        deschedule(profileEvent);

    // Flush all TLBs in the CPU to avoid having stale translations if
    // it gets switched in later.
    flushTLBs();
}

void
BaseCPU::takeOverFrom(BaseCPU *oldCPU)
{
    assert(threadContexts.size() == oldCPU->threadContexts.size());
    assert(_cpuId == oldCPU->cpuId());
    assert(_switchedOut);
    assert(oldCPU != this);
    _pid = oldCPU->getPid();
    _taskId = oldCPU->taskId();
    _switchedOut = false;

    ThreadID size = threadContexts.size();
    for (ThreadID i = 0; i < size; ++i) {
        ThreadContext *newTC = threadContexts[i];
        ThreadContext *oldTC = oldCPU->threadContexts[i];

        newTC->takeOverFrom(oldTC);

        CpuEvent::replaceThreadContext(oldTC, newTC);

        assert(newTC->contextId() == oldTC->contextId());
        assert(newTC->threadId() == oldTC->threadId());
        system->replaceThreadContext(newTC, newTC->contextId());

        /* This code no longer works since the zero register (e.g.,
         * r31 on Alpha) doesn't necessarily contain zero at this
         * point.
           if (DTRACE(Context))
            ThreadContext::compare(oldTC, newTC);
        */

        BaseMasterPort *old_itb_port = oldTC->getITBPtr()->getMasterPort();
        BaseMasterPort *old_dtb_port = oldTC->getDTBPtr()->getMasterPort();
        BaseMasterPort *new_itb_port = newTC->getITBPtr()->getMasterPort();
        BaseMasterPort *new_dtb_port = newTC->getDTBPtr()->getMasterPort();

        // Move over any table walker ports if they exist
        if (new_itb_port) {
            assert(!new_itb_port->isConnected());
            assert(old_itb_port);
            assert(old_itb_port->isConnected());
            BaseSlavePort &slavePort = old_itb_port->getSlavePort();
            old_itb_port->unbind();
            new_itb_port->bind(slavePort);
        }
        if (new_dtb_port) {
            assert(!new_dtb_port->isConnected());
            assert(old_dtb_port);
            assert(old_dtb_port->isConnected());
            BaseSlavePort &slavePort = old_dtb_port->getSlavePort();
            old_dtb_port->unbind();
            new_dtb_port->bind(slavePort);
        }
        newTC->getITBPtr()->takeOverFrom(oldTC->getITBPtr());
        newTC->getDTBPtr()->takeOverFrom(oldTC->getDTBPtr());

        // Checker whether or not we have to transfer CheckerCPU
        // objects over in the switch
        CheckerCPU *oldChecker = oldTC->getCheckerCpuPtr();
        CheckerCPU *newChecker = newTC->getCheckerCpuPtr();
        if (oldChecker && newChecker) {
            BaseMasterPort *old_checker_itb_port =
                oldChecker->getITBPtr()->getMasterPort();
            BaseMasterPort *old_checker_dtb_port =
                oldChecker->getDTBPtr()->getMasterPort();
            BaseMasterPort *new_checker_itb_port =
                newChecker->getITBPtr()->getMasterPort();
            BaseMasterPort *new_checker_dtb_port =
                newChecker->getDTBPtr()->getMasterPort();

            newChecker->getITBPtr()->takeOverFrom(oldChecker->getITBPtr());
            newChecker->getDTBPtr()->takeOverFrom(oldChecker->getDTBPtr());

            // Move over any table walker ports if they exist for checker
            if (new_checker_itb_port) {
                assert(!new_checker_itb_port->isConnected());
                assert(old_checker_itb_port);
                assert(old_checker_itb_port->isConnected());
                BaseSlavePort &slavePort =
                    old_checker_itb_port->getSlavePort();
                old_checker_itb_port->unbind();
                new_checker_itb_port->bind(slavePort);
            }
            if (new_checker_dtb_port) {
                assert(!new_checker_dtb_port->isConnected());
                assert(old_checker_dtb_port);
                assert(old_checker_dtb_port->isConnected());
                BaseSlavePort &slavePort =
                    old_checker_dtb_port->getSlavePort();
                old_checker_dtb_port->unbind();
                new_checker_dtb_port->bind(slavePort);
            }
        }
    }

    interrupts = oldCPU->interrupts;
    interrupts->setCPU(this);
    oldCPU->interrupts = NULL;

    if (FullSystem) {
        for (ThreadID i = 0; i < size; ++i)
            threadContexts[i]->profileClear();

        if (profileEvent)
            schedule(profileEvent, curTick());
    }

    // All CPUs have an instruction and a data port, and the new CPU's
    // ports are dangling while the old CPU has its ports connected
    // already. Unbind the old CPU and then bind the ports of the one
    // we are switching to.
    assert(!getInstPort().isConnected());
    assert(oldCPU->getInstPort().isConnected());
    BaseSlavePort &inst_peer_port = oldCPU->getInstPort().getSlavePort();
    oldCPU->getInstPort().unbind();
    getInstPort().bind(inst_peer_port);

    assert(!getDataPort().isConnected());
    assert(oldCPU->getDataPort().isConnected());
    BaseSlavePort &data_peer_port = oldCPU->getDataPort().getSlavePort();
    oldCPU->getDataPort().unbind();
    getDataPort().bind(data_peer_port);
}

void
BaseCPU::flushTLBs()
{
    for (ThreadID i = 0; i < threadContexts.size(); ++i) {
        ThreadContext &tc(*threadContexts[i]);
        CheckerCPU *checker(tc.getCheckerCpuPtr());

        tc.getITBPtr()->flushAll();
        tc.getDTBPtr()->flushAll();
        if (checker) {
            checker->getITBPtr()->flushAll();
            checker->getDTBPtr()->flushAll();
        }
    }
}

BaseCPU::ProfileEvent::ProfileEvent(BaseCPU *_cpu, Tick _interval)
    : cpu(_cpu), interval(_interval)
{ }

void
BaseCPU::ProfileEvent::process()
{
    ThreadID size = cpu->threadContexts.size();
    for (ThreadID i = 0; i < size; ++i) {
        ThreadContext *tc = cpu->threadContexts[i];
        tc->profileSample();
    }

    cpu->schedule(this, curTick() + interval);
}

void
BaseCPU::serialize(std::ostream &os)
{
    SERIALIZE_SCALAR(instCnt);

    if (!_switchedOut) {
        /* Unlike _pid, _taskId is not serialized, as they are dynamically
         * assigned unique ids that are only meaningful for the duration of
         * a specific run. We will need to serialize the entire taskMap in
         * system. */
        SERIALIZE_SCALAR(_pid);

        interrupts->serialize(os);

        // Serialize the threads, this is done by the CPU implementation.
        for (ThreadID i = 0; i < numThreads; ++i) {
            nameOut(os, csprintf("%s.xc.%i", name(), i));
            serializeThread(os, i);
        }
    }
}

void
BaseCPU::unserialize(Checkpoint *cp, const std::string &section)
{
    UNSERIALIZE_SCALAR(instCnt);

    if (!_switchedOut) {
        UNSERIALIZE_SCALAR(_pid);
        interrupts->unserialize(cp, section);

        // Unserialize the threads, this is done by the CPU implementation.
        for (ThreadID i = 0; i < numThreads; ++i)
            unserializeThread(cp, csprintf("%s.xc.%i", section, i), i);
    }
}

void
BaseCPU::scheduleInstStop(ThreadID tid, Counter insts, const char *cause)
{
    const Tick now(comInstEventQueue[tid]->getCurTick());
    Event *event(new LocalSimLoopExitEvent(cause, 0));

    comInstEventQueue[tid]->schedule(event, now + insts);
}

AddressMonitor::AddressMonitor() {
    armed = false;
    waiting = false;
    gotWakeup = false;
}

bool AddressMonitor::doMonitor(PacketPtr pkt) {
    assert(pkt->req->hasPaddr());
    if(armed && waiting) {
        if(pAddr == pkt->getAddr()) {
            DPRINTF(Mwait,"pAddr=0x%lx invalidated: waking up core\n",
                    pkt->getAddr());
            waiting = false;
            return true;
        }
    }
    return false;
}

void
BaseCPU::scheduleLoadStop(ThreadID tid, Counter loads, const char *cause)
{
    const Tick now(comLoadEventQueue[tid]->getCurTick());
    Event *event(new LocalSimLoopExitEvent(cause, 0));

    comLoadEventQueue[tid]->schedule(event, now + loads);
}

void
BaseCPU::traceFunctionsInternal(Addr pc)
{
    if (!debugSymbolTable)
        return;

    // if pc enters different function, print new function symbol and
    // update saved range.  Otherwise do nothing.
    if (pc < currentFunctionStart || pc >= currentFunctionEnd) {
        string sym_str;
        bool found = debugSymbolTable->findNearestSymbol(pc, sym_str,
                                                         currentFunctionStart,
                                                         currentFunctionEnd);

        if (!found) {
            // no symbol found: use addr as label
            sym_str = csprintf("0x%x", pc);
            currentFunctionStart = pc;
            currentFunctionEnd = pc + 1;
        }

        ccprintf(*functionTraceStream, " (%d)\n%d: %s",
                 curTick() - functionEntryTick, curTick(), sym_str);
        functionEntryTick = curTick();
    }
}

int
BaseCPU::registerVDev(Tick tick, uint32_t &id)
{
    id = lat_vdev.size();
    lat_vdev.push_back(tick);
    status_vdev.push_back(0);
    return 1;
}

Tick
BaseCPU::getTotalLat()
{
    Tick total = 0;
    auto iter_lat = lat_vdev.cbegin();
    auto iter_status = status_vdev.cbegin();
    for (; iter_lat != lat_vdev.cend() && iter_status != status_vdev.cend();
           iter_lat++, iter_status++) {
        if (*iter_status)
            total += (*iter_lat);
    }
    return total;
}

int
BaseCPU::virtualDeviceStart(uint32_t id)
{
    status_vdev[id] = 1;
    return 1;
}

int
BaseCPU::virtualDeviceEnd(uint32_t id)
{
    status_vdev[id] = 0;
    return 1;
}


text:
'use strict';

// Clients controller
angular.module('clients').controller('ClientsController', ['$scope', '$stateParams', '$location', 'Authentication', 'Clients',
	function($scope, $stateParams, $location, Authentication, Clients) {
		$scope.authentication = Authentication;

		// Create new Client
		$scope.create = function() {
			// Create new Client object
			var client = new Clients ({
				name: this.name,
				surname: this.surname,
				address: this.address,
				phone: this.phone
			});

			// Redirect after save
			client.$save(function(response) {
				$location.path('clients/' + response._id);

				// Clear form fields
				$scope.name = '';
			}, function(errorResponse) {
				$scope.error = errorResponse.data.message;
			});
		};

		// Remove existing Client
		$scope.remove = function(client) {
			if ( client ) {
				client.$remove();

				for (var i in $scope.clients) {
					if ($scope.clients [i] === client) {
						$scope.clients.splice(i, 1);
					}
				}
			} else {
				$scope.client.$remove(function() {
					$location.path('clients');
				});
			}
		};

		// Update existing Client
		$scope.update = function() {
			var client = $scope.client;

			client.$update(function() {
				$location.path('clients/' + client._id);
			}, function(errorResponse) {
				$scope.error = errorResponse.data.message;
			});
		};

		// Find a list of Clients
		$scope.find = function() {
			$scope.clients = Clients.query();
		};

		// Find existing Client
		$scope.findOne = function() {
			$scope.client = Clients.get({
				clientId: $stateParams.clientId
			});
		};

		// Show a new client
		$scope.showClient = function(id) {
			$location.path('/clients/' + id);
		};
	}
]);

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
soot.jimple.toolkits.annotation.purity Class Hierarchy (Soot API)
</TITLE>

<META NAME="date" CONTENT="2012-01-22">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
      Class
      Use
    Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Hierarchy For Package soot.jimple.toolkits.annotation.purity

Package Hierarchies:
All Packages

Class Hierarchy

java.lang.Object

soot.toolkits.scalar.AbstractFlowAnalysis<N,A>

soot.toolkits.scalar.FlowAnalysis<N,A>

soot.toolkits.scalar.ForwardFlowAnalysis<N,A>

soot.jimple.toolkits.annotation.purity.PurityIntraproceduralAnalysis

soot.jimple.toolkits.annotation.purity.AbstractInterproceduralAnalysis

soot.jimple.toolkits.annotation.purity.PurityInterproceduralAnalysis

soot.jimple.toolkits.annotation.purity.DirectedCallGraph (implements soot.toolkits.graph.DirectedGraph<N>)

soot.jimple.toolkits.annotation.purity.PurityEdge
soot.jimple.toolkits.annotation.purity.PurityGlobalNode (implements soot.jimple.toolkits.annotation.purity.PurityNode)

soot.jimple.toolkits.annotation.purity.PurityGraph
soot.jimple.toolkits.annotation.purity.PurityGraphBox
soot.jimple.toolkits.annotation.purity.PurityMethodNode (implements soot.jimple.toolkits.annotation.purity.PurityNode)

soot.jimple.toolkits.annotation.purity.PurityParamNode (implements soot.jimple.toolkits.annotation.purity.PurityNode)

soot.jimple.toolkits.annotation.purity.PurityThisNode

soot.jimple.toolkits.annotation.purity.PurityStmtNode (implements soot.jimple.toolkits.annotation.purity.PurityNode)

soot.Transformer

soot.SceneTransformer

soot.jimple.toolkits.annotation.purity.PurityAnalysis

Interface Hierarchy

soot.jimple.toolkits.annotation.purity.PurityNode
soot.jimple.toolkits.annotation.purity.SootMethodFilter

      Overview
      Package
      Class
      Use
    Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Contact - Megan Sevidal</title>

    <link href="css/bootstrap.min.css" rel="stylesheet">

    <link href="css/business-casual.css" rel="stylesheet">

    <link href="https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800" rel="stylesheet" type="text/css">
    <link href="https://fonts.googleapis.com/css?family=Josefin+Slab:100,300,400,600,700,100italic,300italic,400italic,600italic,700italic" rel="stylesheet" type="text/css">

Megan Sevidal

contact me

                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    Toggle navigation

                </button>

                Megan Sevidal

                        Home

                        Case Studies

                        Blog

                        Contact

                        Contact Me

Phone:
                        703.939.0965

Email:
                        msevidal18@gmail.com

Address:
                        Richmond, Va

Contact
                        form

Want to get in touch with me? Fill out the form below and I'll get right back to you!

                            <form action="https://getsimpleform.com/messages?form_api_token=fbefad5031188e941061d95e64d4af85" method="post">

                                <input type="text" placeholder="Full Name" name="name"/>
                                <input type="text" placeholder="Email" name="email"/>
                                <input type="text" placeholder="Phone" name="phone"/>
                                <input type="text" placeholder="Write Your Message Here" name="message" required/>
                                <input type='submit' value='submit' />
                            </form>

Copyright © msevidal 2017


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

namespace netDxf.Tables
{
    /// <summary>
    /// Represents a User Coordinate System.
    /// </summary>
    public class UCS :
        TableObject
    {
        #region private fields

        private Vector3 origin;
        private Vector3 xAxis;
        private Vector3 yAxis;
        private Vector3 zAxis;

        #endregion

        #region constructors

        /// <summary>
        /// Initializes a new instance of the <c>UCS</c> class.
        /// </summary>
        /// <param name="name">User coordinate system name.</param>
        public UCS(string name)
            : this(name, true)
        {
        }

        internal UCS(string name, bool checkName)
            : base(name, DxfObjectCode.Ucs, checkName)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException(nameof(name), "The UCS name should be at least one character long.");
            }

            this.origin = Vector3.Zero;
            this.xAxis = Vector3.UnitX;
            this.yAxis = Vector3.UnitY;
            this.zAxis = Vector3.UnitZ;
        }

        /// <summary>
        /// Initializes a new instance of the <c>UCS</c> class.
        /// </summary>
        /// <param name="name">User coordinate system name.</param>
        /// <param name="origin">Origin in WCS.</param>
        /// <param name="xDirection">X-axis direction in WCS.</param>
        /// <param name="yDirection">Y-axis direction in WCS.</param>
        /// <remarks>
        /// The x-axis direction and y-axis direction must be perpendicular.
        /// </remarks>
        public UCS(string name, Vector3 origin, Vector3 xDirection, Vector3 yDirection)
            : this(name, origin, xDirection, yDirection, true)
        {
        }

        internal UCS(string name, Vector3 origin, Vector3 xDirection, Vector3 yDirection, bool checkName)
            : base(name, DxfObjectCode.Ucs, checkName)
        {
            if (!Vector3.ArePerpendicular(xDirection, yDirection))
            {
                throw new ArgumentException("X-axis direction and Y-axis direction must be perpendicular.");
            }

            this.origin = origin;
            this.xAxis = xDirection;
            this.xAxis.Normalize();
            this.yAxis = yDirection;
            this.yAxis.Normalize();
            this.zAxis = Vector3.CrossProduct(this.xAxis, this.yAxis);
        }

        #endregion

        #region public properties

        /// <summary>
        /// Gets or sets the user coordinate system origin in WCS.
        /// </summary>
        public Vector3 Origin
        {
            get { return this.origin; }
            set { this.origin = value; }
        }

        /// <summary>
        /// Gets the user coordinate system x-axis direction in WCS.
        /// </summary>
        public Vector3 XAxis
        {
            get { return this.xAxis; }
        }

        /// <summary>
        /// Gets the user coordinate system y-axis direction in WCS.
        /// </summary>
        public Vector3 YAxis
        {
            get { return this.yAxis; }
        }

        /// <summary>
        /// Gets the user coordinate system z-axis direction in WCS.
        /// </summary>
        public Vector3 ZAxis
        {
            get { return this.zAxis; }
        }

        /// <summary>
        /// Gets the owner of the actual user coordinate system.
        /// </summary>
        public new UCSs Owner
        {
            get { return (UCSs) base.Owner; }
            internal set { base.Owner = value; }
        }

        #endregion

        #region public methods

        /// <summary>
        /// Sets the user coordinate system x-axis and y-axis direction.
        /// </summary>
        /// <param name="xDirection">X-axis direction in WCS.</param>
        /// <param name="yDirection">Y-axis direction in WCS.</param>
        public void SetAxis(Vector3 xDirection, Vector3 yDirection)
        {
            if (!Vector3.ArePerpendicular(xDirection, yDirection))
            {
                throw new ArgumentException("X-axis direction and Y-axis direction must be perpendicular.");
            }
            this.xAxis = xDirection;
            this.xAxis.Normalize();
            this.yAxis = yDirection;
            this.yAxis.Normalize();
            this.zAxis = Vector3.CrossProduct(this.xAxis, this.yAxis);
        }

        /// <summary>
        /// Creates a new user coordinate system from the x-axis and a point on XY plane.
        /// </summary>
        /// <param name="name">User coordinate system name.</param>
        /// <param name="origin">Origin in WCS.</param>
        /// <param name="xDirection">X-axis direction in WCS.</param>
        /// <param name="pointOnPlaneXY">Point on the XY plane.</param>
        /// <returns>A new user coordinate system.</returns>
        public static UCS FromXAxisAndPointOnXYplane(string name, Vector3 origin, Vector3 xDirection, Vector3 pointOnPlaneXY)
        {
            UCS ucs = new UCS(name);
            ucs.origin = origin;
            ucs.xAxis = xDirection;
            ucs.xAxis.Normalize();
            ucs.zAxis = Vector3.CrossProduct(xDirection, pointOnPlaneXY);
            ucs.zAxis.Normalize();
            ucs.yAxis = Vector3.CrossProduct(ucs.zAxis, ucs.xAxis);
            return ucs;
        }

        /// <summary>
        /// Creates a new user coordinate system from the XY plane normal (z-axis).
        /// </summary>
        /// <param name="name">User coordinate system name.</param>
        /// <param name="origin">Origin in WCS.</param>
        /// <param name="normal">XY plane normal (z-axis).</param>
        /// <returns>A new user coordinate system.</returns>
        /// <remarks>This method uses the ArbitraryAxis algorithm to obtain the user coordinate system x-axis and y-axis.</remarks>
        public static UCS FromNormal(string name, Vector3 origin, Vector3 normal)
        {
            Matrix3 mat = MathHelper.ArbitraryAxis(normal);
            UCS ucs = new UCS(name);
            ucs.origin = origin;
            ucs.xAxis = new Vector3(mat.M11, mat.M21, mat.M31);
            ucs.yAxis = new Vector3(mat.M12, mat.M22, mat.M32);
            ucs.zAxis = new Vector3(mat.M13, mat.M23, mat.M33);
            return ucs;
        }

        /// <summary>
        /// Creates a new user coordinate system from the XY plane normal (z-axis).
        /// </summary>
        /// <param name="name">User coordinate system name.</param>
        /// <param name="origin">Origin in WCS.</param>
        /// <param name="normal">XY plane normal (z-axis).</param>
        /// <param name="rotation">The counter-clockwise angle in radians along the normal (z-axis).</param>
        /// <returns>A new user coordinate system.</returns>
        /// <remarks>This method uses the ArbitraryAxis algorithm to obtain the user coordinate system x-axis and y-axis.</remarks>
        public static UCS FromNormal(string name, Vector3 origin, Vector3 normal, double rotation)
        {
            Matrix3 mat = MathHelper.ArbitraryAxis(normal);
            Matrix3 rot = Matrix3.RotationZ(rotation);
            mat *= rot;
            UCS ucs = new UCS(name);
            ucs.origin = origin;
            ucs.xAxis = new Vector3(mat.M11, mat.M21, mat.M31);
            ucs.yAxis = new Vector3(mat.M12, mat.M22, mat.M32);
            ucs.zAxis = new Vector3(mat.M13, mat.M23, mat.M33);
            return ucs;
        }

        /// <summary>
        /// Gets the user coordinate system rotation matrix.
        /// </summary>
        /// <returns>A Matrix3.</returns>
        public Matrix3 GetTransformation()
        {
            return new Matrix3(this.xAxis.X, this.yAxis.X, this.zAxis.X,
                               this.xAxis.Y, this.yAxis.Y, this.zAxis.Y,
                               this.xAxis.Z, this.yAxis.Z, this.zAxis.Z);
        }

        /// <summary>
        /// Transforms a point between coordinate systems.
        /// </summary>
        /// <param name="point">Point to transform.</param>
        /// <param name="from">Points coordinate system.</param>
        /// <param name="to">Coordinate system of the transformed points.</param>
        /// <returns>Transformed point list.</returns>
        public Vector3 Transform(Vector3 point, CoordinateSystem from, CoordinateSystem to)
        {
            Matrix3 transformation = this.GetTransformation();
            Vector3 translation = this.origin;

            switch (from)
            {
                case CoordinateSystem.World when to == CoordinateSystem.Object:
                {
                    transformation = transformation.Transpose();
                    return transformation * (point - translation);
                }
                case CoordinateSystem.Object when to == CoordinateSystem.World:
                {
                    return transformation * point + translation;
                }
                default:
                    return point;
            }
        }

        /// <summary>
        /// Transforms a point list between coordinate systems.
        /// </summary>
        /// <param name="points">Points to transform.</param>
        /// <param name="from">Points coordinate system.</param>
        /// <param name="to">Coordinate system of the transformed points.</param>
        /// <returns>Transformed point list.</returns>
        public List<Vector3> Transform(IEnumerable<Vector3> points, CoordinateSystem from, CoordinateSystem to)
        {
            if (points == null)
            {
                throw new ArgumentNullException(nameof(points));
            }

            Matrix3 transformation = this.GetTransformation();
            Vector3 translation = this.origin;
            List<Vector3> transPoints;

            switch (from)
            {
                case CoordinateSystem.World when to == CoordinateSystem.Object:
                {
                    transPoints = new List<Vector3>();
                    transformation = transformation.Transpose();
                    foreach (Vector3 p in points)
                    {
                        transPoints.Add(transformation * (p - translation));
                    }

                    return transPoints;
                }
                case CoordinateSystem.Object when to == CoordinateSystem.World:
                {
                    transPoints = new List<Vector3>();
                    foreach (Vector3 p in points)
                    {
                        transPoints.Add(transformation * p + translation);
                    }
                    return transPoints;
                }
                default:
                    return new List<Vector3>(points);
            }
        }

        #endregion

        #region overrides

        /// <summary>
        /// Creates a new UCS that is a copy of the current instance.
        /// </summary>
        /// <param name="newName">UCS name of the copy.</param>
        /// <returns>A new UCS that is a copy of this instance.</returns>
        public override TableObject Clone(string newName)
        {
            UCS copy = new UCS(newName)
            {
                Origin = this.origin,
                xAxis = this.xAxis,
                yAxis = this.yAxis,
                zAxis = this.zAxis,
            };

            foreach (XData data in this.XData.Values)
            {
                copy.XData.Add((XData)data.Clone());
            }

            return copy;
        }

        /// <summary>
        /// Creates a new UCS that is a copy of the current instance.
        /// </summary>
        /// <returns>A new UCS that is a copy of this instance.</returns>
        public override object Clone()
        {
            return this.Clone(this.Name);
        }

        #endregion
    }
}


text:
;; Licensed to the .NET Foundation under one or more agreements.
;; The .NET Foundation licenses this file to you under the MIT license.
;; See the LICENSE file in the project root for more information.

#include "AsmMacros.h"

        TEXTAREA

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; RhpGetThread
;;
;;
;; INPUT: none
;;
;; OUTPUT: x9: Thread pointer
;;
;; MUST PRESERVE ARGUMENT REGISTERS
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    LEAF_ENTRY RhpGetThread
        ;; x9 = GetThread(), TRASHES xip0 (which can be used as an intra-procedure-call scratch register)
        INLINE_GETTHREAD x9, xip0
        ret
    LEAF_END
FASTCALL_ENDFUNC

    INLINE_GETTHREAD_CONSTANT_POOL

    end


text:
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright © 2017 Wayfair. All rights reserved. -->
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@android:color/darker_gray"
    android:padding="@dimen/default_brick_content_padding">

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="60dp"
        tools:ignore="UselessLeaf" />

</RelativeLayout>


text:
package cn.felord.wepay.ali.sdk.api.domain;

import cn.felord.wepay.ali.sdk.api.AlipayObject;
import cn.felord.wepay.ali.sdk.api.internal.mapping.ApiField;

/**
 * 发起退款
 *
 * @author auto create
 * @version $Id: $Id
 */
public class AlipayEcoMycarOrderRefundModel extends AlipayObject {

	private static final long serialVersionUID = 7419725335374111269L;

	/**
	 * 退款交易编号
	 */
	@ApiField("order_no")
	private String orderNo;

	/**
	 * 退款金额(单位:元)
	 */
	@ApiField("refund_fee")
	private String refundFee;

	/**
	 * 退款原因
	 */
	@ApiField("refund_reason")
	private String refundReason;

	/**
	 * 退款请求编号,针对一笔退款需保证唯一
	 */
	@ApiField("req_no")
	private String reqNo;

	/**
	 *
Getter for the field orderNo.

	 *
	 * @return a {@link java.lang.String} object.
	 */
	public String getOrderNo() {
		return this.orderNo;
	}
	/**
	 *
Setter for the field orderNo.

	 *
	 * @param orderNo a {@link java.lang.String} object.
	 */
	public void setOrderNo(String orderNo) {
		this.orderNo = orderNo;
	}

	/**
	 *
Getter for the field refundFee.

	 *
	 * @return a {@link java.lang.String} object.
	 */
	public String getRefundFee() {
		return this.refundFee;
	}
	/**
	 *
Setter for the field refundFee.

	 *
	 * @param refundFee a {@link java.lang.String} object.
	 */
	public void setRefundFee(String refundFee) {
		this.refundFee = refundFee;
	}

	/**
	 *
Getter for the field refundReason.

	 *
	 * @return a {@link java.lang.String} object.
	 */
	public String getRefundReason() {
		return this.refundReason;
	}
	/**
	 *
Setter for the field refundReason.

	 *
	 * @param refundReason a {@link java.lang.String} object.
	 */
	public void setRefundReason(String refundReason) {
		this.refundReason = refundReason;
	}

	/**
	 *
Getter for the field reqNo.

	 *
	 * @return a {@link java.lang.String} object.
	 */
	public String getReqNo() {
		return this.reqNo;
	}
	/**
	 *
Setter for the field reqNo.

	 *
	 * @param reqNo a {@link java.lang.String} object.
	 */
	public void setReqNo(String reqNo) {
		this.reqNo = reqNo;
	}

}


text:
<?php
/**
 * TimeTargetInfo entity for Doctrine ORM
 * @author PiskunovYV
 */
namespace Direct\WrapperBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
/**
 * @ORM\Entity
 * @ORM\Table(name="timetargetinfo")
 */
class TimeTargetInfo {
	/**
	 * @ORM\Id
	 * @ORM\Column(type="integer")
	 * @ORM\GeneratedValue(strategy="AUTO")
	 */
	protected $id;

	/**
	 * @ORM\Column(columnDefinition="ENUM('Yes', 'No')")
	 */
	protected $ShowOnHolidays = 'Yes';

	/**
	 * @ORM\Column(type="integer")
	 */
	protected $HolidayShowFrom;

	/**
	 * @ORM\Column(type="integer")
	 */
	protected $HolidayShowTo;

	/**
	 * @ORM\Column(length=255)
	 */
	protected $TimeZone;

	/**
	 * @ORM\OneToMany(targetEntity="TimeTargetItem", mappedBy="timeTargetInfo")
	 */
	protected $DaysHours;
    /**
     * Constructor
     */
    public function __construct()
    {
        $this->DaysHours = new \Doctrine\Common\Collections\ArrayCollection();
    }

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set ShowOnHolidays
     *
     * @param \varchar $showOnHolidays
     * @return TimeTargetInfo
     */
    public function setShowOnHolidays(\varchar $showOnHolidays)
    {
        $this->ShowOnHolidays = $showOnHolidays;

        return $this;
    }

    /**
     * Get ShowOnHolidays
     *
     * @return \varchar
     */
    public function getShowOnHolidays()
    {
        return $this->ShowOnHolidays;
    }

    /**
     * Set HolidayShowFrom
     *
     * @param integer $holidayShowFrom
     * @return TimeTargetInfo
     */
    public function setHolidayShowFrom($holidayShowFrom)
    {
        $this->HolidayShowFrom = $holidayShowFrom;

        return $this;
    }

    /**
     * Get HolidayShowFrom
     *
     * @return integer
     */
    public function getHolidayShowFrom()
    {
        return $this->HolidayShowFrom;
    }

    /**
     * Set HolidayShowTo
     *
     * @param integer $holidayShowTo
     * @return TimeTargetInfo
     */
    public function setHolidayShowTo($holidayShowTo)
    {
        $this->HolidayShowTo = $holidayShowTo;

        return $this;
    }

    /**
     * Get HolidayShowTo
     *
     * @return integer
     */
    public function getHolidayShowTo()
    {
        return $this->HolidayShowTo;
    }

    /**
     * Set TimeZone
     *
     * @param \varchar $timeZone
     * @return TimeTargetInfo
     */
    public function setTimeZone(\varchar $timeZone)
    {
        $this->TimeZone = $timeZone;

        return $this;
    }

    /**
     * Get TimeZone
     *
     * @return \varchar
     */
    public function getTimeZone()
    {
        return $this->TimeZone;
    }

    /**
     * Add DaysHours
     *
     * @param \Direct\WrapperBundle\Entity\TimeTargetItem $daysHours
     * @return TimeTargetInfo
     */
    public function addDaysHour(\Direct\WrapperBundle\Entity\TimeTargetItem $daysHours)
    {
        $this->DaysHours[] = $daysHours;

        return $this;
    }

    /**
     * Remove DaysHours
     *
     * @param \Direct\WrapperBundle\Entity\TimeTargetItem $daysHours
     */
    public function removeDaysHour(\Direct\WrapperBundle\Entity\TimeTargetItem $daysHours)
    {
        $this->DaysHours->removeElement($daysHours);
    }

    /**
     * Get DaysHours
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getDaysHours()
    {
        return $this->DaysHours;
    }
}


text:
using System.Collections.Generic;

namespace POGOLib.Official.Util.Hash.PokeHash
{
    /// <summary>
    ///     Received data from PokeHash.
    ///     Class provided by https://talk.pogodev.org/d/54-getting-started-with-our-api-hashing-service
    /// </summary>
    internal class PokeHashResponse
    {
        public uint LocationAuthHash { get; set; }

        public uint LocationHash { get; set; }

        // Note: These are actually "unsigned" values. They are sent as signed values simply due to JSON format specifications.
        //       You should re-cast these to unsigned variants (or leave them as-is in their byte form)
        public List<long> RequestHashes { get; set; }
    }
}


text:
//********************************************************************
//*
//* Warning: This file was generated by ecore4CPP Generator
//*
//********************************************************************

#ifndef UML_EXECUTABLENODE_HPP
#define UML_EXECUTABLENODE_HPP

#include <memory>
#include <string>
// forward declarations
template<class T, class ... U> class Subset;

//*********************************
// generated Includes
#include <map> // used for Persistence
#include <vector> // used for Persistence
namespace persistence
{
	namespace interfaces
	{
		class XLoadHandler; // used for Persistence
		class XSaveHandler; // used for Persistence
	}
}

namespace uml
{
	class umlFactory;
}

//Forward Declaration for used types
namespace uml
{
	class Activity;
	class ActivityEdge;
	class ActivityGroup;
	class ActivityPartition;
	class Classifier;
	class Comment;
	class Dependency;
	class ExceptionHandler;
	class InterruptibleActivityRegion;
	class Namespace;
	class StringExpression;
	class StructuredActivityNode;
}

// namespace macro header include
#include "uml/uml.hpp"

// base class includes
#include "uml/ActivityNode.hpp"

// enum includes
#include "uml/VisibilityKind.hpp"

//*********************************
namespace uml
{
	/*!
	An ExecutableNode is an abstract class for ActivityNodes whose execution may be controlled using ControlFlows and to which ExceptionHandlers may be attached.

From package UML::Activities.

	*/

	class UML_API ExecutableNode: virtual public ActivityNode
	{
		public:
 			ExecutableNode(const ExecutableNode &) {}

		protected:
			ExecutableNode(){}

		public:
			virtual std::shared_ptr<ecore::EObject> copy() const = 0;

			//destructor
			virtual ~ExecutableNode() {}

			//*********************************
			// Operations
			//*********************************

			//*********************************
			// Attribute Getters & Setters
			//*********************************

			//*********************************
			// Reference Getters & Setters
			//*********************************
			/*!
			A set of ExceptionHandlers that are examined if an exception propagates out of the ExceptionNode.

From package UML::Activities.

			*/

			virtual std::shared_ptr<Subset<uml::ExceptionHandler, uml::Element>> getHandler() const = 0;

			//*********************************
			// Union Reference Getters
			//*********************************
			/*!
			ActivityGroups containing the ActivityNode.

From package UML::Activities.

			*/

			virtual std::shared_ptr<Union<uml::ActivityGroup>> getInGroup() const = 0;
			/*!
			The Elements owned by this Element.

From package UML::CommonStructure.

			*/

			virtual std::shared_ptr<Union<uml::Element>> getOwnedElement() const = 0;
			/*!
			The Element that owns this Element.

From package UML::CommonStructure.

			*/

			virtual std::weak_ptr<uml::Element> getOwner() const = 0;
			/*!
			The RedefinableElement that is being redefined by this element.

From package UML::Classification.

			*/

			virtual std::shared_ptr<Union<uml::RedefinableElement>> getRedefinedElement() const = 0;

			//*********************************
			// Container Getter
			//*********************************
			virtual std::shared_ptr<ecore::EObject> eContainer() const = 0;

			//*********************************
			// Persistence Functions
			//*********************************
			virtual void load(std::shared_ptr<persistence::interfaces::XLoadHandler> loadHandler) = 0;
			virtual void resolveReferences(const int featureID, std::vector<std::shared_ptr<ecore::EObject> > references) = 0;
			virtual void save(std::shared_ptr<persistence::interfaces::XSaveHandler> saveHandler) const = 0;

		protected:
			//*********************************
			// Attribute Members
			//*********************************

			//*********************************
			// Reference Members
			//*********************************
			/*!
			A set of ExceptionHandlers that are examined if an exception propagates out of the ExceptionNode.

From package UML::Activities.

			*/

			mutable std::shared_ptr<Subset<uml::ExceptionHandler, uml::Element>> m_handler;
	};
}
#endif /* end of include guard: UML_EXECUTABLENODE_HPP */


text:
/* Demo purposes only */
$(".hover").mouseleave(
  function () {
    $(this).removeClass("hover");
  }
);


text:
package org.apache.jena.fuseki.server ;

import java.util.Collection ;
import java.util.HashMap ;
import java.util.Map ;

import org.slf4j.Logger ;
import org.slf4j.LoggerFactory ;

/** A collection of counters */
public class CounterSet {
    private static Logger             log      = LoggerFactory.getLogger(CounterSet.class) ;

    private Map<CounterName, Counter> counters = new HashMap<>() ;

    public CounterSet() {}

    public Collection<CounterName> counters() {
        return counters.keySet() ;
    }

    public void inc(CounterName c) {
        get(c).inc() ;
    }

    public void dec(CounterName c) {
        get(c).dec() ;
    }

    public long value(CounterName c) {
        return get(c).value() ;
    }

    public void add(CounterName counterName) {
        if ( counters.containsKey(counterName) ) {
            log.warn("Duplicate counter in counter set: " + counterName) ;
            return ;
        }
        counters.put(counterName, new Counter()) ;
    }

    public boolean contains(CounterName cn) {
        return counters.containsKey(cn) ;
    }

    public Counter get(CounterName cn) {
        Counter c = counters.get(cn) ;
        if ( c == null )
            log.warn("No counter in counter set: " + cn) ;
        return c ;
    }
}


text:
"""
login and logout w.seu.edu.cn with Python
"""

# !/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib
import httplib
import sys
import time
import getpass

USERNAME = 'your_username'
PASSWORD = 'your_password'
HEADERS = {
    'Content-Type': "application/json; charset=utf-8",
    'dataType': "json",
    'cache': False
}
ADDRESS = "w.seu.edu.cn"
INIT_URL = "/portal/init.php"
LOGIN_URL = "/portal/login.php"
LOGOUT_URL = "/portal/logout.php"

def print_result(content):
    """Print response from server.
    Print Username, IP address, Login Time, Login Location
    """
    try:
        if 'error' in content:
            dresq = eval(content.encode('utf-8'))
            # decode utf-8 character
            print "Error:" + unicode(dresq["error"]).decode('unicode-escape')
        else:
            # fuction eval will convert json to dict
            # need to replace 'null' otherwise eval will return error
            dresq = eval(content.replace('null', "'w.seu.edu.cn'").encode('utf-8'))
            # print username & IP address
            print "Username: " + dresq['login_username']
            print "IP Address: " + dresq['login_ip']
            print "Login Time: " + time.strftime('%H:%M:%S', time.gmtime(dresq['login_time']))
            print "Login Location: " + unicode(dresq['login_location']).decode('unicode-escape')
            print "Expire Time: " + unicode(dresq['login_expire']).decode('unicode-escape') + \
                '(remain ' + unicode(dresq['login_remain']).decode('unicode-escape') + ' days)'
    except:
        print "Print error! Maybe something is wrong in UTF-8 encode and json decode"

def login(username, password):
    """Login fuction based on httplib.
    Check login status, if logined then print status (IP, time, location).
    If not logined, 'POST' your login parameters to server.
    """
    conn = httplib.HTTPSConnection(ADDRESS)
    conn.request("GET", INIT_URL, headers=HEADERS)
    # get response from web server
    content = conn.getresponse().read()
    # make sure if user is login
    if 'notlogin' not in content:
        print "Already login!"
        content = content[3:]
        print_result(content)
        return
    params = {'username': username, 'password': password}
    try:
        conn = httplib.HTTPSConnection(ADDRESS)
        conn.request("POST", LOGIN_URL, urllib.urlencode(params), headers=HEADERS)
        # get response from web server
        content = conn.getresponse().read()
        # remove useless header
        content = content[5:]
        print_result(content)
        conn.close()
    except:
        print "Post error!"

def logout():
    """Logout based on httplib.
    'POST' logout parameters to server.
    """
    try:
        conn = httplib.HTTPSConnection(ADDRESS)
        conn.request("POST", LOGOUT_URL, headers=HEADERS)
        conn.close()
        print "Logout Sucess!!"
    except:
        print "Post error!"

def status():
    """Print login status.
    If logined, print status (IP, time, location).
    If not logined, print 'Not login!'
    """
    try:
        conn = httplib.HTTPSConnection(ADDRESS)
        conn.request("GET", INIT_URL, headers=HEADERS)
        # get response from web server
        content = conn.getresponse().read()
        # make sure if user is login
        if 'notlogin' in content:
            print "Not login!"
            return
        # remove useless header, http header here is different from login.
        content = content[3:]
        print_result(content)
    except:
        print "Get Status error!"

if __name__ == '__main__':
    if len(sys.argv) <= 1:
        print "No param is inputed. Please input params."
        print "Usage python %s [login | logout | status | help]" % sys.argv[0]
    elif sys.argv[1] == 'login':
        try:
            # for command "python seu_weblogin.py login username password"
            INPUT_USERNAME = sys.argv[2]
            INPUT_PASSWORD = sys.argv[3]
        except IndexError:
            # if you didn't want to save username and password in this file
            # you can input username and password by standard input
            INPUT_USERNAME = USERNAME
            INPUT_PASSWORD = PASSWORD
            if 'your' in USERNAME or 'your' in PASSWORD:
                # reqire username and password from std input
                INPUT_USERNAME = raw_input("Username:")
                # don't show my password on screen
                INPUT_PASSWORD = getpass.getpass("Password:")
        login(INPUT_USERNAME, INPUT_PASSWORD)
    elif sys.argv[1] == 'logout':
        logout()
    elif sys.argv[1] == 'status':
        status()
    else:
        print "Input param is not supported!"
        print "Usage python %s [login | logout | status | help]" % sys.argv[0]


text:
<?php //-->

/**
 * Authorize.net - Direct Post Method
 *
 * @package    Eden
 * @category   authorize.net
 * @author     Christian Symon M. Buenavista sbuenavista@openovate.com
 */
class eden_authorizenet_direct extends Eden_Authorizenet_Base
{
    /* Constants
    -------------------------------*/
    const LIVE_URL	= 'https://secure.authorize.net/gateway/transact.dll';
    const TEST_URL	= 'https://test.authorize.net/gateway/transact.dll';

    const AMOUNT		= 'x_amount';
    const SEQUENCE		= 'x_fp_sequence';
    const HASH			= 'x_fp_hash';
    const TIMESTAMP		= 'x_fp_timestamp';
    const RESPONSE		= 'x_relay_response';
    const RELAY_URL		= 'x_relay_url';
    const LOGIN			= 'x_login';

    /* Public Properties
    -------------------------------*/
    /* Protected Properties
    -------------------------------*/
    protected $_amount		= 0;
    protected $_returnUrl	= NULL;
    protected $_postUrl		= self::TEST_URL;

    /* Private Properties
    -------------------------------*/
    /* Magic
    -------------------------------*/
    public static function i()
    {
        return self::_getMultiple(__CLASS__);
    }

    /* Public Methods
    -------------------------------*/
    /**
     * Set transaction amount
     *
     * @param *integer|float Transaction amount
     * @return this
     */
    public function setAmount($amount)
    {
        //Argument 1 must be an integer or float
        Eden_Authorizenet_Error::i()->argument(1, 'int', 'float');

        $this->_amount = $amount;

        return $this;
    }

    /**
     * Demonstrates the Direct Post Method
     *
     * return this
     */
    public function getResponse()
    {
        //if it is in live mode
        if ($this->_isLive) {
            $this->_postUrl = self::LIVE_URL;
        }

        //Call get fingerprint method
        $fingerPrint = 	$this->_getFingerprint($this->_amount);

        //Call block
        return Eden_Authorizenet_Block_Post::i($this->_postUrl, array(
            self::AMOUNT	=> $this->_amount,
            self::SEQUENCE	=> $this->_sequence,
            self::HASH		=> $fingerPrint,
            self::TIMESTAMP	=> $this->_time,
            self::RESPONSE	=> 'FALSE',
            self::RELAY_URL	=> $this->_returnUrl,
            self::LOGIN		=> $this->_apiLogin));
    }

    /**
     * Set return URL
     *
     * @param *string
     * @return this
     */
    public function setReturnUrl($url)
    {
        //Argument 1 must be a string
        Eden_Authorizenet_Error::i()->argument(1, 'string');

        $this->_returnUrl = $url;

        return $this;
    }

    /* Protected Methods
    -------------------------------*/
    /* Private Methods
    -------------------------------*/
}


text:
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeApplications #-}

-- | ISO 9660 / ECMA-119
--
-- File system used on optical disks (CDROM, DVD, BD) and also on some bootable
-- devices (USB sticks, etc.)
module Haskus.Format.FileSystem.ISO9660
   ( StringA (..)
   , StringD (..)
   , BothEndian (..)
   , DateTime (..)
   , Header (..)
   , VolumeDescriptorType (..)
   , BootRecord (..)
   , PrimaryVolume (..)
   , SupplementaryVolume (..)
   , Partition (..)
   , PathTableEntry (..)
   )
where

-- TODO
-- - ISO9660
-- - RockRidge
-- - Joliet
-- - El-Torito
-- - Boot Information Table (not standardized)
--

import Haskus.Format.Binary.Vector
import Haskus.Format.Binary.Enum
import Haskus.Format.Binary.Endianness
import Haskus.Format.Binary.Word
import Haskus.Format.Binary.Ptr
import Haskus.Format.Binary.Storable
import Haskus.Format.String
import Haskus.Utils.Types
import Haskus.Utils.Types.Generics (Generic)

-- | String with characters: A-Z 0-9 _ * " % & ' ( ) * + , - . / : ; < = > ?
newtype StringA (n :: Nat) = StringA (CStringBuffer n) deriving (Show,Generic,Storable)

-- | String with characters: A-Z 0-9 _
newtype StringD (n :: Nat) = StringD (CStringBuffer n) deriving (Show,Generic,Storable)

-- | Store the number in both endiannesses: Little-Endian then Big-Endian
newtype BothEndian w = BothEndian w

-- | Date-time mostly in text format
data DateTime = DateTime
   { dateYear                    :: StringD 4 -- ^ Year from 1 to 9999
   , dateMonth                   :: StringD 2 -- ^ Month from 1 to 12
   , dateDay                     :: StringD 2 -- ^ Day from 1 to 31
   , dateHour                    :: StringD 2 -- ^ Hour from 0 to 23
   , dateMinute                  :: StringD 2 -- ^ Minute from 0 to 59
   , dateSecond                  :: StringD 2 -- ^ Second from 0 to 59
   , dateCentiSeconds            :: StringD 2 -- ^ Hundredths of a second from 0 to 99
   , dateTimeZone                :: Word8     -- ^ Time zone offset from GMT in 15 minute intervals, starting at interval -48 (west) and running up to interval 52 (east). So value 0 indicates interval -48 which equals GMT-12 hours, and value 100 indicates interval 52 which equals GMT+13 hours.
   } deriving (Show,Generic,Storable)

instance (ByteReversable w, Storable w) => Storable (BothEndian w) where
   sizeOf _                = 2 * sizeOfT @w
   alignment _             = alignmentT @w
   peekIO p                = (BothEndian . littleEndianToHost) <$> peek (castPtr p)
   pokeIO p (BothEndian v) = do
      let s = sizeOfT' @w
      pokeByteOff (castPtr p) 0 (hostToLittleEndian v)
      pokeByteOff (castPtr p) s (hostToBigEndian v)

-- | Volume Descriptor header
data Header = Header
   { headerType       :: EnumField Word8 VolumeDescriptorType -- ^ Volume descriptor type
   , headerIdentifier :: StringA 5                            -- ^ Always "CD001"
   , headerVersion    :: Word8                                -- ^ Volume descriptor version (always 0x01)
   }

-- | Volume descriptor type
data VolumeDescriptorType
   = BootRecordType
   | PrimaryVolumeDescriptorType
   | SupplementaryVolumeDescriptorType
   | VolumePartitionDescriptorType
   | CustomVolumeType Word8
   | VolumeDescSetTerminator
   deriving (Show,Eq)

instance CEnum VolumeDescriptorType where
   fromCEnum = \case
      BootRecordType                       -> 0
      PrimaryVolumeDescriptorType          -> 1
      SupplementaryVolumeDescriptorType    -> 2
      VolumePartitionDescriptorType        -> 3
      CustomVolumeType w                   -> fromIntegral w
      VolumeDescSetTerminator              -> 255
   toCEnum = \case
      0   ->  BootRecordType
      1   ->  PrimaryVolumeDescriptorType
      2   ->  SupplementaryVolumeDescriptorType
      3   ->  VolumePartitionDescriptorType
      255 ->  VolumeDescSetTerminator
      w   ->  CustomVolumeType (fromIntegral w)

-- | Boot Record descriptor
data BootRecord = BootRecord
   { bootSystemIdentifier :: StringA 32        -- ^ ID of the system which can act on and boot the system from the boot record
   , bootIdentifier       :: StringA 32        -- ^ identification of the boot system defined in the rest of this descriptor
   , bootCustomData       :: Vector 1977 Word8 -- ^ Custom - used by the boot system (e.g., El Torito)
   } deriving (Show)

data PrimaryVolume = PrimaryVolume
   { primaryVolumeUnused1                     :: Word8                 -- ^ Always 0x00
   , primaryVolumeSystemIdentifier            :: StringA 32            -- ^ Name of the system that can act upon sectors 0x000-0x0F for the volume
   , primaryVolumeIdentifier                  :: StringD 32            -- ^ Identification of this volume
   , primaryVolumeUnused2                     :: Word64                -- ^ Always 0x00
   , primaryVolumeSpaceSize                   :: BothEndian Word32     -- ^ Number of logicel blocks in which the volume is recorded
   , primaryVolumeUnused3                     :: Vector 32 Word8       -- ^ All zeroes
   , primaryVolumeSetSize                     :: BothEndian Word16     -- ^ The size of the set in this logical volume (number of disks)
   , primaryVolumeSequenceNumber              :: BothEndian Word16     -- ^ The number of this disk in the Volume Set
   , primaryVolumeLogicalBlockSize            :: BothEndian Word16     -- ^ The size in bytes of a logical block
   , primaryVolumePathTableSize               :: BothEndian Word32     -- ^ The size in bytes of the path table
   , primaryVolumePathTableLocationLE         :: AsLittleEndian Word32 -- ^ LBA location of the path table containing only little-endian values
   , primaryVolumeOptPathTableLocationLE      :: AsLittleEndian Word32 -- ^ LBA location of the optional path table containing only little-endian values (0 if none)
   , primaryVolumePathTableLocationBE         :: AsBigEndian Word32    -- ^ LBA location of the path table containing only big-endian values
   , primaryVolumeOptPathTableLocationBE      :: AsBigEndian Word32    -- ^ LBA location of the optional path table containing only big-endian values (0 if none)
   , primaryVolumeRootDirectoryEntry          :: Vector 34 Word8       -- ^ actual Directory Record, which contains a single byte Directory Identifier (0x00)
   , primaryVolumeSetIdentifier               :: StringD 128           -- ^ Identifier of the volume set which this volume is a member
   , primaryVolumePublisherIdentifier         :: StringA 128           -- ^ The volume publisher. For extended publisher information, the first byte should be 0x5F, followed by the filename of a file in the root directory. If not specified, all bytes should be 0x20. The volume publisher. For extended publisher information, the first byte should be 0x5F, followed by the filename of a file in the root directory. If not specified, all bytes should be 0x20.
   , primaryVolumeDataPreparerIdentifier      :: StringA 128           -- ^ The identifier of the person(s) who prepared the data for this volume. For extended preparation information, the first byte should be 0x5F, followed by the filename of a file in the root directory. If not specified, all bytes should be 0x20.
   , primaryVolumeApplicationIdentifier       :: StringA 128           -- ^ Identifies how the data are recorded on this volume. For extended information, the first byte should be 0x5F, followed by the filename of a file in the root directory. If not specified, all bytes should be 0x20.
   , primaryVolumeCopyrightFileIdentifier     :: StringD 38            -- ^ Filename of a file in the root directory that contains copyright information for this volume set. If not specified, all bytes should be 0x20. Filename of a file in the root directory that contains copyright information for this volume set. If not specified, all bytes should be 0x20.
   , primaryVolumeAbstractFileIdentifier      :: StringD 36            -- ^ Filename of a file in the root directory that contains abstract information for this volume set. If not specified, all bytes should be 0x20.
   , primaryVolumeBibliographicFileIdentifier :: StringD 37            -- ^ Filename of a file in the root directory that contains bibliographic information for this volume set. If not specified, all bytes should be 0x20.
   , primaryVolumeCreationDate                :: DateTime              -- ^ the date and time of when the volume was created
   , primaryVolumeModificationDate            :: DateTime              -- ^ the date and time of when the volume was modified
   , primaryVolumeExpirationDate              :: DateTime              -- ^ The date and time after which this volume is considered to be obsolete. If not specified, then the volume is never considered to be obsolete
   , primaryVolumeEffectiveDate               :: DateTime              -- ^ The date and time after which the volume may be used. If not specified, the volume may be used immediately.
   , primaryVolumeFileStructureVersion        :: Word8                 -- ^ The directory records and path table version (always 0x01).
   , primaryVolumeUnused4                     :: Word8                 -- ^ Always 0x00
   , primaryVolumeCustomData                  :: Vector 512 Word8      -- ^ Contents not defined by ISO 9660
   , primaryVolumeReserved                    :: Vector 653 Word8      -- ^ Reserved by ISO
   }

data SupplementaryVolume = SupplementaryVolume
   { suppVolumeFlags                       :: Word8                 -- ^ Volume flags
   , suppVolumeSystemIdentifier            :: StringA 32            -- ^ Name of the system that can act upon sectors 0x000-0x0F for the volume
   , suppVolumeIdentifier                  :: StringD 32            -- ^ Identification of this volume
   , suppVolumeUnused1                     :: Vector 8 Word8        -- ^ Always 0x00
   , suppVolumeSpaceSize                   :: BothEndian Word32     -- ^ Number of logicel blocks in which the volume is recorded
   , suppVolumeEscapeSequences             :: Vector 32 Word8       -- ^ All zeroes
   , suppVolumeSetSize                     :: BothEndian Word16     -- ^ The size of the set in this logical volume (number of disks)
   , suppVolumeSequenceNumber              :: BothEndian Word16     -- ^ The number of this disk in the Volume Set
   , suppVolumeLogicalBlockSize            :: BothEndian Word16     -- ^ The size in bytes of a logical block
   , suppVolumePathTableSize               :: BothEndian Word32     -- ^ The size in bytes of the path table
   , suppVolumePathTableLocationLE         :: AsLittleEndian Word32 -- ^ LBA location of the path table containing only little-endian values
   , suppVolumeOptPathTableLocationLE      :: AsLittleEndian Word32 -- ^ LBA location of the optional path table containing only little-endian values (0 if none)
   , suppVolumePathTableLocationBE         :: AsBigEndian Word32    -- ^ LBA location of the path table containing only big-endian values
   , suppVolumeOptPathTableLocationBE      :: AsBigEndian Word32    -- ^ LBA location of the optional path table containing only big-endian values (0 if none)
   , suppVolumeRootDirectoryEntry          :: Vector 34 Word8       -- ^ actual Directory Record, which contains a single byte Directory Identifier (0x00)
   , suppVolumeSetIdentifier               :: StringD 128           -- ^ Identifier of the volume set which this volume is a member
   , suppVolumePublisherIdentifier         :: StringA 128           -- ^ The volume publisher. For extended publisher information, the first byte should be 0x5F, followed by the filename of a file in the root directory. If not specified, all bytes should be 0x20. The volume publisher. For extended publisher information, the first byte should be 0x5F, followed by the filename of a file in the root directory. If not specified, all bytes should be 0x20.
   , suppVolumeDataPreparerIdentifier      :: StringA 128           -- ^ The identifier of the person(s) who prepared the data for this volume. For extended preparation information, the first byte should be 0x5F, followed by the filename of a file in the root directory. If not specified, all bytes should be 0x20.
   , suppVolumeApplicationIdentifier       :: StringA 128           -- ^ Identifies how the data are recorded on this volume. For extended information, the first byte should be 0x5F, followed by the filename of a file in the root directory. If not specified, all bytes should be 0x20.
   , suppVolumeCopyrightFileIdentifier     :: StringD 38            -- ^ Filename of a file in the root directory that contains copyright information for this volume set. If not specified, all bytes should be 0x20. Filename of a file in the root directory that contains copyright information for this volume set. If not specified, all bytes should be 0x20.
   , suppVolumeAbstractFileIdentifier      :: StringD 36            -- ^ Filename of a file in the root directory that contains abstract information for this volume set. If not specified, all bytes should be 0x20.
   , suppVolumeBibliographicFileIdentifier :: StringD 37            -- ^ Filename of a file in the root directory that contains bibliographic information for this volume set. If not specified, all bytes should be 0x20.
   , suppVolumeCreationDate                :: DateTime              -- ^ the date and time of when the volume was created
   , suppVolumeModificationDate            :: DateTime              -- ^ the date and time of when the volume was modified
   , suppVolumeExpirationDate              :: DateTime              -- ^ The date and time after which this volume is considered to be obsolete. If not specified, then the volume is never considered to be obsolete
   , suppVolumeEffectiveDate               :: DateTime              -- ^ The date and time after which the volume may be used. If not specified, the volume may be used immediately.
   , suppVolumeFileStructureVersion        :: Word8                 -- ^ The directory records and path table version (always 0x01).
   , suppVolumeUnused4                     :: Word8                 -- ^ Always 0x00
   , suppVolumeCustomData                  :: Vector 512 Word8      -- ^ Contents not defined by ISO 9660
   , suppVolumeReserved                    :: Vector 653 Word8      -- ^ Reserved
   }

data Partition = Partition
   { partitionUnused1          :: Word8             -- ^ Always 0x00
   , partitionSystemIdentifier :: StringA 32        -- ^ Identifier for the system that can act on the partition
   , partitionIdentifier       :: StringD 32        -- ^ Partition identifier
   , partitionLocation         :: BothEndian Word32 -- ^ Number of the first logical block allocated to the partition
   , partitionSize             :: BothEndian Word32 -- ^ Number of logical blocks
   , partitionReserved         :: Vector 1960 Word8 -- ^ Reserved
   }

type family PTEndian e x where
   PTEndian 'LittleEndian x = AsLittleEndian x
   PTEndian 'BigEndian x    = AsBigEndian x

data PathTableEntry e = PathTableEntry
   { pteIdentifierLength              :: Word8
   , pteExtendedAttributeRecordLength :: Word8
   , ptrExtentLocation                :: PTEndian e Word16
   , ptrParentDirectory               :: Word16
--   , ptrIdentifier                  :: StringG pteIdentifierLength
--   , ptrPadding                     :: Word8 -- ^ 0x00 if pteIdentifierLength is odd, not present otherwise
   }


text:
"""
The MIT License (MIT)

Copyright (c) 2015-2019 Rapptz

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
"""

from . import utils
from .mixins import Hashable

class Object(Hashable):
    """Represents a generic Discord object.

    The purpose of this class is to allow you to create 'miniature'
    versions of data classes if you want to pass in just an ID. Most functions
    that take in a specific data class with an ID can also take in this class
    as a substitute instead. Note that even though this is the case, not all
    objects (if any) actually inherit from this class.

    There are also some cases where some websocket events are received
    in :issue:`strange order <21>` and when such events happened you would
    receive this class rather than the actual data class. These cases are
    extremely rare.

    .. container:: operations

        .. describe:: x == y

            Checks if two objects are equal.

        .. describe:: x != y

            Checks if two objects are not equal.

        .. describe:: hash(x)

            Returns the object's hash.

    Attributes
    -----------
    id: :class:`str`
        The ID of the object.
    """

    def __init__(self, id):
        self.id = id

    @property
    def created_at(self):
        """Returns the snowflake's creation time in UTC."""
        return utils.snowflake_time(self.id)


text:
Scalr.regPage('Scalr.ui.admin.users.create', function (loadParams, moduleParams) {
	var form = Ext.create('Ext.form.Panel', {
		bodyCls: 'x-panel-body-frame',
		width: 700,
		title: (moduleParams['user']) ? 'Account » Users » Edit' : 'Account » Users » Create',
		fieldDefaults: {
			anchor: '100%'
		},

		items: [{
			xtype: 'fieldset',
			title: 'General information',
			items: [{
				xtype: 'textfield',
				name: 'email',
				fieldLabel: 'Email',
				allowBlank: false
			}, {
				xtype: 'textfield',
				name: 'password',
				inputType: 'password',
				fieldLabel: 'Password',
				value: moduleParams['user'] ? '******': '',
				allowBlank: false
			}, {
				xtype: 'radiogroup',
				fieldLabel: 'Status',
				allowBlank: false,
				columns: 7,
				items: [{
					name: 'status',
					inputValue: 'Active',
					boxLabel: 'Active',
					checked: true
				}, {
					name: 'status',
					inputValue: 'Inactive',
					boxLabel: 'Inactive'
				}]
			}, {
				xtype: 'textfield',
				name: 'fullname',
				fieldLabel: 'Full name'
			}, {
				xtype: 'textarea',
				name: 'comments',
				fieldLabel: 'Comments',
				grow: true,
				growMax: 400
			}, {
				xtype: 'hidden',
				name: 'id'
			}]
		}],
		dockedItems: [{
			xtype: 'container',
			dock: 'bottom',
			cls: 'x-docked-bottom-frame',
			layout: {
				type: 'hbox',
				pack: 'center'
			},
			items: [{
				xtype: 'button',
				text: moduleParams['user'] ? 'Save' : 'Create',
				handler: function () {
					if (form.getForm().isValid())
						Scalr.Request({
							processBox: {
								type: 'save'
							},
							url: '/admin/users/xSave',
							form: form.getForm(),
							success: function () {
								Scalr.event.fireEvent('close');
							}
						});
				}
			}, {
				xtype: 'button',
				margin: '0 0 0 5',
				text: 'Cancel',
				handler: function() {
					Scalr.event.fireEvent('close');
				}
			}]
		}]
	});

	if (moduleParams['user'])
		form.getForm().setValues(moduleParams['user']);

	return form;
});


text:
module Renalware
  #
  # Renders flash messages either as toasts with stimulus (the app default) or as inline html
  # e.g. on login page
  #
  class FlashMessagesComponent < ApplicationComponent
    rattr_initialize [:flash_messages, toast: true]
    STYLES = { notice: "success", error: "alert", warning: "warning" }.freeze
    alias :toast? :toast

    def render?
      flash_messages&.any?
    end

    def css_class_for_flash(flash_key)
      case flash_key.to_sym
      when :error
        "bg-red-50 text-red-700 shadow-lg"
      else
        "bg-blue-50 text-blue-700 shadow-lg"
      end
    end

    def flash_style(name)
      STYLES[name.to_sym]
    end
  end
end


text:
<?php
ini_set('display_errors', 1);
require_once('TwitterAPIExchange.php');

/** Set access tokens here - see: https://dev.twitter.com/apps/ **/
$settings = array(
    'oauth_access_token' => "",
    'oauth_access_token_secret' => "",
    'consumer_key' => "",
    'consumer_secret' => ""
);

/** URL for REST request, see: https://dev.twitter.com/docs/api/1.1/ **/
$url = 'https://api.twitter.com/1.1/blocks/create.json';
$requestMethod = 'POST';

/** POST fields required by the URL above. See relevant docs as above **/
$postfields = array(
    'screen_name' => 'usernameToBlock',
    'skip_status' => '1'
);

/** Perform a POST request and echo the response **/
$twitter = new TwitterAPIExchange($settings);
echo $twitter->buildOauth($url, $requestMethod)
             ->setPostfields($postfields)
             ->performRequest();

/** Perform a GET request and echo the response **/
/** Note: Set the GET field BEFORE calling buildOauth(); **/
$url = 'https://api.twitter.com/1.1/followers/ids.json';
$getfield = '?screen_name=J7mbo';
$requestMethod = 'GET';
$twitter = new TwitterAPIExchange($settings);
echo $twitter->setGetfield($getfield)
             ->buildOauth($url, $requestMethod)
             ->performRequest();


text:
#ifndef __NMR_UNITTEST_UTILITIES
#define __NMR_UNITTEST_UTILITIES

#include "lib3mf_implicit.hpp"
#include "gtest/gtest.h"
#include <fstream>

#ifdef LTESTFILESPATH
const std::string sTestFilesPath = TESTFILESPATH;
#else
const std::string sTestFilesPath = "TestFiles";
#endif

#ifdef LOUTFILESPATH
const std::string sOutFilesPath = OUTFILESPATH;
#else
const std::string sOutFilesPath = "..\TestOutput";
#endif

inline bool CreateDir(std::string sPath) {
	return (system((std::string("mkdir \"") + sPath + "\"").c_str()) != -1);
}

#define ASSERT_SPECIFIC_THROW(statement, type) {\
try {\
  statement;\
  ASSERT_FALSE(true);\
}\
catch (const type &) {\
  ASSERT_TRUE(true);\
}\
}

class Lib3MFTest : public ::testing::Test {
	public:
	static void SetUpTestCase() {
		wrapper = Lib3MF::CWrapper::loadLibrary();
		#ifdef CREATEJOURNAL
		wrapper->SetJournal("journal.txt");
		#endif
	}
	static Lib3MF::PWrapper wrapper;
};

inline std::vector<Lib3MF_uint8> ReadFileIntoBuffer(std::string sFileName)
{
	// Read the file fully into a memory buffer
	std::ifstream file(sFileName, std::ios::binary | std::ios::ate);
	std::streamsize size = file.tellg();
	file.seekg(0, std::ios::beg);
	// Memory buffer
	std::vector<Lib3MF_uint8> buffer(static_cast<size_t>(size));
	file.read((char*)buffer.data(), size);
	return buffer;
}

inline void WriteBufferToFile(std::vector<Lib3MF_uint8> const & buffer, std::string sFileName)
{
	std::ofstream file(sFileName, std::ios::binary);
	for (Lib3MF_uint8 cByte: buffer) {
		file.put(cByte);
	}
	file.close();
}

inline sLib3MFTransform getIdentityTransform()
{
	sLib3MFTransform t;
	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 3; j++)
			t.m_Fields[i][j] = 0 + 1.0f * (i==j);
	}
	return t;
}

inline void CompareColors(Lib3MF::sColor c1, Lib3MF::sColor c2)
{
	EXPECT_EQ(c1.m_Alpha, c2.m_Alpha);
	EXPECT_EQ(c1.m_Red, c2.m_Red);
	EXPECT_EQ(c1.m_Green, c2.m_Green);
	EXPECT_EQ(c1.m_Blue, c2.m_Blue);
}

template<typename T>
struct PositionedVector
{
	std::vector<T> vec;
	Lib3MF_uint64 pos;
	PositionedVector() { pos = 0; };

	static void writeCallback(Lib3MF_uint64 nByteData, Lib3MF_uint64 nNumBytes, Lib3MF_pvoid pUserData) {
		PositionedVector<T>* buffer = reinterpret_cast<PositionedVector<T>*> ((void*)(pUserData));
		T* pData = (T*)(nByteData);
		for (int i = 0; i < nNumBytes; i++) {
			if (buffer->pos == buffer->vec.size()) {
				buffer->vec.push_back(*pData);
			}
			else  if (buffer->pos < buffer->vec.size()) {
				buffer->vec[(size_t)buffer->pos] = *pData;
			}
			else {
				ASSERT_TRUE(false);
			}
			buffer->pos++;
			pData++;
		}
	};

	static void readCallback(Lib3MF_uint64 nByteData, Lib3MF_uint64 nNumBytes, Lib3MF_pvoid pUserData) {
		PositionedVector<T>* buffer = reinterpret_cast<PositionedVector<T>*> ((void*)(pUserData));
		T* pData = (T*)(nByteData);
		for (int i = 0; i < nNumBytes; i++) {
			if (buffer->pos < buffer->vec.size()) {
				*pData = buffer->vec[(size_t)buffer->pos];
			}
			else {
				ASSERT_TRUE(false);
			}
			buffer->pos++;
			pData++;
		}
	};

	static void seekCallback(Lib3MF_uint64 nPosition, Lib3MF_pvoid pUserData) {
		PositionedVector<T>* buffer = reinterpret_cast<PositionedVector<T>*> ((void*)(pUserData));
		buffer->pos = nPosition;
	};

};

inline sLib3MFPosition fnCreateVertex(float x, float y, float z)
{
	sLib3MFPosition result;
	result.m_Coordinates[0] = x;
	result.m_Coordinates[1] = y;
	result.m_Coordinates[2] = z;
	return result;
}

inline sLib3MFTriangle fnCreateTriangle(int v0, int v1, int v2)
{
	sLib3MFTriangle result;
	result.m_Indices[0] = v0;
	result.m_Indices[1] = v1;
	result.m_Indices[2] = v2;
	return result;
}

void fnCreateBox(std::vector<sLib3MFPosition> &vctVertices, std::vector<sLib3MFTriangle> &vctTriangles);

inline void CheckReaderWarnings(Lib3MF::PReader reader, Lib3MF_uint32 nWarnings)
{
	EXPECT_EQ(reader->GetWarningCount(), nWarnings);
	for (Lib3MF_uint32 iWarning = 0; iWarning < reader->GetWarningCount(); iWarning++)
	{
		Lib3MF_uint32 nErrorCode;
		std::string sWarning = reader->GetWarning(iWarning, nErrorCode);
		EXPECT_TRUE(true) << iWarning << ": " << nErrorCode << ", " << sWarning;
	}
}

#endif //__NMR_UNITTEST_UTILITIES