text:
package org.openkilda.wfm.topology.switchmanager.service.impl;

import org.openkilda.messaging.command.switches.SwitchValidateRequest;
import org.openkilda.messaging.error.ErrorMessage;
import org.openkilda.messaging.info.meter.SwitchMeterEntries;
import org.openkilda.messaging.info.rule.SwitchExpectedDefaultFlowEntries;
import org.openkilda.messaging.info.rule.SwitchExpectedDefaultMeterEntries;
import org.openkilda.messaging.info.rule.SwitchFlowEntries;
import org.openkilda.messaging.info.rule.SwitchGroupEntries;
import org.openkilda.persistence.PersistenceManager;
import org.openkilda.persistence.repositories.RepositoryFactory;
import org.openkilda.wfm.share.utils.FsmExecutor;
import org.openkilda.wfm.topology.switchmanager.error.OperationTimeoutException;
import org.openkilda.wfm.topology.switchmanager.error.SpeakerFailureException;
import org.openkilda.wfm.topology.switchmanager.fsm.SwitchValidateFsm;
import org.openkilda.wfm.topology.switchmanager.fsm.SwitchValidateFsm.SwitchValidateContext;
import org.openkilda.wfm.topology.switchmanager.fsm.SwitchValidateFsm.SwitchValidateEvent;
import org.openkilda.wfm.topology.switchmanager.fsm.SwitchValidateFsm.SwitchValidateState;
import org.openkilda.wfm.topology.switchmanager.service.SwitchManagerCarrier;
import org.openkilda.wfm.topology.switchmanager.service.SwitchValidateService;
import org.openkilda.wfm.topology.switchmanager.service.ValidationService;

import lombok.extern.slf4j.Slf4j;
import org.squirrelframework.foundation.fsm.StateMachineBuilder;

import java.util.HashMap;
import java.util.Map;
import java.util.Optional;

@Slf4j
public class SwitchValidateServiceImpl implements SwitchValidateService {

    private final Map<String, SwitchValidateFsm> fsms = new HashMap<>();

    private final ValidationService validationService;
    private final SwitchManagerCarrier carrier;
    private final StateMachineBuilder<
            SwitchValidateFsm, SwitchValidateState, SwitchValidateEvent, SwitchValidateContext> builder;
    private final FsmExecutor<
            SwitchValidateFsm, SwitchValidateState, SwitchValidateEvent, SwitchValidateContext> fsmExecutor;

    private final RepositoryFactory repositoryFactory;

    public SwitchValidateServiceImpl(
            SwitchManagerCarrier carrier, PersistenceManager persistenceManager, ValidationService validationService) {
        this.carrier = carrier;
        this.builder = SwitchValidateFsm.builder();
        this.fsmExecutor = new FsmExecutor<>(SwitchValidateEvent.NEXT);
        this.validationService = validationService;
        this.repositoryFactory = persistenceManager.getRepositoryFactory();
    }

    @Override
    public void handleSwitchValidateRequest(String key, SwitchValidateRequest request) {
        SwitchValidateFsm fsm =
                builder.newStateMachine(
                        SwitchValidateState.START, carrier, key, request, validationService,
                        repositoryFactory);
        fsms.put(key, fsm);

        fsm.start();
        handle(fsm, SwitchValidateEvent.NEXT, SwitchValidateContext.builder().build());
    }

    @Override
    public void handleFlowEntriesResponse(String key, SwitchFlowEntries data) {
        handle(key, SwitchValidateEvent.RULES_RECEIVED,
                SwitchValidateContext.builder().flowEntries(data.getFlowEntries()).build());
    }

    @Override
    public void handleGroupEntriesResponse(String key, SwitchGroupEntries data) {
        handle(key, SwitchValidateEvent.GROUPS_RECEIVED,
                SwitchValidateContext.builder().groupEntries(data.getGroupEntries()).build());
    }

    @Override
    public void handleExpectedDefaultFlowEntriesResponse(String key, SwitchExpectedDefaultFlowEntries data) {
        handle(key, SwitchValidateEvent.EXPECTED_DEFAULT_RULES_RECEIVED,
                SwitchValidateContext.builder().flowEntries(data.getFlowEntries()).build());
    }

    @Override
    public void handleExpectedDefaultMeterEntriesResponse(String key, SwitchExpectedDefaultMeterEntries data) {
        handle(key, SwitchValidateEvent.EXPECTED_DEFAULT_METERS_RECEIVED,
                SwitchValidateContext.builder().meterEntries(data.getMeterEntries()).build());
    }

    @Override
    public void handleMeterEntriesResponse(String key, SwitchMeterEntries data) {
        handle(key, SwitchValidateEvent.METERS_RECEIVED,
                SwitchValidateContext.builder().meterEntries(data.getMeterEntries()).build());
    }

    @Override
    public void handleMetersUnsupportedResponse(String key) {
        handle(key, SwitchValidateEvent.METERS_UNSUPPORTED, SwitchValidateContext.builder().build());
    }

    @Override
    public void handleTaskError(String key, ErrorMessage message) {
        SwitchValidateContext context = SwitchValidateContext.builder()
                .error(new SpeakerFailureException(message.getData()))
                .build();
        handle(key, SwitchValidateEvent.ERROR, context);
    }

    @Override
    public void handleTaskTimeout(String key) {
        Optional<SwitchValidateFsm> potential = lookupFsm(key);
        if (potential.isPresent()) {
            SwitchValidateFsm fsm = potential.get();
            OperationTimeoutException error = new OperationTimeoutException(fsm.getSwitchId());
            handle(fsm, SwitchValidateEvent.ERROR, SwitchValidateContext.builder().error(error).build());
        }
    }

    private void handle(String key, SwitchValidateEvent event, SwitchValidateContext context) {
        Optional<SwitchValidateFsm> fsm = lookupFsm(key);
        if (! fsm.isPresent()) {
            log.warn("Switch validate FSM with key {} not found", key);
            return;
        }
        handle(fsm.get(), event, context);
    }

    private void handle(SwitchValidateFsm fsm, SwitchValidateEvent event, SwitchValidateContext context) {
        fsmExecutor.fire(fsm, event, context);
        removeIfCompleted(fsm);
    }

    private Optional<SwitchValidateFsm> lookupFsm(String key) {
        return Optional.ofNullable(fsms.get(key));
    }

    void removeIfCompleted(SwitchValidateFsm fsm) {
        if (fsm.isTerminated()) {
            log.info("Switch {} validation FSM have reached termination state (key={})",
                    fsm.getSwitchId(), fsm.getKey());
            fsms.remove(fsm.getKey());
        }
    }
}


text:
<?php

// phpinfo();
// return;

// comment out the following two lines when deployed to production
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');

require(__DIR__ . '/../vendor/autoload.php');
require(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php');

$config = require(__DIR__ . '/../config/web.php');

$app = new yii\web\Application($config);
$app->run();

redpajama_set_name: RedPajamaGithub


text:
$(function () {
    setTimeout(function () {
        $('span.cke_button_icon').removeAttr('style');
        $('span.cke_button_icon').css('overflow', 'hidden');
        $('span.cke_button_icon.cke_button__bold_icon').addClass('hc_button__bold_icon');
        $('span.cke_button_icon.cke_button__cut_icon').addClass('hc_button__cut_icon');
        $('span.cke_button_icon.cke_button__copy_icon').addClass('hc_button__copy_icon');
        $('span.cke_button_icon.cke_button__paste_icon').addClass('hc_button__paste_icon');
        $('span.cke_button_icon.cke_button__pastetext_icon').addClass('hc_button__pastetext_icon');
        $('span.cke_button_icon.cke_button__pastefromword_icon').addClass('hc_button__pastefromword_icon');
        $('span.cke_button_icon.cke_button__undo_icon').addClass('hc_button__undo_icon');
        $('span.cke_button_icon.cke_button__redo_icon').addClass('hc_button__redo_icon');
        $('span.cke_button_icon.cke_button__link_icon').addClass('hc_button__link_icon');
        $('span.cke_button_icon.cke_button__unlink_icon').addClass('hc_button__unlink_icon');
        $('span.cke_button_icon.cke_button__image_icon').addClass('hc_button__image_icon');
        $('span.cke_button_icon.cke_button__table_icon').addClass('hc_button__table_icon');
        $('span.cke_button_icon.cke_button__horizontalrule_icon').addClass('hc_button__horizontalrule_icon');
        $('span.cke_button_icon.cke_button__specialchar_icon').addClass('hc_button__specialchar_icon');
        $('span.cke_button_icon.cke_button__maximize_icon').addClass('hc_button__maximize_icon');
        $('span.cke_button_icon.cke_button__source_icon').addClass('hc_button__source_icon');
        $('span.cke_button_icon.cke_button__removeformat_icon').addClass('hc_button__removeformat_icon')
        $('span.cke_button_icon.cke_button__strike_icon').addClass('hc_button__strike_icon');
        $('span.cke_button_icon.cke_button__italic_icon').addClass('hc_button__italic_icon');
        $('span.cke_button_icon.cke_button__numberedlist_icon').addClass('hc_button__numberedlist_icon');
        $('span.cke_button_icon.cke_button__blockquote_icon').addClass('hc_button__blockquote_icon');
        $('span.cke_button_icon.cke_button__indent_icon').addClass('hc_button__indent_icon');
        $('span.cke_button_icon.cke_button__outdent_icon').addClass('hc_button__outdent_icon');
        $('span.cke_button_icon.cke_button__bulletedlist_icon').addClass('hc_button__bulletedlist_icon');
    }, 2000);

});


text:
package com.jamierf.rcdroid.input.api;

import com.google.common.base.Objects;

public class BatteryStatus {

    private final boolean charging;
    private final float voltage;
    private final float temperature;
    private final float level;

    public BatteryStatus(boolean charging, float voltage, float temperature, float level) {
        this.charging = charging;
        this.voltage = voltage;
        this.temperature = temperature;
        this.level = level;
    }

    public boolean isCharging() {
        return charging;
    }

    public float getVoltage() {
        return voltage;
    }

    public float getTemperature() {
        return temperature;
    }

    public float getLevel() {
        return level;
    }

    @Override
    public String toString() {
        return Objects.toStringHelper(this)
                .add("charging", charging)
                .add("voltage", voltage)
                .add("temperature", temperature)
                .add("level", level)
                .toString();
    }
}


text:
package com.acg12.widget;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Rect;
import android.graphics.Typeface;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.View;

import com.acg12.R;

/**
 * A tool class that adds a label to the various Views.
 */
public final class LabelViewHelper {
    private static final int ROTATE_LEFT = -45;
    private static final int ROTATE_RIGHT = 45;

    private static final int STYLE_NORMAL = 0;
    private static final int STYLE_ITALIC = 1;
    private static final int STYLE_BOLD = 2;

    private Paint mTextTitlePaint;
    private int mTextTitleColor;
    private float mTextTitleSize;
    private Rect mTextTitleRect;
    private int mTextTitleStyle;

    private Paint mTextContentPaint;
    private int mTextContentColor;
    private float mTextContentSize;
    private Rect mTextContentRect;
    private int mTextContentStyle;

    private Paint mBgTrianglePaint;
    private int mBgTriangleColor;

    private float mTopPadding;
    private float mBottomPadding;
    private float mCenterPadding;
    private float mTopDistance;

    private float mRouteDegrees;

    private String mTextTitle;
    private String mTextContent;

    private int mBgTriangleWidth;
    private int mBgTriangleHeight;

    public LabelViewHelper(Context context, AttributeSet attrs) {
        TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.LabelView);
        mTopPadding = typedArray.getDimension(R.styleable.LabelView_labelTopPadding,
            context.getResources().getDimensionPixelSize(R.dimen.default_label_top_padding));
        mCenterPadding = typedArray.getDimension(R.styleable.LabelView_labelCenterPadding, 0);
        mBottomPadding = typedArray.getDimension(R.styleable.LabelView_labelBottomPadding,
            context.getResources().getDimensionPixelSize(R.dimen.default_label_bottom_padding));
        mTopDistance = typedArray.getDimension(R.styleable.LabelView_labelTopDistance, 0);
        mBgTriangleColor = typedArray.getColor(R.styleable.LabelView_backgroundColor, Color.BLUE);
        mTextTitleColor = typedArray.getColor(R.styleable.LabelView_textTitleColor, Color.WHITE);
        mTextContentColor = typedArray.getColor(R.styleable.LabelView_textContentColor, Color.WHITE);
        mTextTitleSize = typedArray.getDimension(R.styleable.LabelView_textTitleSize,
            context.getResources().getDimensionPixelSize(R.dimen.default_label_title_size));
        mTextContentSize = typedArray.getDimension(R.styleable.LabelView_textContentSize,
            context.getResources().getDimensionPixelSize(R.dimen.default_label_content_size));
        mTextTitle = typedArray.getString(R.styleable.LabelView_textTitle);
        mTextContent = typedArray.getString(R.styleable.LabelView_textContent);
        mTextTitleStyle = typedArray.getInt(R.styleable.LabelView_textTitleStyle, STYLE_NORMAL);
        mTextContentStyle = typedArray.getInt(R.styleable.LabelView_textContentStyle, STYLE_NORMAL);
        mRouteDegrees = typedArray.getInt(R.styleable.LabelView_labelDirection, ROTATE_LEFT);
        typedArray.recycle();

        initAllArt();
        resetAllMeasureSize();
    }

    public void drawLabel(View view, Canvas canvas) {
        if (canvas == null || view == null) {
            throw new IllegalArgumentException("LabelViewHelper draw canvas or view cant't be null!");
        }

        canvas.save();
        if (mRouteDegrees == ROTATE_LEFT) {
            canvas.translate(-mBgTriangleWidth / 2, 0);
            canvas.rotate(mRouteDegrees, mBgTriangleWidth / 2, 0);
        } else if (mRouteDegrees == ROTATE_RIGHT) {
            int rotateViewWH = (int) (mBgTriangleHeight * Math.sqrt(2));
            canvas.translate(view.getMeasuredWidth() - rotateViewWH, -mBgTriangleHeight);
            canvas.rotate(mRouteDegrees, 0, mBgTriangleHeight);
        }

        Path path = new Path();
        path.moveTo(0, mBgTriangleHeight);
        if (mTopDistance < 0) {
            // mTopDistance > 0 represents a trapezoid, otherwise represents a triangle.
            mTopDistance = 0;
        }
        path.lineTo(mBgTriangleWidth / 2 - mTopDistance, mTopDistance);
        path.lineTo(mBgTriangleWidth / 2 + mTopDistance, mTopDistance);
        path.lineTo(mBgTriangleWidth, mBgTriangleHeight);
        path.close();
        canvas.drawPath(path, mBgTrianglePaint);

        if (!TextUtils.isEmpty(mTextTitle)) {
            canvas.drawText(mTextTitle, (mBgTriangleWidth) / 2, mTopDistance + mTopPadding + mTextTitleRect.height(), mTextTitlePaint);
        }
        if (!TextUtils.isEmpty(mTextContent)) {
            canvas.drawText(mTextContent, (mBgTriangleWidth) / 2, (mTopDistance + mTopPadding + mTextTitleRect.height() + mCenterPadding + mTextContentRect.height()), mTextContentPaint);
        }

        canvas.restore();
    }

    public int getBgTriangleWidth() {
        return mBgTriangleWidth;
    }

    public int getBgTriangleHeight() {
        return mBgTriangleHeight;
    }

    public void setTextContent(String content) {
        mTextContent = content;
        resetAllMeasureSize();
    }

    public String getTextContent() {
        return mTextContent;
    }

    public void setTextTitle(String title) {
        mTextTitle = title;
        resetAllMeasureSize();
    }

    public String getTextTitle() {
        return mTextTitle;
    }

    public void setLabelBackGroundColor(int color) {
        mBgTrianglePaint.setColor(color);
    }

    private void initAllArt() {
        mTextTitleRect = new Rect();
        mTextContentRect = new Rect();

        mTextTitlePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        mTextTitlePaint.setColor(mTextTitleColor);
        mTextTitlePaint.setTextAlign(Paint.Align.CENTER);
        mTextTitlePaint.setTextSize(mTextTitleSize);
        if (mTextTitleStyle == STYLE_ITALIC) {
            mTextTitlePaint.setTypeface(Typeface.SANS_SERIF);
        } else if (mTextTitleStyle == STYLE_BOLD) {
            mTextTitlePaint.setTypeface(Typeface.DEFAULT_BOLD);
        }

        mTextContentPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        mTextContentPaint.setColor(mTextContentColor);
        mTextContentPaint.setTextAlign(Paint.Align.CENTER);
        mTextContentPaint.setTextSize(mTextContentSize);
        if (mTextContentStyle == STYLE_ITALIC) {
            mTextContentPaint.setTypeface(Typeface.SANS_SERIF);
        } else if (mTextContentStyle == STYLE_BOLD) {
            mTextContentPaint.setTypeface(Typeface.DEFAULT_BOLD);
        }

        mBgTrianglePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        mBgTrianglePaint.setColor(mBgTriangleColor);
    }

    private void resetAllMeasureSize() {
        if (!TextUtils.isEmpty(mTextTitle)) {
            mTextTitlePaint.getTextBounds(mTextTitle, 0, mTextTitle.length(), mTextTitleRect);
        }

        if (!TextUtils.isEmpty(mTextContent)) {
            mTextContentPaint.getTextBounds(mTextContent, 0, mTextContent.length(), mTextContentRect);
        }

        mBgTriangleHeight = (int) (mTopDistance + mTopPadding + mCenterPadding + mBottomPadding + mTextTitleRect.height() + mTextContentRect.height());
        mBgTriangleWidth = 2 * mBgTriangleHeight;
    }
}


text:
layout: post
title: Markdown Example - Code
key: 20160303
tags: markdown English
---

Ut erat nisl, dignissim et iaculis ac, adipiscing non ipsum. `/r/n` Vivamus ornare `<?php echo("Hello World!"); ?>` hendrerit sapien ut ornare.

`<?php echo("Hello World!"); ?>`

`<p>Hello Workd!</p>`

### Tab

    (() => console.log('hello, world!'))();

### \`\`\`

```
(() => console.log('hello, world! hello, world! hello, world! hello, world! hello, world! hello, world! hello, world! hello, world!'))();
```

```javascript
(() => console.log('hello, world!'))();
```

<!--more-->

### Highlight

{% highlight javascript %}
(() => console.log('hello, world!'))();
{% endhighlight %}

{% highlight javascript %}
(() => console.log('hello, world! hello, world! hello, world! hello, world! hello, world! hello, world! hello, world! hello, world!'))();
{% endhighlight %}

{% highlight javascript linenos %}
var hello = 'hello';
var world = 'world';
var space = ' ';
(() => console.log(hello + space + world))();
{% endhighlight %}

Morbi dictum magna vitae mi malesuada laoreet. Proin tempus laoreet leo in lobortis. In sit amet ipsum vel massa fringilla volutpat. Aenean dictum odio in ligula egestas iaculis. Maecenas ut massa quis velit consectetur faucibus in in lectus. Praesent ac mauris nec tortor suscipit aliquam eu nec justo. Nulla facilisi. Curabitur sit amet ligula ante.


text:
namespace blink {

typedef CanvasImage Image;

IMPLEMENT_WRAPPERTYPEINFO(ui, Image);

#define FOR_EACH_BINDING(V) \
  V(Image, width)           \
  V(Image, height)          \
  V(Image, dispose)

FOR_EACH_BINDING(DART_NATIVE_CALLBACK)

void CanvasImage::RegisterNatives(tonic::DartLibraryNatives* natives) {
  natives->Register({FOR_EACH_BINDING(DART_REGISTER_NATIVE)});
}

CanvasImage::CanvasImage() {}

CanvasImage::~CanvasImage() {}

void CanvasImage::dispose() {
  ClearDartWrapper();
}

}  // namespace blink


text:
<?xml version="1.0" encoding="UTF-8"?>

		<item value="false" key="isRegEx"/>
		<item value="(width/5)*2" key="selection"/>
		<item value="false" key="casesensitive"/>
		<item value="false" key="incremental"/>
		<item value="true" key="wrap"/>
		<item value="false" key="wholeword"/>
		<list key="findhistory">
			<item value="		canvas.fillRect(x+10, y+30, width-20, height-60);"/>
			<item value="width/5"/>
			<item value="Color"/>
			<item value="package com.jhilden13.AdvProgramming20142015.modulus;"/>
		</list>
		<list key="replacehistory">
			<item value="(width/5)*2"/>
			<item value=""/>
		</list>

		<item value="257" key="DIALOG_WIDTH"/>
		<item value="1|Segoe UI|9.0|0|WINDOWS|1|-12|0|0|0|400|0|0|0|1|0|0|0|0|Segoe UI" key="DIALOG_FONT_NAME"/>
		<item value="378" key="DIALOG_HEIGHT"/>
		<item value="856" key="DIALOG_X_ORIGIN"/>
		<item value="152" key="DIALOG_Y_ORIGIN"/>


text:
import redis
import logging
from tornado import escape
from Handlers.BaseHandler import BaseHandler

logger = logging.getLogger(__name__)

class LoginHandler(BaseHandler):
    """Handle user login actions
    """
    def initialize(self, redis_client: redis.Redis):
        """initialize

        :param redis_client: redis connection
        """
        self.redis_client = redis_client

    def get(self):
        """Get login form
        """
        if self.current_user:
            self.redirect('/')
            return
        self.render('login.html', user=self.current_user)

    def post(self):
        """Post connection form and try to connect with these credentials
        """
        if self.current_user:
            return
        getusername = escape.xhtml_escape(self.get_argument('username'))
        getpassword = escape.xhtml_escape(self.get_argument('password'))
        if self.redis_client.exists('users-' + getusername) \
                and getpassword == self.redis_client.get('users-' + getusername).decode():
            logger.debug('user connected : ' + getusername)
            self.set_secure_cookie("user", getusername, expires_days=1)
            self.redirect('/')
        else:
            logger.info('invalid credentials : "' + getusername + '" "' + getpassword + '"')
            self.render('login.html', error='Invalid credentials')


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

  <parent>
    <groupId>examples</groupId>
    <artifactId>wmq</artifactId>
    <version>1.0.0-SNAPSHOT</version>
  </parent>

  <groupId>examples.wmq</groupId>
  <artifactId>features</artifactId>
  <packaging>pom</packaging>

  <name>WMQ :: Feature File</name>
  <description>Feature repository for WMQ example projects</description>

  <build>

    <resources>
      <resource>
        <directory>.</directory>
        <filtering>true</filtering>
        <includes>
          <include>features-wmq.xml</include>
        </includes>
      </resource>
    </resources>

    <plugins>

      <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <executions>
              <execution>
                  <id>filter-resources</id>
                  <phase>generate-resources</phase>
                  <goals>
                      <goal>resources</goal>
                  </goals>
              </execution>
          </executions>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>attach-artifacts</id>
            <phase>package</phase>
            <goals>
              <goal>attach-artifact</goal>
            </goals>
            <configuration>
              <artifacts>
                <artifact>
                  <file>target/classes/features-wmq.xml</file>
                  <classifier>features</classifier>
		  <type>xml</type>
                </artifact>
              </artifacts>
            </configuration>
          </execution>
        </executions>
      </plugin>

    </plugins>

  </build>

</project>


text:
/**
 * Classes and utilities designed to work with the {@code jakarta.servlet} specification.
 */
package org.springframework.boot.web.servlet;


text:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:jaxrs="http://cxf.apache.org/jaxrs"
       xmlns="http://www.springframework.org/schema/beans" xmlns:cxf="http://cxf.apache.org/core"
       xmlns:jaxws="http://cxf.apache.org/jaxws"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans.xsd
    http://cxf.apache.org/jaxrs
    http://cxf.apache.org/schemas/jaxrs.xsd http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">

    <jaxrs:server id="cxfRestful" address="/restful">
        <jaxrs:serviceBeans>
            <ref bean="cxfRestfulImpl"/>
            <ref bean="userCxfWebService"/>
            <ref bean="bookCxfWebService"/>
        </jaxrs:serviceBeans>
        <jaxrs:extensionMappings>
            <entry key="json" value="application/json"/>
            <entry key="jsonp" value="application/jsonp"/>
            <entry key="xml" value="application/xml"/>
        </jaxrs:extensionMappings>
        <jaxrs:languageMappings>
            <entry key="en" value="en-gb"/>
        </jaxrs:languageMappings>
        <jaxrs:providers>
            <ref bean="loginProvider"/>
            <ref bean="jsonProvider"/>
            <ref bean="jaxbProvider"/>
        </jaxrs:providers>
        <jaxrs:inInterceptors>
            <ref bean="loginRequestInterceptor"/>
            <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"></bean>
        </jaxrs:inInterceptors>
        <jaxrs:outInterceptors>
            <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"></bean>
        </jaxrs:outInterceptors>

    </jaxrs:server>

    <bean id="loginProvider" class="com.forsrc.cxf.server.provider.LoginProvider"></bean>

    <bean id="webClient" class="org.apache.cxf.jaxrs.client.WebClient" factory-method="create">
        <constructor-arg type="java.lang.String" value="http://localhost:8077/cxf/restful/"/>
    </bean>

    <bean id="loginRequestInterceptor" class="com.forsrc.cxf.server.interceptor.LoginRequestInterceptor"/>
    <bean id="loginInterceptor" class="com.forsrc.cxf.server.interceptor.LoginInterceptor"/>

    <bean id="cxfInterceptor" class="com.forsrc.cxf.server.interceptor.CxfInterceptor"/>

    <bean id="cxfBusFactory" class="org.apache.cxf.bus.spring.SpringBusFactory"></bean>

    <bean id="cxf" factory-bean="cxfBusFactory" factory-method="createBus">

    </bean>

    <cxf:bus>
        <cxf:inInterceptors>
            <ref bean="cxfInterceptor"/>
            <ref bean="loginRequestInterceptor"/>
        </cxf:inInterceptors>

        <!--<cxf:outInterceptors>

                <ref bean=""/>
        </cxf:outInterceptors>-->
    </cxf:bus>

    <bean id="cxfRestfulImpl" class="com.forsrc.cxf.server.demo.impl.CxfRestfulImpl"/>
    <bean id="userCxfWebService" class="com.forsrc.cxf.server.restful.user.webservice.impl.UserCxfWebServiceImpl"/>
    <bean id="bookCxfWebService" class="com.forsrc.cxf.server.restful.book.webservice.impl.BookCxfWebServiceImpl"/>

    <jaxws:endpoint id="wsService" address="/ws" serviceName="com.forsrc.cxf.server.restful.book.webservice.BookCxfWebService"
        implementor="#bookCxfWebService">

        <jaxws:inInterceptors>
            <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"></bean>
        </jaxws:inInterceptors>
        <jaxws:outInterceptors>
            <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"></bean>
        </jaxws:outInterceptors>
    </jaxws:endpoint>

</beans>


text:
package org.apache.commons.exec;

import static org.junit.Assert.fail;

import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import org.junit.Test;

/**
 * An example based on the tutorial where the user can can safely play with
 *

 *
blocking or non-blocking print jobs
 *
with print job timeouts to trigger the {@code ExecuteWatchdog}
 *
with the {@code exitValue} returned from the print script
 *

 *
 * @version $Id$
 */
public class TutorialTest {

    /** the directory to pick up the test scripts */
    private final File testDir = new File("src/test/scripts");

    /** simulates a PDF print job */
    private final File acroRd32Script = TestUtil.resolveScriptForOS(testDir + "/acrord32");

    @Test
    public void testTutorialExample() throws Exception {

        final long printJobTimeout = 15000;
        final boolean printInBackground = false;
        final File pdfFile = new File("/Documents and Settings/foo.pdf");

        PrintResultHandler printResult;

        try {
            // printing takes around 10 seconds
            System.out.println("[main] Preparing print job ...");
            printResult = print(pdfFile, printJobTimeout, printInBackground);
            System.out.println("[main] Successfully sent the print job ...");
        }
        catch (final Exception e) {
            e.printStackTrace();
            fail("[main] Printing of the following document failed : " + pdfFile.getAbsolutePath());
            throw e;
        }

        // come back to check the print result
        System.out.println("[main] Test is exiting but waiting for the print job to finish...");
        printResult.waitFor();
        System.out.println("[main] The print job has finished ...");
    }

    /**
     * Simulate printing a PDF document.
     *
     * @param file the file to print
     * @param printJobTimeout the printJobTimeout (ms) before the watchdog terminates the print process
     * @param printInBackground printing done in the background or blocking
     * @return a print result handler (implementing a future)
     * @throws IOException the test failed
     */
    public PrintResultHandler print(final File file, final long printJobTimeout, final boolean printInBackground)
            throws IOException {

        int exitValue;
        ExecuteWatchdog watchdog = null;
        PrintResultHandler resultHandler;

        // build up the command line to using a 'java.io.File'
        final Map<String, File> map = new HashMap<String, File>();
        map.put("file", file);
        final CommandLine commandLine = new CommandLine(acroRd32Script);
        commandLine.addArgument("/p");
        commandLine.addArgument("/h");
        commandLine.addArgument("${file}");
        commandLine.setSubstitutionMap(map);

        // create the executor and consider the exitValue '1' as success
        final Executor executor = new DefaultExecutor();
        executor.setExitValue(1);

        // create a watchdog if requested
        if (printJobTimeout > 0) {
            watchdog = new ExecuteWatchdog(printJobTimeout);
            executor.setWatchdog(watchdog);
        }

        // pass a "ExecuteResultHandler" when doing background printing
        if (printInBackground) {
            System.out.println("[print] Executing non-blocking print job  ...");
            resultHandler = new PrintResultHandler(watchdog);
            executor.execute(commandLine, resultHandler);
        }
        else {
            System.out.println("[print] Executing blocking print job  ...");
            exitValue = executor.execute(commandLine);
            resultHandler = new PrintResultHandler(exitValue);
        }

        return resultHandler;
    }

    private class PrintResultHandler extends DefaultExecuteResultHandler {

        private ExecuteWatchdog watchdog;

        public PrintResultHandler(final ExecuteWatchdog watchdog)
        {
            this.watchdog = watchdog;
        }

        public PrintResultHandler(final int exitValue) {
            super.onProcessComplete(exitValue);
        }

        @Override
        public void onProcessComplete(final int exitValue) {
            super.onProcessComplete(exitValue);
            System.out.println("[resultHandler] The document was successfully printed ...");
        }

        @Override
        public void onProcessFailed(final ExecuteException e) {
            super.onProcessFailed(e);
            if (watchdog != null && watchdog.killedProcess()) {
                System.err.println("[resultHandler] The print process timed out");
            }
            else {
                System.err.println("[resultHandler] The print process failed to do : " + e.getMessage());
            }
        }
    }
}


text:
/**
 * @addtogroup t_stack_api
 * @{
 * @defgroup t_stack_api_basic test_stack_api_basic
 * @brief TestPurpose: verify zephyr stack apis under different context
 * - API coverage
 *   -# k_stack_init K_STACK_DEFINE
 *   -# k_stack_push
 *   -# k_stack_pop
 * @}
 */

#include <ztest.h>
#include <irq_offload.h>

#define STACK_SIZE 512
#define STACK_LEN 2

/**TESTPOINT: init via K_STACK_DEFINE*/
K_STACK_DEFINE(kstack, STACK_LEN);
static struct k_stack stack;

static char __noinit __stack threadstack[STACK_SIZE];
static u32_t data[STACK_LEN] = { 0xABCD, 0x1234 };
static struct k_sem end_sema;

static void tstack_push(struct k_stack *pstack)
{
	for (int i = 0; i < STACK_LEN; i++) {
		/**TESTPOINT: stack push*/
		k_stack_push(pstack, data[i]);
	}
}

static void tstack_pop(struct k_stack *pstack)
{
	u32_t rx_data;

	for (int i = STACK_LEN - 1; i >= 0; i--) {
		/**TESTPOINT: stack pop*/
		zassert_false(k_stack_pop(pstack, &rx_data, K_NO_WAIT), NULL);
		zassert_equal(rx_data, data[i], NULL);
	}
}

/*entry of contexts*/
static void tIsr_entry_push(void *p)
{
	tstack_push((struct k_stack *)p);
}

static void tIsr_entry_pop(void *p)
{
	tstack_pop((struct k_stack *)p);
}

static void tThread_entry(void *p1, void *p2, void *p3)
{
	tstack_pop((struct k_stack *)p1);
	k_sem_give(&end_sema);
	tstack_push((struct k_stack *)p1);
	k_sem_give(&end_sema);
}

static void tstack_thread_thread(struct k_stack *pstack)
{
	k_sem_init(&end_sema, 0, 1);
	/**TESTPOINT: thread-thread data passing via stack*/
	k_tid_t tid = k_thread_spawn(threadstack, STACK_SIZE,
				     tThread_entry, pstack, NULL, NULL,
				     K_PRIO_PREEMPT(0), 0, 0);
	tstack_push(pstack);
	k_sem_take(&end_sema, K_FOREVER);

	k_sem_take(&end_sema, K_FOREVER);
	tstack_pop(pstack);

	/* clear the spawn thread to avoid side effect */
	k_thread_abort(tid);
}

static void tstack_thread_isr(struct k_stack *pstack)
{
	k_sem_init(&end_sema, 0, 1);
	/**TESTPOINT: thread-isr data passing via stack*/
	irq_offload(tIsr_entry_push, pstack);
	tstack_pop(pstack);

	tstack_push(pstack);
	irq_offload(tIsr_entry_pop, pstack);
}

/*test cases*/
void test_stack_thread2thread(void)
{
	/**TESTPOINT: test k_stack_init stack*/
	k_stack_init(&stack, data, STACK_LEN);
	tstack_thread_thread(&stack);

	/**TESTPOINT: test K_STACK_INIT stack*/
	tstack_thread_thread(&kstack);
}

void test_stack_thread2isr(void)
{
	/**TESTPOINT: test k_stack_init stack*/
	k_stack_init(&stack, data, STACK_LEN);
	tstack_thread_isr(&stack);

	/**TESTPOINT: test K_STACK_INIT stack*/
	tstack_thread_isr(&kstack);
}


text:
import * as React from 'react';
import { Field, IFieldErrors, IField, ActionData } from '../src';

export interface ITextFieldProps extends React.HTMLAttributes<Element> {
  Name: string;
  Form: string;
  value?: string;
  defaultValue?: string;
  onChange?: (e: React.KeyboardEvent<Element>) => any;
  minLength?: string | number;
  OnFormChange?: (data: ActionData) => void;
}

export interface ITextFieldState {
  value: string;
  disabled: boolean;
  errors: IFieldErrors;
}

export class TextField extends React.Component<ITextFieldProps, ITextFieldState> {
  constructor(props: ITextFieldProps, context?: any) {
    super(props, context);
    this.state = {
      value: this.props.value || this.props.defaultValue || '',
      disabled: false,
      errors: {},
    };
    this.disable = this.disable.bind(this);
    this.enable = this.enable.bind(this);
    this.focus = this.focus.bind(this);
    this.onChange = this.onChange.bind(this);
    this.dispatchErrors = this.dispatchErrors.bind(this);
    this.onKeyDown = this.onKeyDown.bind(this);
  }

  private field: IField | null;
  private input: HTMLInputElement | null;

  get value() {
    if (Reflect.has(this.props, 'value')) {
      return this.props.value;
    } else return this.state.value;
  }

  get validators() {
    const out = {};
    if (Reflect.has(this.props, 'minLength')) {
      const minLength = parseInt(Reflect.get(this.props, 'minLength'));
      if (!isNaN(minLength)) {
        Reflect.set(out, 'minLength', (value: string) => {
          return value.length < minLength ? Promise.reject(undefined) : Promise.resolve();
        });
      }
    }
    return out;
  }

  onChange(e: React.ChangeEvent<Element>) {
    if (this.props.onChange instanceof Function) {
      this.props.onChange.call(undefined, e);
    }
    this.setState({
      value: (e.target as HTMLInputElement).value,
    });
  }

  disable() {
    this.setState({
      disabled: true
    });
  }

  enable() {
    this.setState({
      disabled: false
    });
  }

  dispatchErrors(errors: IFieldErrors) {
    console.log('call dispatchErrors', errors);
    this.setState({
      errors
    });
  }

  focus() {
    if (this.input) {
      this.input.focus();
    }
  }

  onKeyDown(e: React.KeyboardEvent<HTMLInputElement>) {
    if (e.keyCode === 13 && this.field) {
      this.field.submit();
    }
  }

  render() {
    const locks = [
      (field: IField) => (field.value.length !== 0),
    ];

    return (
      <Field
        ref={node => this.field = node}
        OnFocus={this.focus}
        Name={this.props.Name}
        Locks={locks}
        Form={this.props.Form}
        Value={this.value}
        Validators={this.validators}
        ErrorDispatcher={this.dispatchErrors}
        OnFormChange={this.props.OnFormChange}
      >

          <input ref={node => this.input = node} value={this.value} onChange={this.onChange} onKeyDown={this.onKeyDown} />

            {JSON.stringify(this.state.errors, null, 2)}

      </Field>
    )
  }
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Mycotaxon 32(1): 249 (1988)

#### Original name
Thecaphora oberwinkleri Vánky

### Remarks
null


text:
<?xml version="1.0" encoding="UTF-8"?>
<!-- IMPORTANT: This is an internal file that has been generated
     by the Xilinx ISE software.  Any direct editing or
     changes made to this file may result in unpredictable
     behavior or data corruption.  It is strongly advised that
     users do not edit the contents of this file. -->
<DeviceUsageSummary rev="2">
<DesignStatistics TimeStamp="Sat May 14 18:38:37 2016"><group name="NetStatistics">
<item name="NumNets_Active" rev="2">
<attrib name="value" value="21"/></item>
<item name="NumNets_Gnd" rev="2">
<attrib name="value" value="1"/></item>
<item name="NumNets_Vcc" rev="2">
<attrib name="value" value="1"/></item>
<item name="NumNodesOfType_Active_CLKPIN" rev="2">
<attrib name="value" value="3"/></item>
<item name="NumNodesOfType_Active_CNTRLPIN" rev="2">
<attrib name="value" value="2"/></item>
<item name="NumNodesOfType_Active_DOUBLE" rev="2">
<attrib name="value" value="24"/></item>
<item name="NumNodesOfType_Active_DUMMY" rev="2">
<attrib name="value" value="1"/></item>
<item name="NumNodesOfType_Active_DUMMYESC" rev="2">
<attrib name="value" value="2"/></item>
<item name="NumNodesOfType_Active_GLOBAL" rev="2">
<attrib name="value" value="7"/></item>
<item name="NumNodesOfType_Active_HUNIHEX" rev="2">
<attrib name="value" value="1"/></item>
<item name="NumNodesOfType_Active_INPUT" rev="2">
<attrib name="value" value="14"/></item>
<item name="NumNodesOfType_Active_IOBOUTPUT" rev="2">
<attrib name="value" value="2"/></item>
<item name="NumNodesOfType_Active_OMUX" rev="2">
<attrib name="value" value="8"/></item>
<item name="NumNodesOfType_Active_OUTPUT" rev="2">
<attrib name="value" value="6"/></item>
<item name="NumNodesOfType_Active_PREBXBY" rev="2">
<attrib name="value" value="6"/></item>
<item name="NumNodesOfType_Active_VFULLHEX" rev="2">
<attrib name="value" value="4"/></item>
<item name="NumNodesOfType_Active_VUNIHEX" rev="2">
<attrib name="value" value="3"/></item>
<item name="NumNodesOfType_Gnd_INPUT" rev="2">
<attrib name="value" value="2"/></item>
<item name="NumNodesOfType_Gnd_OMUX" rev="2">
<attrib name="value" value="2"/></item>
<item name="NumNodesOfType_Gnd_OUTPUT" rev="2">
<attrib name="value" value="2"/></item>
<item name="NumNodesOfType_Vcc_CNTRLPIN" rev="2">
<attrib name="value" value="1"/></item>
<item name="NumNodesOfType_Vcc_INPUT" rev="2">
<attrib name="value" value="1"/></item>
<item name="NumNodesOfType_Vcc_VCCOUT" rev="2">
<attrib name="value" value="2"/></item>
</group>
<group name="MiscellaneousStatistics">
<item name="AGG_BONDED_IO" rev="1">
<attrib name="value" value="13"/></item>
<item name="AGG_IO" rev="1">
<attrib name="value" value="13"/></item>
<item name="AGG_SLICE" rev="1">
<attrib name="value" value="3"/></item>
<item name="NUM_BONDED_IBUF" rev="1">
<attrib name="value" value="2"/></item>
<item name="NUM_BONDED_IOB" rev="1">
<attrib name="value" value="11"/></item>
<item name="NUM_BUFGMUX" rev="1">
<attrib name="value" value="1"/></item>
<item name="NUM_SLICEL" rev="1">
<attrib name="value" value="3"/></item>
<item name="NUM_SLICE_FF" rev="1">
<attrib name="value" value="5"/></item>
</group>
<group name="SiteStatistics">
<item name="IBUF-DIFFM" rev="2">
<attrib name="value" value="1"/></item>
<item name="IBUF-DIFFMI" rev="2">
<attrib name="value" value="1"/></item>
<item name="IOB-DIFFM" rev="2">
<attrib name="value" value="5"/></item>
<item name="IOB-DIFFS" rev="2">
<attrib name="value" value="5"/></item>
</group>
</DesignStatistics>
<DeviceUsage TimeStamp="Sat May 14 18:38:37 2016"><group name="SiteSummary">
<item name="BUFGMUX" rev="2">
<attrib name="total" value="1000000"/><attrib name="used" value="1"/></item>
<item name="BUFGMUX_GCLKMUX" rev="2">
<attrib name="total" value="1000000"/><attrib name="used" value="1"/></item>
<item name="BUFGMUX_GCLK_BUFFER" rev="2">
<attrib name="total" value="1000000"/><attrib name="used" value="1"/></item>
<item name="IBUF" rev="2">
<attrib name="total" value="1000000"/><attrib name="used" value="2"/></item>
<item name="IBUF_INBUF" rev="2">
<attrib name="total" value="1000000"/><attrib name="used" value="2"/></item>
<item name="IBUF_PAD" rev="2">
<attrib name="total" value="1000000"/><attrib name="used" value="2"/></item>
<item name="IOB" rev="2">
<attrib name="total" value="1000000"/><attrib name="used" value="11"/></item>
<item name="IOB_OUTBUF" rev="2">
<attrib name="total" value="1000000"/><attrib name="used" value="11"/></item>
<item name="IOB_PAD" rev="2">
<attrib name="total" value="1000000"/><attrib name="used" value="11"/></item>
<item name="SLICEL" rev="2">
<attrib name="total" value="1000000"/><attrib name="used" value="3"/></item>
<item name="SLICEL_FFX" rev="2">
<attrib name="total" value="1000000"/><attrib name="used" value="2"/></item>
<item name="SLICEL_FFY" rev="2">
<attrib name="total" value="1000000"/><attrib name="used" value="3"/></item>
</group>
</DeviceUsage>
<ReportConfigData TimeStamp="Sat May 14 18:38:37 2016"><group name="IBUF_PAD">
<item name="IOATTRBOX" rev="2">
<attrib name="LVCMOS25" value="2"/></item>
</group>
<group name="SLICEL">
<item name="BX" rev="2">
<attrib name="BX_INV" value="0"/><attrib name="BX" value="2"/></item>
<item name="BY" rev="2">
<attrib name="BY" value="3"/><attrib name="BY_INV" value="0"/></item>
<item name="CLK" rev="2">
<attrib name="CLK" value="3"/><attrib name="CLK_INV" value="0"/></item>
<item name="SR" rev="2">
<attrib name="SR" value="2"/><attrib name="SR_INV" value="0"/></item>
</group>
<group name="IOB_OUTBUF">
<item name="IN" rev="2">
<attrib name="IN_INV" value="4"/><attrib name="IN" value="7"/></item>
</group>
<group name="BUFGMUX_GCLKMUX">
<item name="DISABLE_ATTR" rev="2">
<attrib name="LOW" value="1"/></item>
<item name="S" rev="2">
<attrib name="S_INV" value="1"/><attrib name="S" value="0"/></item>
</group>
<group name="SLICEL_FFX">
<item name="CK" rev="2">
<attrib name="CK" value="2"/><attrib name="CK_INV" value="0"/></item>
<item name="D" rev="2">
<attrib name="D" value="2"/><attrib name="D_INV" value="0"/></item>
<item name="FFX_INIT_ATTR" rev="2">
<attrib name="INIT0" value="1"/><attrib name="INIT1" value="1"/></item>
<item name="FFX_SR_ATTR" rev="2">
<attrib name="SRLOW" value="1"/><attrib name="SRHIGH" value="1"/></item>
<item name="LATCH_OR_FF" rev="2">
<attrib name="FF" value="2"/></item>
<item name="SR" rev="2">
<attrib name="SR" value="2"/><attrib name="SR_INV" value="0"/></item>
<item name="SYNC_ATTR" rev="2">
<attrib name="ASYNC" value="2"/></item>
</group>
<group name="SLICEL_FFY">
<item name="CK" rev="2">
<attrib name="CK" value="3"/><attrib name="CK_INV" value="0"/></item>
<item name="D" rev="2">
<attrib name="D" value="3"/><attrib name="D_INV" value="0"/></item>
<item name="FFY_INIT_ATTR" rev="2">
<attrib name="INIT0" value="3"/></item>
<item name="FFY_SR_ATTR" rev="2">
<attrib name="SRLOW" value="3"/></item>
<item name="LATCH_OR_FF" rev="2">
<attrib name="FF" value="3"/></item>
<item name="SR" rev="2">
<attrib name="SR" value="2"/><attrib name="SR_INV" value="0"/></item>
<item name="SYNC_ATTR" rev="2">
<attrib name="ASYNC" value="3"/></item>
</group>
<group name="IOB_PAD">
<item name="DRIVEATTRBOX" rev="2">
<attrib name="12" value="11"/></item>
<item name="IOATTRBOX" rev="2">
<attrib name="LVCMOS25" value="11"/></item>
<item name="SLEW" rev="2">
<attrib name="SLOW" value="11"/></item>
</group>
<group name="IOB">
<item name="O1" rev="2">
<attrib name="O1_INV" value="4"/><attrib name="O1" value="7"/></item>
</group>
<group name="BUFGMUX">
<item name="S" rev="2">
<attrib name="S_INV" value="1"/><attrib name="S" value="0"/></item>
</group>
</ReportConfigData>
<ReportPinData TimeStamp="Sat May 14 18:38:37 2016"><group name="IBUF_PAD">
<item name="PAD" rev="2">
<attrib name="value" value="2"/></item>
</group>
<group name="IBUF_INBUF">
<item name="IN" rev="2">
<attrib name="value" value="2"/></item>
<item name="OUT" rev="2">
<attrib name="value" value="2"/></item>
</group>
<group name="SLICEL">
<item name="BX" rev="2">
<attrib name="value" value="2"/></item>
<item name="BY" rev="2">
<attrib name="value" value="3"/></item>
<item name="CLK" rev="2">
<attrib name="value" value="3"/></item>
<item name="SR" rev="2">
<attrib name="value" value="2"/></item>
<item name="XQ" rev="2">
<attrib name="value" value="2"/></item>
<item name="YQ" rev="2">
<attrib name="value" value="3"/></item>
</group>
<group name="IOB_OUTBUF">
<item name="IN" rev="2">
<attrib name="value" value="11"/></item>
<item name="OUT" rev="2">
<attrib name="value" value="11"/></item>
</group>
<group name="BUFGMUX_GCLKMUX">
<item name="I0" rev="2">
<attrib name="value" value="1"/></item>
<item name="OUT" rev="2">
<attrib name="value" value="1"/></item>
<item name="S" rev="2">
<attrib name="value" value="1"/></item>
</group>
<group name="IBUF">
<item name="I" rev="2">
<attrib name="value" value="2"/></item>
<item name="PAD" rev="2">
<attrib name="value" value="2"/></item>
</group>
<group name="SLICEL_FFX">
<item name="CK" rev="2">
<attrib name="value" value="2"/></item>
<item name="D" rev="2">
<attrib name="value" value="2"/></item>
<item name="Q" rev="2">
<attrib name="value" value="2"/></item>
<item name="SR" rev="2">
<attrib name="value" value="2"/></item>
</group>
<group name="SLICEL_FFY">
<item name="CK" rev="2">
<attrib name="value" value="3"/></item>
<item name="D" rev="2">
<attrib name="value" value="3"/></item>
<item name="Q" rev="2">
<attrib name="value" value="3"/></item>
<item name="SR" rev="2">
<attrib name="value" value="2"/></item>
</group>
<group name="IOB_PAD">
<item name="PAD" rev="2">
<attrib name="value" value="11"/></item>
</group>
<group name="IOB">
<item name="O1" rev="2">
<attrib name="value" value="11"/></item>
<item name="PAD" rev="2">
<attrib name="value" value="11"/></item>
</group>
<group name="BUFGMUX">
<item name="I0" rev="2">
<attrib name="value" value="1"/></item>
<item name="O" rev="2">
<attrib name="value" value="1"/></item>
<item name="S" rev="2">
<attrib name="value" value="1"/></item>
</group>
<group name="BUFGMUX_GCLK_BUFFER">
<item name="IN" rev="2">
<attrib name="value" value="1"/></item>
<item name="OUT" rev="2">
<attrib name="value" value="1"/></item>
</group>
</ReportPinData>
<CmdHistory>
</CmdHistory>
</DeviceUsageSummary>


text:
    <title>Pokey Manager</title>

    <link href="http://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

    <link type="text/css" rel="stylesheet" href="static/css/materialize.min.css" media="screen,projection" />

    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

            PokeyPy Manager

Dashboard

Snipe

PokeManager

            <form action="/release" id="topForm">
                Sort By:
                <select form="topForm" id="sortBy" name="sortBy" onchange="sortPokes()" style="text-align:center;width:150px;">
			<option value="cp">Pokemon CP</option>
			<option value="pokemon_name">Pokemon Name</option>
			<option value="pokemon_id">Pokemon ID</option>
			<option value="iv">Pokemon IV</option>
			<option value="creation_time_ms">Recent</option>
			<option value="favorite">Favorites</option>

			</select>
			 <input type="button" id="advFilter" onclick="document.getElementById('advFilterModal').style.display = 'block'" value="Advanced Filter">
			 <input type="button" id="selectAll" onclick="selectAllPokes()" value="Select All">
			 <button id="refresh" type="button" >Refresh Data</button>

			 <input type="hidden" id="pokeID" name="pokeID">
			<input type=submit style="background-color:  #ff5c33;" value="Favorite Selected" name="action">
			<input type=submit style="background-color:  #ff5c33;"  value="Release Selected" name="action">
			<input type=submit style="background-color:  #ff5c33;"  value="Evolve Selected" name="action">
			<input type=submit style="background-color:  #ff5c33;"  value="Rename Selected" name="action">
			<input type=submit style="background-color:  #ff5c33;"  value="PowerUp Selected" name="action">

				 </form>

        CP Threshold <input value=0 style="margin-top:20px;margin-left:10px;width:100px;" id="cpThreshold">

            IV Threshold (%)<input value=0 style="margin-top:20px;margin-left:10px;width:100px;" id="ivThreshold">

                Pokemon Name <input style="margin-top:20px;margin-left:10px;width:100px;" id="pokemonName">

                    <button id="filter" type="button" onclick="sortPokes()">Filter Pokemon</button> <button id="closeModal" type="button" onclick="document.getElementById('advFilterModal').style='display:none;'">Cancel</button>


text:
<?xml version="1.0" encoding="utf-8" ?>
<!--
* Source

*Coding schemes:
  http://dicom.nema.org/medical/dicom/current/output/chtml/part16/PS3.16.html

-->

<mitkParamapPresets file_version="0.1" >
<!--
Tracer Kinetic Models
http://dicom.nema.org/medical/dicom/current/output/chtml/part16/sect_CID_4101.html
-->
  <preset name="Standard Tofts Model">
    <type code_value="126340" coding_scheme="DCM" code_name="Standard Tofts Model"/>
  </preset>
  <preset name="Extended Tofts Model">
    <type code_value="126341" coding_scheme="DCM" code_name="Extended Tofts Model"/>
  </preset>
  <preset name="First Pass Leakage Profile (FPLP) Model">
    <type code_value="126343" coding_scheme="DCM" code_name="First Pass Leakage Profile (FPLP) Model"/>
  </preset>
  <preset name="Shutter-Speed Model (SSM)">
    <type code_value="126344" coding_scheme="DCM" code_name="Shutter-Speed Model (SSM)"/>
  </preset>
  <preset name="Gamma Capillary Transit Time (GCTT) Model">
    <type code_value="126345" coding_scheme="DCM" code_name="Gamma Capillary Transit Time (GCTT) Model"/>
  </preset>
  <preset name="Adiabatic Tissue Homogeneity (ATH) Model">
    <type code_value="126346" coding_scheme="DCM" code_name="Adiabatic Tissue Homogeneity (ATH) Model"/>
  </preset>
  <preset name="Two Compartment Exchange (2CX) Model">
    <type code_value="126347" coding_scheme="DCM" code_name="Two Compartment Exchange (2CX) Model"/>
  </preset>
<!--
Perfusion Measurement Methods
http://dicom.nema.org/medical/dicom/current/output/chtml/part16/sect_CID_4102.html
-->
  <preset name="Perfusion analysis by Arterial Spin Labeling MR technique">
    <type code_value="126302" coding_scheme="DCM" code_name="Perfusion analysis by Arterial Spin Labeling MR technique"/>
  </preset>
  <preset name="Perfusion analysis by Susceptibility MR technique">
    <type code_value="126303" coding_scheme="DCM" code_name="Perfusion analysis by Susceptibility MR technique"/>
  </preset>
  <preset name="Perfusion analysis by Susceptibility MR technique">
    <type code_value="126303" coding_scheme="DCM" code_name="Perfusion analysis by Susceptibility MR technique"/>
  </preset>
<!--
Arterial Input Function Measurement Methods
http://dicom.nema.org/medical/dicom/current/output/chtml/part16/sect_CID_4103.html
-->
  <preset name="AIF Ignored">
    <type code_value="126360" coding_scheme="DCM" code_name="AIF Ignored"/>
  </preset>
  <preset name="Population Averaged AIF">
    <type code_value="126361" coding_scheme="DCM" code_name="Population Averaged AIF"/>
  </preset>
  <preset name="User-defined AIF ROI">
    <type code_value="126362" coding_scheme="DCM" code_name="User-defined AIF ROI"/>
  </preset>
  <preset name="Automatically Detected AIF ROI">
    <type code_value="126363" coding_scheme="DCM" code_name="Automatically Detected AIF ROI"/>
  </preset>
  <preset name="Blind Estimation of AIF">
    <type code_value="126364" coding_scheme="DCM" code_name="Blind Estimation of AIF"/>
  </preset>
<!--
Bolus Arrival Time Derivation Methods
http://dicom.nema.org/medical/dicom/current/output/chtml/part16/sect_CID_4104.html
-->
  <preset name="Temporal Derivative Exceeds Threshold">
    <type code_value="126373" coding_scheme="DCM" code_name="Temporal Derivative Exceeds Threshold"/>
  </preset>
  <preset name="Time of Peak Concentration">
    <type code_value="126370" coding_scheme="DCM" code_name="Time of Peak Concentration"/>
  </preset>
  <preset name="Time of Leading Half-Peak Concentration">
    <type code_value="126372" coding_scheme="DCM" code_name="Time of Leading Half-Peak Concentration"/>
  </preset>
<!--
Perfusion Analysis Methods
http://dicom.nema.org/medical/dicom/current/output/chtml/part16/sect_CID_4105.html
-->
  <preset name="Least Mean Square (LMS) deconvolution">
    <type code_value="126310" coding_scheme="DCM" code_name="Least Mean Square (LMS) deconvolution"/>
  </preset>
  <preset name="Singular Value Decomposition (SVD) deconvolution">
    <type code_value="126311" coding_scheme="DCM" code_name="Singular Value Decomposition (SVD) deconvolution"/>
  </preset>
<!--
Perfusion Analysis Methods
http://dicom.nema.org/medical/dicom/current/output/chtml/part16/sect_CID_4105.html
-->
  <preset name="Model-free concentration-time quantitification">
    <type code_value="126342" coding_scheme="DCM" code_name="Model-free concentration-time quantitification"/>
  </preset>
<!--
Tracer Kinetic Model Parameters
http://dicom.nema.org/medical/dicom/current/output/chtml/part16/sect_CID_4107.html
-->
  <preset name="KTrans">
    <type code_value="126312" coding_scheme="DCM" code_name="KTrans"/>
  </preset>
  <preset name="kep">
    <type code_value="126313" coding_scheme="DCM" code_name="kep"/>
  </preset>
  <preset name="ve">
    <type code_value="126314" coding_scheme="DCM" code_name="ve"/>
  </preset>
  <preset name="tau_m">
    <type code_value="126330" coding_scheme="DCM" code_name="tau_m"/>
  </preset>
  <preset name="vp">
    <type code_value="126331" coding_scheme="DCM" code_name="vp"/>
  </preset>
<!--
Perfusion Model Parameters
http://dicom.nema.org/medical/dicom/current/output/chtml/part16/sect_CID_4108.html
-->
  <preset name="Regional Cerebral Blood Flow">
    <type code_value="113055" coding_scheme="DCM" code_name="Regional Cerebral Blood Flow"/>
  </preset>
  <preset name="Regional Blood Flow">
    <type code_value="126390" coding_scheme="DCM" code_name="Regional Blood Flow"/>
  </preset>
  <preset name="Regional Cerebral Blood Volume">
    <type code_value="113056" coding_scheme="DCM" code_name="Regional Cerebral Blood Volume"/>
  </preset>
  <preset name="Regional Blood Volume">
    <type code_value="126391" coding_scheme="DCM" code_name="Regional Blood Volume"/>
  </preset>
  <preset name="Mean Transit Time">
    <type code_value="113052" coding_scheme="DCM" code_name="Mean Transit Time"/>
  </preset>
  <preset name="Time To Peak">
    <type code_value="113069" coding_scheme="DCM" code_name="Time To Peak"/>
  </preset>
  <preset name="Oxygen Extraction Fraction">
    <type code_value="126392" coding_scheme="DCM" code_name="Oxygen Extraction Fraction"/>
  </preset>
  <preset name="Tmax">
    <type code_value="113084" coding_scheme="DCM" code_name="Tmax"/>
  </preset>
<!--
Model-Independent Dynamic Contrast Analysis Parameters
http://dicom.nema.org/medical/dicom/current/output/chtml/part16/sect_CID_4109.html
-->
  <preset name="IAUC">
    <type code_value="126320" coding_scheme="DCM" code_name="IAUC"/>
  </preset>
  <preset name="IAUC60">
    <type code_value="126321" coding_scheme="DCM" code_name="IAUC60"/>
  </preset>
  <preset name="IAUC90">
    <type code_value="126322" coding_scheme="DCM" code_name="IAUC90"/>
  </preset>
  <preset name="IAUC190">
    <type code_value="126323" coding_scheme="DCM" code_name="IAUC180"/>
  </preset>
  <preset name="IAUCBN">
    <type code_value="126324" coding_scheme="DCM" code_name="IAUCBN"/>
  </preset>
  <preset name="IAUC60BN">
    <type code_value="126325" coding_scheme="DCM" code_name="IAUC60BN"/>
  </preset>
  <preset name="IAUC90BN">
    <type code_value="126326" coding_scheme="DCM" code_name="IAUC90BN"/>
  </preset>
  <preset name="IAUC180BN">
    <type code_value="126327" coding_scheme="DCM" code_name="IAUC90BN"/>
  </preset>
  <preset name="Time of Peak Concentration">
    <type code_value="126370" coding_scheme="DCM" code_name="Time of Peak Concentration"/>
  </preset>
  <preset name="Time of Leading Half-Peak Concentration">
    <type code_value="126372" coding_scheme="DCM" code_name="Time of Leading Half-Peak Concentration"/>
  </preset>
  <preset name="Bolus Arrival Time">
    <type code_value="126371" coding_scheme="DCM" code_name="Bolus Arrival Time"/>
  </preset>
  <preset name="Time To Peak">
    <type code_value="113069" coding_scheme="DCM" code_name="Time To Peak"/>
  </preset>
  <preset name="Temporal Derivative Threshold">
    <type code_value="126374" coding_scheme="DCM" code_name="Temporal Derivative Threshold"/>
  </preset>
  <preset name="Maximum Slope">
    <type code_value="126375" coding_scheme="DCM" code_name="Maximum Slope"/>
  </preset>
  <preset name="Time To Peak">
    <type code_value="126376" coding_scheme="DCM" code_name="Maximum Difference"/>
  </preset>
  <preset name="Tracer Concentration">
    <type code_value="126377" coding_scheme="DCM" code_name="Tracer Concentration"/>
  </preset>
  <!--
Tracer Kinetic Modeling Covariates
http://dicom.nema.org/medical/dicom/current/output/chtml/part16/sect_CID_4110.html
-->
  <preset name="Hematocrit">
    <type code_value="20570-8" coding_scheme="DCM" code_name="Hematocrit"/>
  </preset>

  <!--
Contrast Characteristics
http://dicom.nema.org/medical/dicom/current/output/chtml/part16/sect_CID_4111.html
-->
  <preset name="Contrast Longitudinal Relaxivity">
    <type code_value="126380" coding_scheme="DCM" code_name="Contrast Longitudinal Relaxivity"/>
  </preset>

</mitkParamapPresets>


text:
package com.comcast.cmb.test.tools;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Vector;

import javax.servlet.http.HttpServletRequest;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;

import org.apache.commons.lang.StringEscapeUtils;
import org.apache.log4j.Logger;

import com.amazonaws.util.json.JSONWriter;
import com.comcast.cmb.common.model.User;
import com.comcast.cmb.common.util.CMBProperties;
import com.comcast.cns.controller.CNSControllerServlet;
import com.comcast.cns.model.CNSSubscription;
import com.comcast.cns.model.CNSSubscription.CnsSubscriptionProtocol;
import com.comcast.cns.persistence.CNSSubscriptionCassandraPersistence;
import com.comcast.cns.persistence.ICNSSubscriptionPersistence;
import com.comcast.cns.test.unit.CNSSubscriptionTest;
import com.comcast.cqs.controller.CQSControllerServlet;

public class CNSTestingUtils {

	private static Logger logger = Logger.getLogger(CNSTestingUtils.class);

	public static List<CNSSubscription> confirmPendingSubscriptionsByTopic(String topicArn, String userId, CnsSubscriptionProtocol protocol) throws Exception {

		String nextToken = null;
		int round = 0;

		List<CNSSubscription> confirmedSubscriptions = new ArrayList<CNSSubscription>();
		ICNSSubscriptionPersistence subscriptionHandler = new CNSSubscriptionCassandraPersistence();

		while (round == 0 || nextToken != null) {

			List<CNSSubscription> subscriptions = subscriptionHandler.listAllSubscriptionsByTopic(nextToken, topicArn, protocol);

			if (subscriptions.size() > 0) {
				nextToken = subscriptions.get(subscriptions.size()-1).getArn();
			} else {
				nextToken = null;
			}

			for (CNSSubscription s : subscriptions) {

				if (!s.isConfirmed()) {
					CNSSubscription confirmedSubscription = subscriptionHandler.confirmSubscription(false, s.getToken(), topicArn);
					confirmedSubscriptions.add(confirmedSubscription);
				}
			}

			round++;
		}

		return confirmedSubscriptions;
	}

	public static Vector<String> getArnsFromString(String res) {
		//System.out.println("Starting parsing: res is:" + res);
		javax.xml.parsers.SAXParserFactory fac = new org.apache.xerces.jaxp.SAXParserFactoryImpl();
		javax.xml.parsers.SAXParser saxParser;

		ListTopicsResponseParser pl = new ListTopicsResponseParser();

		try {
			saxParser = fac.newSAXParser();
			saxParser.parse(new ByteArrayInputStream(res.getBytes()), pl);

		} catch (Exception ex) {
			logger.error("Exception parsing", ex);
		}
		return pl.getArns();
	}

	public static ListSubscriptionParser getSubscriptionDataFromString(String res) {
		//System.out.println("Starting parsing: res is:" + res);
		javax.xml.parsers.SAXParserFactory fac = new org.apache.xerces.jaxp.SAXParserFactoryImpl();
		javax.xml.parsers.SAXParser saxParser;

		ListSubscriptionParser pl = new ListSubscriptionParser();

		try {
			saxParser = fac.newSAXParser();
			saxParser.parse(new ByteArrayInputStream(res.getBytes()), pl);

		} catch (Exception ex) {

			logger.error("Exception parsing", ex);
		}
		return pl;
	}

	public static Vector<CNSSubscriptionTest> getSubscriptionsFromString(String res) {
		ListSubscriptionParser pl = getSubscriptionDataFromString(res);
		return pl.getSubscriptions();
	}

	public static String getSubscriptionArnFromString(String res) {
		javax.xml.parsers.SAXParserFactory fac = new org.apache.xerces.jaxp.SAXParserFactoryImpl();
		javax.xml.parsers.SAXParser saxParser;

		SubscribeParser p = new SubscribeParser();

		try {
			saxParser = fac.newSAXParser();
			saxParser.parse(new ByteArrayInputStream(res.getBytes()), p);

		} catch (Exception ex) {
			logger.error("Exception parsing", ex);
		}
		String arn = p.getSubscriptionArn();
		return arn;
	}

	public static SubscriptionAttributeParser getSubscriptionAttributesFromString(String res) {
		javax.xml.parsers.SAXParserFactory fac = new org.apache.xerces.jaxp.SAXParserFactoryImpl();
		javax.xml.parsers.SAXParser saxParser;

		SubscriptionAttributeParser p = new SubscriptionAttributeParser();

		try {
			saxParser = fac.newSAXParser();
			saxParser.parse(new ByteArrayInputStream(res.getBytes()), p);

		} catch (Exception ex) {
			logger.error("Exception parsing", ex);
		}

		return p;
	}

	public static TopicAttributeParser getTopicAttributesFromString(String res) {
		javax.xml.parsers.SAXParserFactory fac = new org.apache.xerces.jaxp.SAXParserFactoryImpl();
		javax.xml.parsers.SAXParser saxParser;

		TopicAttributeParser p = new TopicAttributeParser();

		try {
			saxParser = fac.newSAXParser();
			saxParser.parse(new ByteArrayInputStream(res.getBytes()), p);

		} catch (Exception ex) {
			logger.error("Exception parsing", ex);
		}

		return p;
	}

	public static String getArnFromString(String res) {
		javax.xml.parsers.SAXParserFactory fac = new org.apache.xerces.jaxp.SAXParserFactoryImpl();
		javax.xml.parsers.SAXParser saxParser;

		CreateTopicResponseParser p = new CreateTopicResponseParser();

		try {
			saxParser = fac.newSAXParser();
			saxParser.parse(new ByteArrayInputStream(res.getBytes()), p);

		} catch (Exception ex) {
			logger.error("Exception parsing", ex);

		}
		String arn = p.getTopicArn();
		return arn;
	}

	public static boolean verifyErrorResponse(String res, String code, String message) {

		SAXParserFactory fac = new org.apache.xerces.jaxp.SAXParserFactoryImpl();
		SAXParser saxParser;

		ErrorParser p = new ErrorParser();
		res = res.trim();

		try {
			saxParser = fac.newSAXParser();
			saxParser.parse(new ByteArrayInputStream(res.getBytes()), p);
		} catch (Exception ex) {
			logger.error("Exception parsing error response", ex);
		}

		if (code != null) {

			String rescode = p.getCode();

			if (!code.equals(rescode)) {
				logger.error("Wrong error code");
				return false;
			}
		}

		if (message != null) {

			String resmessage = p.getMessage();

			if (!resmessage.equals(message)) {
				logger.error("Wrong error messahe");
				return false;
			}
		}

		return true;
	}

	public static void addParam(Map<String, String[]> params, String name, String val) {
		String[] paramVals = new String[1];
		paramVals[0] = val;
		params.put(name, paramVals);
	}

	public static void addTopic(CNSControllerServlet cns, User user, OutputStream out, String topicName) throws Exception{
		SimpleHttpServletRequest request = new SimpleHttpServletRequest();
		Map<String, String[]> params = new HashMap<String, String[]>();
		addParam(params,"Action", "CreateTopic");
		if(topicName != null) addParam(params, "Name", topicName);
		addParam(params, "AWSAccessKeyId", user.getAccessKey());

		request.setParameterMap(params);
		SimpleHttpServletResponse response = new SimpleHttpServletResponse();

		response.setOutputStream(out);
		cns.doGet(request, response);
		response.getWriter().flush();
	}

	public static void addPermission(CNSControllerServlet cns, User user, OutputStream out, String topicArn, String account, String permission, String label) throws Exception{

	    SimpleHttpServletRequest request = new SimpleHttpServletRequest();
	    Map<String, String[]> params = new HashMap<String, String[]>();

		addParam(params,"Action", "AddPermission");
		addParam(params, "TopicArn", topicArn);
		addParam(params, "AWSAccessKeyId", user.getAccessKey());
		addParam(params, "AWSAccountId.member.1", account);
		addParam(params, "ActionName.member.1", permission);
		addParam(params, "Label", label);

		request.setParameterMap(params);

		SimpleHttpServletResponse response = new SimpleHttpServletResponse();
		response.setOutputStream(out);
		cns.doGet(request, response);
		response.getWriter().flush();
	}

	public static void listTopics(CNSControllerServlet cns, User user, OutputStream out, String token) throws Exception{
		HttpServletRequest request = new SimpleHttpServletRequest();
		Map<String, String[]> params = new HashMap<String, String[]>();

		addParam(params,"Action", "ListTopics");
		if(token!= null) addParam(params,"NextToken", token);
		addParam(params, "AWSAccessKeyId", user.getAccessKey());

		((SimpleHttpServletRequest) request).setParameterMap(params);
		SimpleHttpServletResponse response = new SimpleHttpServletResponse();
		response.setOutputStream(out);

		cns.doGet(request, response);
		response.getWriter().flush();
		logger.debug("Response: " + out.toString());
	}

	public static void testCommand(CNSControllerServlet cns, User user, OutputStream out, String command) throws Exception{
		HttpServletRequest request = new SimpleHttpServletRequest();
		Map<String, String[]> params = new HashMap<String, String[]>();

		addParam(params,"Action", command);

		addParam(params, "AWSAccessKeyId", user.getAccessKey());

		((SimpleHttpServletRequest) request).setParameterMap(params);
		SimpleHttpServletResponse response = new SimpleHttpServletResponse();
		response.setOutputStream(out);

		cns.doGet(request, response);
		response.getWriter().flush();
		//System.out.println("Out:" + out.toString());
	}

	public static void confirmSubscription(CNSControllerServlet cns, User user, OutputStream out, String topicArn, String token, String authOnSub) throws Exception {

		SimpleHttpServletRequest request = new SimpleHttpServletRequest();
		//System.out.println("Deleting Topic arn is:" + arn);
		Map<String, String[]> params = new HashMap<String, String[]>();
		addParam(params,"Action", "ConfirmSubscription");
		addParam(params, "AWSAccessKeyId", user.getAccessKey());
		if(topicArn != null) addParam(params,"TopicArn", topicArn);
		if(token != null) addParam(params,"Token", token);
		if(authOnSub != null) addParam(params,"AuthenticateOnUnsubscribe", authOnSub);

		request.setParameterMap(params);
		SimpleHttpServletResponse response = new SimpleHttpServletResponse();
		response.setOutputStream(out);
		logger.debug("confirmSubscription");
		cns.doGet(request,response);
		//System.out.println("Done Delete Topic Arn:" + arn);

		response.getWriter().flush();
		logger.debug("confirmSubscription Out:" + out.toString());

	}

	public static void deleteTopic(CNSControllerServlet cns, User user, OutputStream out, String arn) throws Exception {

		SimpleHttpServletRequest request = new SimpleHttpServletRequest();
		//System.out.println("Deleting Topic arn is:" + arn);
		Map<String, String[]> params = new HashMap<String, String[]>();
		addParam(params,"Action", "DeleteTopic");
		addParam(params, "AWSAccessKeyId", user.getAccessKey());
		addParam(params,"TopicArn", arn);

		request.setParameterMap(params);
		SimpleHttpServletResponse response = new SimpleHttpServletResponse();
		response.setOutputStream(out);
		//System.out.println("Do Delete Topic Arn:" + arn);
		cns.doGet(request,response);
		//System.out.println("Done Delete Topic Arn:" + arn);

		response.getWriter().flush();
		//System.out.println("Out:" + out.toString());

	}

	public static void deleteallSubscriptions(CNSControllerServlet cns, User user, OutputStream out) {
		//Get all topics

		try {
			listSubscriptions(cns,user,out, null);
		} catch (Exception e) {
			logger.error("Exception", e);
			assertTrue(false);
		}
		String res = out.toString();
		Vector<CNSSubscriptionTest> subs = CNSTestingUtils.getSubscriptionsFromString(res);

		//Delete all topics
		//System.out.println("Deleting arns size:" + arns.size());

		try {
			for(CNSSubscriptionTest sub:subs) {
				//System.out.println("Deleting arn:" + arn);
				String subscriptionArn = sub.getSubscriptionArn();
				if(!subscriptionArn.equals("PendingConfirmation")) {
					CNSTestingUtils.unSubscribe(cns, user, out, subscriptionArn);
				}

			}
		} catch (Exception e) {
			logger.error("Exception", e);
			assertFalse(true);
		}
	}

	public static void deleteallTopics(CNSControllerServlet cns, User user, OutputStream out) {
		//Get all topics

		try {
			listTopics(cns,user,out,null);
		} catch (Exception e) {
			logger.error("Exception", e);
			assertTrue(false);
		}
		String res = out.toString();
		Vector<String> arns = getArnsFromString(res);

		//Delete all topics
		//System.out.println("Deleting arns size:" + arns.size());

		try {
			for(String arn:arns) {
				//System.out.println("Deleting arn:" + arn);
				deleteTopic(cns,user,out,arn);

			}
		} catch (Exception e) {
			logger.error("Exception", e);
			assertFalse(true);
		}

	}

	public static void subscribe(CNSControllerServlet cns, User user, OutputStream out, String endpoint, String protocol, String arn) throws Exception {
		SimpleHttpServletRequest request = new SimpleHttpServletRequest();
		//System.out.println("Deleting Topic arn is:" + arn);
		Map<String, String[]> params = new HashMap<String, String[]>();
		addParam(params,"Action", "Subscribe");
		addParam(params,"AWSAccessKeyId", user.getAccessKey());
		if(endpoint !=null)	addParam(params,"Endpoint", endpoint);
		if(protocol !=null)	addParam(params,"Protocol", protocol);
		if(arn !=null)	addParam(params,"TopicArn", arn);

		request.setParameterMap(params);
		SimpleHttpServletResponse response = new SimpleHttpServletResponse();
		response.setOutputStream(out);
		//System.out.println("Do Delete Topic Arn:" + arn);
		cns.doGet(request,response);
		//System.out.println("Done Delete Topic Arn:" + arn);

		response.getWriter().flush();
	}

	public static void unSubscribe(CNSControllerServlet cns, User user, OutputStream out, String subscriptionArn) throws Exception {
		SimpleHttpServletRequest request = new SimpleHttpServletRequest();
		//System.out.println("Deleting Topic arn is:" + arn);
		Map<String, String[]> params = new HashMap<String, String[]>();
		addParam(params,"Action", "Unsubscribe");
		addParam(params,"AWSAccessKeyId", user.getAccessKey());
		if(subscriptionArn != null) addParam(params,"SubscriptionArn", subscriptionArn);

		request.setParameterMap(params);
		SimpleHttpServletResponse response = new SimpleHttpServletResponse();
		response.setOutputStream(out);
		//System.out.println("Do Delete Topic Arn:" + arn);
		cns.doGet(request,response);
		//System.out.println("Done Delete Topic Arn:" + arn);

		response.getWriter().flush();
	}

	public static String getQueueUrl(String response) {
		int beginLoc = response.indexOf("<QueueUrl>");
		int endLoc = response.indexOf("</QueueUrl>");

		return response.substring(beginLoc + 10, endLoc);
	}

	public static Vector<String> getQueueUrlfromList(String response) {
		Vector<String> res = new Vector<String>();
		int beginLoc = response.indexOf("<QueueUrl>");
		int endLoc = response.indexOf("</QueueUrl>");
		while(beginLoc != -1) {
			res.add(response.substring(beginLoc + 10, endLoc));
			beginLoc = response.indexOf("<QueueUrl>", endLoc);
			if(beginLoc == -1) break;
			endLoc = response.indexOf("</QueueUrl>", beginLoc);
		}
		return res;
	}

	public static String getReceiptHandle(String response) {
		int beginLoc = response.indexOf("<ReceiptHandle>");
		int endLoc = response.indexOf("</ReceiptHandle>");
		if(beginLoc != -1)
			return response.substring(beginLoc + 15, endLoc);
		else
			return null;
	}

	/*
	 * Get the body of the message from the CQS response
	 * @param response, the response from receiveMessage on CQS
	 * @return the content inside the Body tag.
	 */
	public static String getMessage(String response) {

		int beginLoc = response.indexOf("<Body>");
		int endLoc = response.indexOf("</Body>");

		if (beginLoc != -1) {
			return StringEscapeUtils.unescapeXml(response.substring(beginLoc + 6, endLoc));
		} else {
			return null;
		}
	}

	public static String receiveMessage(CQSControllerServlet cqs, User user, String queueURL, String numberOfMessages) throws Exception {

		SimpleHttpServletRequest request = new SimpleHttpServletRequest();

		request.setRequestUrl(queueURL);
		//System.out.println("Queue URL: " + queueURL);
		Map<String, String[]> params = new HashMap<String, String[]>();

		addParam(params, "Action", "ReceiveMessage");
		addParam(params, "AWSAccessKeyId", user.getAccessKey());
		addParam(params, "MaxNumberOfMessages", numberOfMessages);

		request.setParameterMap(params);
		logger.debug("Sending request:" + request.toString());
		SimpleHttpServletResponse response = new SimpleHttpServletResponse();

		OutputStream out = new ByteArrayOutputStream();

		response.setOutputStream(out);

		cqs.doGet(request, response);
		response.getWriter().flush();

		return out.toString();
	}

	public static String setPermissionForUser(CQSControllerServlet cqs, User user, User user2, String queueURL) throws Exception {

		SimpleHttpServletRequest request = new SimpleHttpServletRequest();

		request.setRequestUrl(queueURL);
		//System.out.println("Queue URL: " + queueURL);
		Map<String, String[]> params = new HashMap<String, String[]>();

		addParam(params, "Action", "AddPermission");
		addParam(params, "Label", "testLabel");
		addParam(params, "AWSAccessKeyId", user.getAccessKey());
		addParam(params, "AWSAccountId.1", user2.getUserId());
		addParam(params, "ActionName.1", "SendMessage");

		request.setParameterMap(params);
		logger.debug("Sending request:" + request.toString());
		SimpleHttpServletResponse response = new SimpleHttpServletResponse();

		OutputStream out = new ByteArrayOutputStream();

		response.setOutputStream(out);

		cqs.doGet(request, response);
		response.getWriter().flush();
		logger.debug("Add Permissions Response:" + out.toString());
		return out.toString();
	}

	public static String deleteMessage(CQSControllerServlet cqs, User user, String queueURL, String receiptHandle) throws Exception {

		SimpleHttpServletRequest request = new SimpleHttpServletRequest();

		request.setRequestUrl(queueURL);
		Map<String, String[]> params = new HashMap<String, String[]>();

		addParam(params, "Action", "DeleteMessage");
		addParam(params, "AWSAccessKeyId", user.getAccessKey());
		addParam(params, "ReceiptHandle", receiptHandle);

		request.setParameterMap(params);
		SimpleHttpServletResponse response = new SimpleHttpServletResponse();

		OutputStream out = new ByteArrayOutputStream();

		response.setOutputStream(out);

		cqs.doGet(request, response);
		response.getWriter().flush();

		return out.toString();
	}

	public static void listSubscriptions(CNSControllerServlet cns, User user, OutputStream out, String nextToken) throws Exception{
		HttpServletRequest request = new SimpleHttpServletRequest();
		Map<String, String[]> params = new HashMap<String, String[]>();

		addParam(params,"Action", "ListSubscriptions");
		if(nextToken != null) {
			addParam(params,"NextToken", nextToken);
		}
		addParam(params, "AWSAccessKeyId", user.getAccessKey());

		((SimpleHttpServletRequest) request).setParameterMap(params);
		SimpleHttpServletResponse response = new SimpleHttpServletResponse();
		response.setOutputStream(out);

		cns.doGet(request, response);
		response.getWriter().flush();
		//System.out.println("Out:" + out.toString());
	}

	public static void listSubscriptionsByTopic(CNSControllerServlet cns, User user, OutputStream out, String topicArn, String nextToken) throws Exception{
		HttpServletRequest request = new SimpleHttpServletRequest();
		Map<String, String[]> params = new HashMap<String, String[]>();

		addParam(params,"Action", "ListSubscriptionsByTopic");
		addParam(params, "TopicArn", topicArn);
		if(nextToken != null) {
			addParam(params,"NextToken", nextToken);
		}
		addParam(params, "AWSAccessKeyId", user.getAccessKey());

		((SimpleHttpServletRequest) request).setParameterMap(params);
		SimpleHttpServletResponse response = new SimpleHttpServletResponse();
		response.setOutputStream(out);

		cns.doGet(request, response);
		response.getWriter().flush();
		//System.out.println("Out:" + out.toString());
	}

	public static String listQueues(CQSControllerServlet cqs, User user) throws Exception {
		SimpleHttpServletRequest request = new SimpleHttpServletRequest();
		Map<String, String[]> params = new HashMap<String, String[]>();

		request.setRequestUrl(CMBProperties.getInstance().getCQSServiceUrl());
		addParam(params, "Action", "ListQueues");
		addParam(params, "AWSAccessKeyId", user.getAccessKey());
		addParam(params, "QueueNamePrefix", "");

		request.setParameterMap(params);
		SimpleHttpServletResponse response = new SimpleHttpServletResponse();

		OutputStream out = new ByteArrayOutputStream();
		response.setOutputStream(out);

		cqs.doGet(request, response);
		response.getWriter().flush();

		return out.toString();
	}

	public static String deleteQueue(CQSControllerServlet cqs, User user, String qUrl) throws Exception {
		SimpleHttpServletRequest request = new SimpleHttpServletRequest();
		request.setRequestUrl(qUrl);

		Map<String, String[]> params = new HashMap<String, String[]>();
		addParam(params, "Action", "DeleteQueue");
		addParam(params, "AWSAccessKeyId", user.getAccessKey());
		request.setParameterMap(params);

		SimpleHttpServletResponse response = new SimpleHttpServletResponse();
		OutputStream out = new ByteArrayOutputStream();
		response.setOutputStream(out);

		cqs.doGet(request, response);

		response.getWriter().flush();

		return out.toString();
	}

	public static String addQueue(CQSControllerServlet cqs, User user, String qName) throws Exception {

		SimpleHttpServletRequest request = new SimpleHttpServletRequest();
		request.setRequestUrl(CMBProperties.getInstance().getCQSServiceUrl());
		Map<String, String[]> params = new HashMap<String, String[]>();

		addParam(params, "Action", "CreateQueue");
		addParam(params, "AWSAccessKeyId", user.getAccessKey());
		addParam(params, "QueueName", qName);

		addParam(params, "Attribute.1.Name", "VisibilityTimeout");
		addParam(params, "Attribute.1.Value", "30");
		addParam(params, "Attribute.2.Name", "Policy");
		addParam(params, "Attribute.2.Value", "");
		addParam(params, "Attribute.3.Name", "MaximumMessageSize");
		addParam(params, "Attribute.3.Value", "65536");
		addParam(params, "Attribute.4.Name", "MessageRetentionPeriod");
		addParam(params, "Attribute.4.Value", "600");
		addParam(params, "Attribute.5.Name", "DelaySeconds");
		addParam(params, "Attribute.5.Value", "0");

		request.setParameterMap(params);
		SimpleHttpServletResponse response = new SimpleHttpServletResponse();

		OutputStream out = new ByteArrayOutputStream();
		response.setOutputStream(out);

		cqs.doGet(request, response);
		response.getWriter().flush();

		return out.toString();
	}

	public static String doPublish(CNSControllerServlet cns, User user, OutputStream out, String message, String messageStructure, String subject, String topicArn) throws Exception{
		SimpleHttpServletRequest request = new SimpleHttpServletRequest();
		Map<String, String[]> params = new HashMap<String, String[]>();

		addParam(params, "Action", "Publish");
		if(message != null) {
			addParam(params, "Message", message);
		}
		if(messageStructure != null) {
			addParam(params, "MessageStructure", messageStructure);
		}
		if(subject != null) {
			addParam(params, "Subject", subject);
		}
		if(topicArn != null) {
			addParam(params, "TopicArn", topicArn);
		}
		addParam(params, "AWSAccessKeyId", user.getAccessKey());

		request.setParameterMap(params);
		((SimpleHttpServletRequest) request).setParameterMap(params);
		SimpleHttpServletResponse response = new SimpleHttpServletResponse();
		response.setOutputStream(out);

		cns.doGet(request, response);
		response.getWriter().flush();

		return out.toString();
	}

	public static String doGetSubscriptionAttributes(CNSControllerServlet cns, User user, OutputStream out, String subscriptionArn) throws Exception{
		SimpleHttpServletRequest request = new SimpleHttpServletRequest();
		Map<String, String[]> params = new HashMap<String, String[]>();

		addParam(params, "Action", "GetSubscriptionAttributes");
		if(subscriptionArn != null) {
			addParam(params, "SubscriptionArn", subscriptionArn);
		}

		addParam(params, "AWSAccessKeyId", user.getAccessKey());

		request.setParameterMap(params);
		((SimpleHttpServletRequest) request).setParameterMap(params);
		SimpleHttpServletResponse response = new SimpleHttpServletResponse();
		response.setOutputStream(out);

		cns.doGet(request, response);
		response.getWriter().flush();

		return out.toString();
	}

	public static String doSetSubscriptionAttributes(CNSControllerServlet cns, User user, OutputStream out, String attributeName, String attributeValue, String subscriptionArn) throws Exception{
		SimpleHttpServletRequest request = new SimpleHttpServletRequest();
		Map<String, String[]> params = new HashMap<String, String[]>();

		addParam(params, "Action", "SetSubscriptionAttributes");
		if(subscriptionArn != null) {
			addParam(params, "SubscriptionArn", subscriptionArn);
		}
		if(attributeName != null) {
			addParam(params, "AttributeName", attributeName);
		}

		if(attributeValue != null) {
			addParam(params, "AttributeValue", attributeValue);
		}

		addParam(params, "AWSAccessKeyId", user.getAccessKey());

		request.setParameterMap(params);
		((SimpleHttpServletRequest) request).setParameterMap(params);
		SimpleHttpServletResponse response = new SimpleHttpServletResponse();
		response.setOutputStream(out);

		cns.doGet(request, response);
		response.getWriter().flush();

		return out.toString();
	}

	public static String doGetTopicAttributes(CNSControllerServlet cns, User user, OutputStream out, String topicArn) throws Exception{
		SimpleHttpServletRequest request = new SimpleHttpServletRequest();
		Map<String, String[]> params = new HashMap<String, String[]>();

		addParam(params, "Action", "GetTopicAttributes");
		if(topicArn != null) {
			addParam(params, "TopicArn", topicArn);
		}

		addParam(params, "AWSAccessKeyId", user.getAccessKey());

		request.setParameterMap(params);
		((SimpleHttpServletRequest) request).setParameterMap(params);
		SimpleHttpServletResponse response = new SimpleHttpServletResponse();
		response.setOutputStream(out);

		cns.doGet(request, response);
		response.getWriter().flush();

		return out.toString();
	}

	public static String doSetTopicAttributes(CNSControllerServlet cns, User user, OutputStream out, String attributeName, String attributeValue, String topicArn) throws Exception{
		SimpleHttpServletRequest request = new SimpleHttpServletRequest();
		Map<String, String[]> params = new HashMap<String, String[]>();

		addParam(params, "Action", "SetTopicAttributes");
		if(topicArn != null) {
			addParam(params, "TopicArn", topicArn);
		}
		if(attributeName != null) {
			addParam(params, "AttributeName", attributeName);
		}

		if(attributeValue != null) {
			addParam(params, "AttributeValue", attributeValue);
		}

		addParam(params, "AWSAccessKeyId", user.getAccessKey());

		request.setParameterMap(params);
		((SimpleHttpServletRequest) request).setParameterMap(params);
		SimpleHttpServletResponse response = new SimpleHttpServletResponse();
		response.setOutputStream(out);

		cns.doGet(request, response);
		response.getWriter().flush();

		return out.toString();
	}

	/*
	 * (non-Javadoc)
	 * @see com.comcast.cns.io.IEndpointPublisher#send()
	 * We will send the message using the URL and HttpUrlConnection classes
	 */
	public static String sendHttpMessage(String endpoint, String message) throws Exception {

		if ((message == null) || (endpoint == null)) {
			throw new Exception("Message and Endpoint must both be set");
		}

		String newPostBody = message;
		byte newPostBodyBytes[] = newPostBody.getBytes();

		URL url = new URL(endpoint);

		logger.info(">> "+url.toString());

		HttpURLConnection con = (HttpURLConnection)url.openConnection();

		con.setRequestMethod("GET"); // POST no matter what
		con.setDoOutput(true);
		con.setDoInput(true);
		con.setFollowRedirects(false);
		con.setUseCaches(true);

		logger.info(">> " + "GET");

		//con.setRequestProperty("content-length", newPostBody.length() + "");
		con.setRequestProperty("host", url.getHost());

		con.connect();

		logger.info(">> " + newPostBody);

		int statusCode = con.getResponseCode();

		BufferedInputStream responseStream;

		logger.info("StatusCode:" + statusCode);

		if (statusCode != 200 && statusCode != 201) {

			responseStream = new BufferedInputStream(con.getErrorStream());
		} else {
			responseStream = new BufferedInputStream(con.getInputStream());
		}

		int b;
		String response = "";

		while ((b = responseStream.read()) != -1) {
			response += (char)b;
		}

		logger.info("response:" + response);
		return response;
	}

	public static String getBodyFromHTML(String response) {
		int beginLoc = response.indexOf("<body>");
		int endLoc = response.indexOf("</body>");
		if(beginLoc != -1)
			return response.substring(beginLoc + 6, endLoc).trim();
		else
			return null;
	}

	/*
	 * Generate the Json string with the message in token
	 * @param message The message you want to encode
	 * @return the Json String
	 */
	public static String generateMessageJson(String message) {

		ByteArrayOutputStream out = new ByteArrayOutputStream();
		Writer writer = new PrintWriter(out);
		JSONWriter jw = new JSONWriter(writer);

		try {
			jw = jw.object();
			jw.key("Token").value(message);
			jw.endObject();
			writer.flush();

		} catch(Exception e) {
			return "";
		}
		return out.toString();
	}

	/**
	 * Generate the Json string for sending different messages to different endpoitns
	 * @param emailMessage  The message to send to the email endpoints
	 * @param emailJson   The message to send to the email-json endpoints
	 * @param defaultMessage   The default message to send to the endpoints if there is no other specified
	 * @param httpMessage   The message to send to the http endpoints
	 * @param httpsMessage   The message to send to the https endpoints
	 * @param cqsMessage   The message to send to the cqs endpoints
	 * @return the JSON string to send to the publish method
	 */
	public static String generateMultiendpointMessageJson(String emailMessage, String emailJson, String defaultMessage, String httpMessage, String httpsMessage, String cqsMessage) {

		ByteArrayOutputStream out = new ByteArrayOutputStream();
		Writer writer = new PrintWriter(out);
		JSONWriter jw = new JSONWriter(writer);

		try {
			jw = jw.object();
			if(defaultMessage != null) {
				jw.key("default").value(defaultMessage);
			}
			if(emailMessage != null) {
				jw.key("email").value(emailMessage);
			}
			if(emailJson != null) {
				jw.key("email-json").value(emailJson);
			}
			if(httpMessage != null) {
				jw.key("http").value(httpMessage);
			}
			if(httpsMessage != null) {
				jw.key("https").value(httpsMessage);
			}
			if(cqsMessage != null) {
				jw.key("cqs").value(cqsMessage);
			}
			jw.endObject();
			writer.flush();

		} catch(Exception e) {
			return "";
		}
		return out.toString();
	}
}


text:
import { GenericBrowserDomAdapter } from './generic_browser_adapter';
/**
 * A `DomAdapter` powered by full browser DOM APIs.
 *
 * @security Tread carefully! Interacting with the DOM directly is dangerous and
 * can introduce XSS risks.
 */
export declare class BrowserDomAdapter extends GenericBrowserDomAdapter {
    parse(templateHtml: string): void;
    static makeCurrent(): void;
    hasProperty(element: Node, name: string): boolean;
    setProperty(el: Node, name: string, value: any): void;
    getProperty(el: Node, name: string): any;
    invoke(el: Node, methodName: string, args: any[]): any;
    logError(error: string): void;
    log(error: string): void;
    logGroup(error: string): void;
    logGroupEnd(): void;
    readonly attrToPropMap: any;
    contains(nodeA: any, nodeB: any): boolean;
    querySelector(el: Element, selector: string): any;
    querySelectorAll(el: any, selector: string): any[];
    on(el: Node, evt: any, listener: any): void;
    onAndCancel(el: Node, evt: any, listener: any): Function;
    dispatchEvent(el: Node, evt: any): void;
    createMouseEvent(eventType: string): MouseEvent;
    createEvent(eventType: any): Event;
    preventDefault(evt: Event): void;
    isPrevented(evt: Event): boolean;
    getInnerHTML(el: HTMLElement): string;
    getTemplateContent(el: Node): Node | null;
    getOuterHTML(el: HTMLElement): string;
    nodeName(node: Node): string;
    nodeValue(node: Node): string | null;
    type(node: HTMLInputElement): string;
    content(node: Node): Node;
    firstChild(el: Node): Node | null;
    nextSibling(el: Node): Node | null;
    parentElement(el: Node): Node | null;
    childNodes(el: any): Node[];
    childNodesAsList(el: Node): any[];
    clearNodes(el: Node): void;
    appendChild(el: Node, node: Node): void;
    removeChild(el: Node, node: Node): void;
    replaceChild(el: Node, newChild: Node, oldChild: Node): void;
    remove(node: Node): Node;
    insertBefore(parent: Node, ref: Node, node: Node): void;
    insertAllBefore(parent: Node, ref: Node, nodes: Node[]): void;
    insertAfter(parent: Node, ref: Node, node: any): void;
    setInnerHTML(el: Element, value: string): void;
    getText(el: Node): string | null;
    setText(el: Node, value: string): void;
    getValue(el: any): string;
    setValue(el: any, value: string): void;
    getChecked(el: any): boolean;
    setChecked(el: any, value: boolean): void;
    createComment(text: string): Comment;
    createTemplate(html: any): HTMLElement;
    createElement(tagName: string, doc?: Document): HTMLElement;
    createElementNS(ns: string, tagName: string, doc?: Document): Element;
    createTextNode(text: string, doc?: Document): Text;
    createScriptTag(attrName: string, attrValue: string, doc?: Document): HTMLScriptElement;
    createStyleElement(css: string, doc?: Document): HTMLStyleElement;
    createShadowRoot(el: HTMLElement): DocumentFragment;
    getShadowRoot(el: HTMLElement): DocumentFragment;
    getHost(el: HTMLElement): HTMLElement;
    clone(node: Node): Node;
    getElementsByClassName(element: any, name: string): HTMLElement[];
    getElementsByTagName(element: any, name: string): HTMLElement[];
    classList(element: any): any[];
    addClass(element: any, className: string): void;
    removeClass(element: any, className: string): void;
    hasClass(element: any, className: string): boolean;
    setStyle(element: any, styleName: string, styleValue: string): void;
    removeStyle(element: any, stylename: string): void;
    getStyle(element: any, stylename: string): string;
    hasStyle(element: any, styleName: string, styleValue?: string | null): boolean;
    tagName(element: any): string;
    attributeMap(element: any): Map<string, string>;
    hasAttribute(element: Element, attribute: string): boolean;
    hasAttributeNS(element: Element, ns: string, attribute: string): boolean;
    getAttribute(element: Element, attribute: string): string | null;
    getAttributeNS(element: Element, ns: string, name: string): string;
    setAttribute(element: Element, name: string, value: string): void;
    setAttributeNS(element: Element, ns: string, name: string, value: string): void;
    removeAttribute(element: Element, attribute: string): void;
    removeAttributeNS(element: Element, ns: string, name: string): void;
    templateAwareRoot(el: Node): any;
    createHtmlDocument(): HTMLDocument;
    getDefaultDocument(): Document;
    getBoundingClientRect(el: Element): any;
    getTitle(doc: Document): string;
    setTitle(doc: Document, newTitle: string): void;
    elementMatches(n: any, selector: string): boolean;
    isTemplateElement(el: Node): boolean;
    isTextNode(node: Node): boolean;
    isCommentNode(node: Node): boolean;
    isElementNode(node: Node): boolean;
    hasShadowRoot(node: any): boolean;
    isShadowRoot(node: any): boolean;
    importIntoDoc(node: Node): any;
    adoptNode(node: Node): any;
    getHref(el: Element): string;
    getEventKey(event: any): string;
    getGlobalEventTarget(doc: Document, target: string): EventTarget | null;
    getHistory(): History;
    getLocation(): Location;
    getBaseHref(doc: Document): string | null;
    resetBaseElement(): void;
    getUserAgent(): string;
    setData(element: Element, name: string, value: string): void;
    getData(element: Element, name: string): string | null;
    getComputedStyle(element: any): any;
    supportsWebAnimation(): boolean;
    performanceNow(): number;
    supportsCookies(): boolean;
    getCookie(name: string): string | null;
    setCookie(name: string, value: string): void;
}


text:
namespace uth
{
	namespace Origin
	{
		enum Point
		{
			BottomLeft = 1,
			BottomCenter,
			BottomRight,
			MidLeft,
			Center,
			MidRight,
			TopLeft,
			TopCenter,
			TopRight
		};
	}

	class Transform : public Component
	{
	public:
		Transform(const std::string& name = "Transform");
		~Transform();

		void Move(const umath::vector2& offset);
		void Move(const float offsetX, const float offsetY);

		void SetPosition(const umath::vector2& position);
		void SetPosition(const float posX, const float posY);
		const umath::vector2& GetPosition() const;

		void SetSize(const umath::vector2& size);
		void SetSize(const float width, const float height);
		const umath::vector2& GetSize() const;

		void SetOrigin(const umath::vector2& origin);
		void SetOrigin(const int originPoint = Origin::Point::Center);
		const umath::vector2& GetOrigin() const;

		void SetScale(const umath::vector2& scale);
		void SetScale(const float xScale, const float yScale);
		void SetScale(const float scale);
		const umath::vector2& GetScale() const;

		void SetRotation(const float degrees);
		const float GetRotation() const;
		void Rotate(const float degrees);

		void SetDepth(const float depth);
		const float GetDepth() const;

		void SetTransform(const umath::matrix4& modelTransform);
		// Adds to the current transform(multiplies). Mostly needed for layer transformation
		void AddTransform(const umath::matrix4& modelTransform);
		const umath::matrix4& GetTransform();

		umath::vector2 position;
		umath::vector2 size;
		umath::vector2 scale;
		umath::vector2 origin;
		float angle;
		float depth;

	private:
		void updateTransform();

		umath::matrix4 m_modelTransform;
		bool m_transformNeedsUpdate;
	};
}

#endif


text:
NS_ASSUME_NONNULL_BEGIN

@implementation NSData (ASTCore)

- (nullable NSString *)utf8String {
    return [[NSString alloc] initWithData:self encoding:NSUTF8StringEncoding];
}

+ (nullable NSData *)dataNamed:(NSString *)name {
    NSString *path = [[NSBundle mainBundle] pathForResource:name ofType:@""];
    if (!path) return nil;
    NSData *data = [NSData dataWithContentsOfFile:path];
    return data;
}

@end

NS_ASSUME_NONNULL_END