text:
//
// YMLoginClient.m
//
// Copyright (c) 2015 Microsoft
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//

#import "YMLoginClient.h"
#import <SSKeychain/SSKeychain.h>
#import "YMAPIClient.h"
#import "NSURL+YMQueryParameters.h"
#import "YMLoginViewController.h"
#import "YMLoginViewController+Internal.h"

NSString * const YMMobileSafariString = @"com.apple.mobilesafari";
NSString * const YMYammerSDKErrorDomain = @"com.yammer.YammerSDK.ErrorDomain";

const NSInteger YMYammerSDKLoginAuthenticationError = 1001;
const NSInteger YMYammerSDKLoginObtainAuthTokenError = 1002;
const NSInteger YMYammerSDKLoginObtainNetworkTokensError = 1003;

NSString * const YMYammerSDKLoginDidCompleteNotification = @"YMYammerSDKLoginDidCompleteNotification";
NSString * const YMYammerSDKLoginDidFailNotification = @"YMYammerSDKLoginDidFailNotification";

NSString * const YMYammerSDKAuthTokenUserInfoKey = @"YMYammerSDKAuthTokenUserInfoKey";
NSString * const YMYammerSDKErrorUserInfoKey  = @"YMYammerSDKErrorUserInfoKey";

NSString * const YMKeychainAuthTokenKey = @"yammerAuthToken";
NSString * const YMKeychainStateKey = @"yammerState";

@interface YMLoginClient ()<YMLoginViewControllerDelegate>

@property (nonatomic, strong) YMAPIClient *client;
@property (nonatomic, strong) YMAPIClient *tokensClient;
@property (nonatomic, strong) NSCache *tokenCache;

@end

@implementation YMLoginClient

+ (YMLoginClient *)sharedInstance
{
    static YMLoginClient *_sharedInstance;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        _sharedInstance = [[self alloc] init];
    });

    return _sharedInstance;
}

- (instancetype)init
{
    self = [super init];
    if (self) {
        _client = [[YMAPIClient alloc] init];
        _tokensClient = [[YMAPIClient alloc] init];
        _tokenCache = [[NSCache alloc] init];
    }
    return self;
}

/**
 Attempt to login using mobile browser
 */
- (void)startLoginWithContextViewController:(UIViewController *)viewController
{
    NSAssert(self.appClientID, @"App client ID cannot be nil");
    NSAssert(self.appClientSecret, @"App client secret cannot be nil");
    NSAssert(self.authRedirectURI, @"Redirect URI cannot be nil");
    NSAssert(viewController, @"Context view controller cannot be nil");

    NSString *stateParam = [self uniqueIdentifier];
    [SSKeychain setPassword:stateParam forService:[self serviceName] account:YMKeychainStateKey];

    NSDictionary *params = @{@"client_id"       : self.appClientID,
                             @"redirect_uri"    : self.authRedirectURI,
                             @"state"           : stateParam};

    NSString *baseUrlString = [NSString stringWithFormat:@"%@/dialog/oauth", YMBaseURL];
    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:baseUrlString]];

    AFHTTPRequestSerializer * requestSerializer = [[AFHTTPRequestSerializer alloc] init];
    NSError *error;
    NSURLRequest *serializedRequest = [requestSerializer requestBySerializingRequest:request withParameters:params error:&error];

    if (error) {
        NSLog(@"Failed to serialize request: %@", error);
    }

    if (viewController) {
        YMLoginViewController *loginViewController = [[YMLoginViewController alloc] initWithRequest:serializedRequest];
        loginViewController.delegate = self;

        UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:loginViewController];

        [viewController presentViewController:navigationController animated:YES completion:nil];
    }
}

- (NSString *)uniqueIdentifier
{
    return [[NSUUID UUID] UUIDString];
}

/**
 Get the Oauth token from the server using the code, client ID and client secret
 */
- (void)obtainAuthTokenForCode:(NSString *)code
{
    // Query params
    NSDictionary *params = @{@"client_id"       : self.appClientID,
                             @"client_secret"   : self.appClientSecret,
                             @"code"            : code};

    __weak typeof(self) weakSelf = self;

    [self.client postPath:@"/oauth2/access_token.json"
               parameters:params
                  success:^(id responseObject) {
                      NSDictionary *jsonDict = (NSDictionary *) responseObject;
                      NSDictionary *accessToken = jsonDict[@"access_token"];
                      NSString *authToken = accessToken[@"token"];

                      // Save the authToken in the KeyChain
                      [weakSelf storeAuthTokenInKeychain:authToken withTokenKey:YMKeychainAuthTokenKey];

                      // Retrieve all network tokens
                      [self retrieveAllNetworkTokensWithToken:authToken completion:^(NSError *error) {
                          if (!error) {
                              [weakSelf.delegate loginClient:weakSelf didCompleteWithAuthToken:authToken];
                              [[NSNotificationCenter defaultCenter] postNotificationName:YMYammerSDKLoginDidCompleteNotification
                                                                                object:weakSelf
                                                                                userInfo:@{YMYammerSDKAuthTokenUserInfoKey: authToken}];
                          } else {
                              [self clearAuthTokens];

                              [weakSelf.delegate loginClient:weakSelf didFailWithError:error];
                              [[NSNotificationCenter defaultCenter] postNotificationName:YMYammerSDKLoginDidFailNotification
                                                                                object:weakSelf
                                                                                userInfo:@{YMYammerSDKErrorUserInfoKey: error}];
                          }
                      }];
                  }
                  failure:^(NSInteger statusCode, NSError *error) {
                      NSMutableDictionary *userInfo = [@{NSLocalizedDescriptionKey: @"Unable to retrieve authentication token from code"} mutableCopy];

                      if (error) {
                          userInfo[NSUnderlyingErrorKey] = error;
                          userInfo[NSLocalizedFailureReasonErrorKey] = [error localizedDescription];
                      }

                      NSError *newError = [NSError errorWithDomain:YMYammerSDKErrorDomain
                                                              code:YMYammerSDKLoginObtainAuthTokenError
                                                          userInfo:userInfo];

                      [weakSelf.delegate loginClient:weakSelf didFailWithError:newError];
                      [[NSNotificationCenter defaultCenter] postNotificationName:YMYammerSDKLoginDidFailNotification
                                                                          object:weakSelf
                                                                        userInfo:@{YMYammerSDKErrorUserInfoKey: newError}];
                  }
     ];
}

- (void)refreshNetworkTokensWithCompletion:(void (^)(NSError *error))completion
{
    [self retrieveAllNetworkTokensWithToken:[self storedAuthToken] completion:completion];
}

- (void)retrieveAllNetworkTokensWithToken:(NSString *)authToken completion:(void (^)(NSError *error))completion
{
    if (authToken) {
        self.tokensClient.authToken = authToken;

        [self.tokensClient getPath:@"/api/v1/oauth/tokens.json"
                        parameters:nil
                           success:^(id responseObject) {
                               for (NSDictionary *networks in responseObject) {
                                   [self storeAuthTokenInKeychain:networks[@"token"] withTokenKey:networks[@"network_permalink"]];
                               }
                               completion(nil);
                           }
                           failure:^(NSError *error) {
                               NSLog(@"An error occurred loading network tokens!");
                               completion(error);
                           }
         ];
    } else {
        NSError *error = [[NSError alloc] initWithDomain:YMYammerSDKErrorDomain
                                                    code:YMYammerSDKLoginObtainNetworkTokensError
                                                userInfo:@{NSLocalizedDescriptionKey : @"Auth token does not exist."}];
        completion(error);
    }
}

- (void)clearAuthTokens
{
    [self.tokenCache removeAllObjects];

    NSArray *accounts = [SSKeychain accountsForService:[self serviceName]];

    for (NSDictionary *accountDictionary in accounts) {
        [SSKeychain deletePasswordForService:[self serviceName]
                                     account:accountDictionary[kSSKeychainAccountKey]];
    }
}

- (void)storeAuthTokenInKeychain:(NSString *)authToken withTokenKey:(NSString *)tokenKey
{
    if (!authToken || !tokenKey) {
        return;
    }

    [self.tokenCache setObject:authToken forKey:tokenKey];

    [SSKeychain setPassword:authToken forService:[self serviceName] account:tokenKey];
}

- (NSString *)storedAuthToken
{
    return [self retrieveAuthTokenForKey:YMKeychainAuthTokenKey];
}

- (NSString *)storedAuthTokenForNetworkPermalink:(NSString *)networkPermalink
{
    return [self retrieveAuthTokenForKey:networkPermalink];
}

- (NSString *)retrieveAuthTokenForKey:(NSString *)tokenKey
{
    if (!tokenKey) {
        return nil;
    }

    NSString *authToken = [self.tokenCache objectForKey:tokenKey];
    if (authToken) {
        return authToken;
    }

    authToken = [SSKeychain passwordForService:[self serviceName] account:tokenKey];
    if (authToken) {
        [self.tokenCache setObject:authToken forKey:tokenKey];
    }

    return authToken;
}

- (NSString *)serviceName
{
    return [[NSBundle mainBundle] bundleIdentifier];
}

#pragma mark - Login view controller delegate

- (void)loginViewController:(YMLoginViewController *)loginViewController didObtainCode:(NSString *)code state:(NSString *)state
{
    [loginViewController dismissViewControllerAnimated:YES completion:nil];

    NSString *storedState = [SSKeychain passwordForService:[self serviceName] account:YMKeychainStateKey];
    if ([state isEqualToString:storedState]) {
        [SSKeychain deletePasswordForService:[self serviceName] account:YMKeychainStateKey];

        [self obtainAuthTokenForCode:code];
    }
}

- (void)loginViewController:(YMLoginViewController *)loginViewController didFailWithError:(NSError *)error
{
    [self.delegate loginClient:self didFailWithError:error];

    [[NSNotificationCenter defaultCenter] postNotificationName:YMYammerSDKLoginDidFailNotification object:self userInfo:@{YMYammerSDKErrorUserInfoKey: error}];
}

@end


text:
package hub

import (
	"github.com/utrack/go-simple-chat/message"

	"errors"
	. "github.com/smartystreets/goconvey/convey"
	"testing"
	"time"
)

// mock of client.Client.
type clientMock struct {
	// messages from the hub
	acceptedMsgs chan message.One
	// discon chan, returned to the Session
	discChan chan error
	// msgChan, messages rcvd by the client
	msgChan chan message.One
}

func (c *clientMock) Send(m message.One) error {
	c.acceptedMsgs <- m
	return nil
}

func (c *clientMock) DisconChan() <-chan error {
	return c.discChan
}

func (c *clientMock) MsgChan() <-chan message.One {
	return c.msgChan
}

func (c *clientMock) Disconnect() {

}

func newClientMock() *clientMock {
	return &clientMock{
		acceptedMsgs: make(chan message.One, 30),
		discChan:     make(chan error, 5),
		msgChan:      make(chan message.One, 30),
	}

}

func TestSession(t *testing.T) {
	Convey("With setup", t, func() {
		// mock hub's channels
		msgChan := make(chan message.One, 30)
		disconChan := make(chan disconMsg, 30)

		// Mock client
		c := newClientMock()

		name := `SomeName`
		// Session to test
		sess := newSession(c, name, msgChan, disconChan)
		go sess.runPump()

		Convey("Should relay messages to the hub", func() {
			msg := message.One{Type: message.EventMessage, IsMuted: true, From: "foobar", Text: "hello world"}
			c.msgChan <- msg

			var got message.One

			select {
			case got = <-msgChan:
			case <-time.After(time.Second):
				So(0, ShouldEqual, "Hub didn't receive the message!")
			}

			Convey("Should block bad/unknown EventTypes", func() {
				for i := 0; i < 10; i++ {
					if i == message.EventMessage || i == message.EventPresenceState {
						continue
					}

					msg := message.One{Type: message.EventType(i), IsMuted: true, From: "foobar", Text: "hello world"}
					c.msgChan <- msg

					var got message.One
					select {
					case got = <-msgChan:
						So(got, ShouldEqual, "Hub shouldn't receive the message!")
					case <-time.After(time.Millisecond * 200):
					}
				}
			})
			Convey("Message's data should be equal to the sent one", func() {
				So(got.Text, ShouldEqual, msg.Text)
				So(got.IsMuted, ShouldEqual, msg.IsMuted)
				So(got.Type, ShouldEqual, msg.Type)
			})
			Convey("Name should be changed to the session's name", func() {
				So(got.From, ShouldEqual, name)
				So(got.From, ShouldNotEqual, msg.From)
			})

		})

		Convey("Should relay messages from the hub", func() {
			msg := message.One{From: "fromfield", Type: message.EventPresenceState, IsMuted: true, Text: "qwww"}
			err := sess.send(msg)

			So(err, ShouldBeNil)
			var got message.One
			select {
			case got = <-c.acceptedMsgs:
			case <-time.After(time.Second):
				So(0, ShouldEqual, "Client didn't receive the message!")
			}
			So(got, ShouldResemble, msg)
		})

		Convey("On disconnection", func() {
			reason := errors.New("Spite")
			c.discChan <- reason

			Convey("Should create EventLeave", func() {
				var got message.One
				select {
				case got = <-msgChan:
				case <-time.After(time.Second):
					So(0, ShouldEqual, "Hub didn't received EventLeave!")
				}

				So(got.Type, ShouldEqual, message.EventLeave)
				So(got.From, ShouldEqual, name)
				So(got.Text, ShouldEqual, reason.Error())
			})

			Convey("Should notify the hub", func() {
				var got disconMsg
				select {
				case got = <-disconChan:
				case <-time.After(time.Second):
					So(0, ShouldEqual, "Hub didn't receive disconMsg!")
				}
				So(got.reason, ShouldEqual, reason.Error())
				So(got.name, ShouldEqual, name)
			})
		})
	})
}

redpajama_set_name: RedPajamaGithub


text:
<?php

/**
 * This is the model class for table "wallpaper".
 *
 * The followings are the available columns in table 'wallpaper':
 * @property string $id
 * @property string $title
 * @property string $thumbnail_url
 * @property string $created_time
 * @property string $width_160
 * @property string $height_160
 * @property string $small_thumbnail_url
 * @property string $width_320
 * @property string $height_320
 * @property string $category_id
 */
class Wallpaper extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Wallpaper the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'wallpaper';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('title, thumbnail_url, created_time, small_thumbnail_url', 'required'),
			array('title, thumbnail_url, small_thumbnail_url, category_id', 'length', 'max'=>255),
			array('width_160, height_160, width_320, height_320', 'length', 'max'=>10),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, title, thumbnail_url, created_time, category_id, width_160, height_160, small_thumbnail_url, width_320, height_320', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'title' => 'Title',
			'thumbnail_url' => 'Thumbnail Url',
			'created_time' => 'Created Time',
			'width_160' => 'Width 160',
			'height_160' => 'Height 160',
			'small_thumbnail_url' => 'Small Thumbnail Url',
			'width_320' => 'Width 320',
			'height_320' => 'Height 320',
			'category_id' => 'Height 320',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id,true);
		$criteria->compare('title',$this->title,true);
		$criteria->compare('thumbnail_url',$this->thumbnail_url,true);
		$criteria->compare('created_time',$this->created_time,true);
		$criteria->compare('width_160',$this->width_160,true);
		$criteria->compare('height_160',$this->height_160,true);
		$criteria->compare('small_thumbnail_url',$this->small_thumbnail_url,true);
		$criteria->compare('category_id',$this->category_id,true);
		$criteria->compare('width_320',$this->width_320,true);
		$criteria->compare('height_320',$this->height_320,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}

	public function getAll($page, $limit) {
        $offset = ($page - 1) * $limit;
		$data = Yii::app()->db->createCommand("SELECT * FROM wallpaper ORDER BY created_time DESC, rand() LIMIT $offset, $limit")->queryAll();

		return $data;
	}
}


text: serer side vs client rendering


text:
>##План работы:

1.	Постановка задачи. Создание схемы ключевых моментов и возможностей будущего приложения.
2.	Построение требования к дизайну приложения.
	- Выбор css+js фреймворка.
	- Создание прототипов страниц.
	- Верстка основных страниц приложения.
3.  Создание каркаса приложения и базовых классов по существующим схемам и согласно требованиям.
4.  Написание Unit тестов для каркаса приложения.
5.  Выбор ORM.
6.  Создание базового функционала.
	- Аутентификация.
	- Регистрация.
	- Реализация ACL (access control list) или разделение пользователей на роли и уровни доступа.
7.   Создание CRUD (create update read delete) интерфейса для записей пользователя. Реализация архитектуры SOA(Service-oriented Architecture)
8.   Написание  Unit тестов для сервисов приложения.
9.   Прототипирование админ-интерфейса.
10.  Реализация простейшей "админки"
11.  Написание  Unit тестов для административного функционала.
12.  Построение требований и правил для NotePages API.
13.  Построение простейшего RESTful API.
14.  Написание  Unit тестов для API.


text:
#ifndef WORKSPACE_H
#define WORKSPACE_H

#include <X11/Xlib.h>
#include <Imlib2.h>

#ifdef HAS_SYS_TIME_H
#include <sys/time.h>
#endif

#include "wm.h"
#include "icon.h"

/**
@author Suhanov Vadim
*/
class Workspace {
    int    m_icon_x, m_icon_y;
    int    m_icon_actual_width, m_icon_actual_height;
    Icon   m_icon;
    struct timeval m_tv;

public:
    Workspace();
    ~Workspace();
    void freeIcon();

    // position
    int  getIconX(){ return m_icon_x;   }
    int  getIconY(){ return m_icon_y;   }
    void setIconX(int x){ m_icon_x = x; }
    void setIconY(int y){ m_icon_y = y; }

    // size
    int  getIconWidth(){  return m_icon.width;     }
    int  getIconHeight(){ return m_icon.height;    }
    void setIconWidth(int w){  m_icon.width = w;   }
    void setIconHeight(int h){ m_icon.height = h;  }

    // actual size
    int  getIconActualWidth(){  return m_icon_actual_width;    }
    int  getIconActualHeight(){ return m_icon_actual_height;   }
    void setIconActualWidth(int w) { m_icon_actual_width = w;  }
    void setIconActualHeight(int h){ m_icon_actual_height = h; }

    bool isIconOld();

    Imlib_Image getIconImage(){ return m_icon.image; }
    void setIcon(Icon&);
    WindowList wl;
};

#endif


text:
package org.locationtech.geowave.cli.osm.osmfeature.types.features;

public enum FeatureType {
  Polygon, LineString, Point, Geometry
}


text:
package com.intel.analytics.bigdl.ppml.fl.base

import com.intel.analytics.bigdl.ppml.fl.common.{FLDataType, FLPhase, Storage}
import com.intel.analytics.bigdl.ppml.fl.generated.FGBoostServiceProto._
import com.intel.analytics.bigdl.ppml.fl.generated.FlBaseProto.TensorMap
import org.apache.logging.log4j.LogManager

/**
 * The storage holder holding all types of Storage
 * Aggregator could use this generic holder type to aggregate
 * @param flDataType the instance of storage of this holder, could be one of [[FLDataType]]
 */
class StorageHolder(flDataType: FLDataType) {
  private val logger = LogManager.getLogger(getClass)

  private var clientDataSize: Int = 0
  private var tensorMapStorage: Storage[TensorMap] = null
  private var treeSplitStorage: Storage[DataSplit] = null
  private var treeLeafStorage: Storage[TreeLeaf] = null
  private var treeEvalStorage: Storage[java.util.List[BoostEval]] = null

  flDataType match {
    case FLDataType.TENSOR_MAP => tensorMapStorage = new Storage[TensorMap](flDataType.toString)
    case FLDataType.TREE_SPLIT => treeSplitStorage = new Storage[DataSplit](flDataType.toString)
    case FLDataType.TREE_LEAF => treeLeafStorage = new Storage[TreeLeaf](flDataType.toString)
    case FLDataType.TREE_EVAL => treeEvalStorage =
      new Storage[java.util.List[BoostEval]](flDataType.toString)
    case _ => throw new NotImplementedError()
  }
  def getVersion(): Int = {
    if (tensorMapStorage != null) tensorMapStorage.version
    else if (treeSplitStorage != null) treeSplitStorage.version
    else if (treeLeafStorage != null) treeLeafStorage.version
    else if (treeEvalStorage != null) treeEvalStorage.version
    else throw new NotImplementedError()
  }

  def getClientDataSize(): Int = this.clientDataSize

  def putClientData(clientID: Int, dataHolder: DataHolder): Unit = {
    if (dataHolder.tensorMap != null) {
      tensorMapStorage.clientData.put(clientID, dataHolder.tensorMap)
      clientDataSize = tensorMapStorage.clientData.size()
    } else if (dataHolder.split != null) {
      treeSplitStorage.clientData.put(clientID, dataHolder.split)
      clientDataSize = treeSplitStorage.clientData.size()
    } else if (dataHolder.treeLeaf != null) {
      treeLeafStorage.clientData.put(clientID, dataHolder.treeLeaf)
      clientDataSize = treeLeafStorage.clientData.size()
    } else if (dataHolder.boostEval != null) {
      treeEvalStorage.clientData.put(clientID, dataHolder.boostEval)
      clientDataSize = treeEvalStorage.clientData.size()
    } else {
      throw new IllegalArgumentException("Data is empty, could not uploaded to server.")
    }
  }
  def getTensorMapStorage(): Storage[TensorMap] = this.tensorMapStorage
  def getSplitStorage(): Storage[DataSplit] = this.treeSplitStorage
  def getLeafStorage(): Storage[TreeLeaf] = this.treeLeafStorage
  def getTreeEvalStorage(): Storage[java.util.List[BoostEval]] = this.treeEvalStorage
}


text:
module HtmlPress
  class Html

    DEFAULTS = {
      :logger => false,
      :unquoted_attributes => false,
      :drop_empty_values => false,
      :strip_crlf => false,
      :js_minifier_options => false
    }

    def initialize (options = {})
      @options = DEFAULTS.merge(options)
      if @options.keys.include? :dump_empty_values
        @options[:drop_empty_values] = @options.delete(:dump_empty_values)
        warn "dump_empty_values deprecated use drop_empty_values"
      end
      if @options[:logger] && !@options[:logger].respond_to?(:error)
        raise ArgumentError, 'Logger has no error method'
      end
    end

    def press (html)
      out = html.respond_to?(:read) ? html.read : html.dup

      @replacement_hash = 'MINIFYHTML' + Time.now.to_i.to_s
      @placeholders = []

      out = process_ie_conditional_comments out
      out = process_scripts out
      out = process_styles out
      out = process_html_comments out
      out = process_pres out

      out = HtmlPress.entities_compressor out

      out = trim_lines out
      out = process_block_elements out
      out = process_textareas out

      # use newlines before 1st attribute in open tags (to limit line lengths)
      # out.gsub!(/(<[a-z\-:]+)\s+([^>]+>)/i, "\\1\n\\2")

      out = process_attributes out
      out = process_whitespaces out
      out = fill_placeholders out

      out
    end

    # for backward compatibility
    alias :compile :press

    protected

    # IE conditional comments
    def process_ie_conditional_comments (out)
      out.gsub /(<!--\[[^\]]+\]>([\s\S]*?)<!\[[^\]]+\]-->)\s*/ do
        m = $1
        comment = $2
        comment_compressed = Html.new.press(comment)
        m.gsub!(comment, comment_compressed)
        reserve m
      end
    end

    # replace SCRIPTs (and minify) with placeholders
    def process_scripts (out)
      out.gsub /(<script\b[^>]*?>([\s\S]*?)<\/script>)\s*/i do
        js = $2
        m = $1.gsub /^<script\s([^>]+)>/i do |m|
          attrs(m, 'script', true)
        end
        begin
          js_compressed = HtmlPress.js_compressor js, @options[:js_minifier_options]
          m.gsub!(">#{js}<\/script>", ">#{js_compressed}<\/script>")
        rescue MultiJs::ParseError => e
          log e.message
        end
        reserve m
      end
    end

    # replace STYLEs (and minify) with placeholders
    def process_styles (out)
      out.gsub /(<style\b[^>]*?>([\s\S]*?)<\/style>)\s*/i do
        css = $2
        m = $1.gsub /^<style\s([^>]+)>/i do |m|
          attrs(m, 'style', true)
        end
        begin
          css_compressed = MultiCss.min css
          m.gsub!(css, css_compressed)
        rescue Exception => e
          log e.message
        end
        reserve m
      end
    end

    # remove html comments (not IE conditional comments)
    def process_html_comments (out)
      out.gsub /<!--([\s\S]*?)-->/, ''
    end

    # replace PREs with placeholders
    def process_pres (out)
      out.gsub /(<pre\b[^>]*?>([\s\S]*?)<\/pre>)\s*/i do
        pre = $2
        m = $1
        pre_compressed = pre.lines.map{ |l| l.gsub(/\s+$/, '') }.join("\n")
        pre_compressed = HtmlPress.entities_compressor pre_compressed
        m.gsub!(pre, pre_compressed)
        reserve m
      end
    end

    # trim each line
    def trim_lines (out)
      out.gsub(/^\s+|\s+$/m, '')
    end

    # remove whitespaces outside of block elements
    def process_block_elements (out)
      re = '\\s+(<\\/?(?:area|base(?:font)?|blockquote|body' +
        '|caption|center|cite|col(?:group)?|dd|dir|div|dl|dt|fieldset|form' +
        '|frame(?:set)?|h[1-6]|head|hr|html|legend|li|link|map|menu|meta' +
        '|ol|opt(?:group|ion)|p|param|t(?:able|body|head|d|h|r|foot|itle)' +
        '|ul)\\b[^>]*>)'

      re = Regexp.new(re)
      out.gsub!(re, '\\1')

      # remove whitespaces outside of all elements
      out.gsub! />([^<]+)</ do |m|
        m.gsub(/^\s+|\s+$/, ' ')
      end

      out
    end

    # replace TEXTAREAs with placeholders
    def process_textareas (out)
      out.gsub /(<textarea\b[^>]*?>[\s\S]*?<\/textarea>)\s*/i do |m|
        reserve m
      end
    end

    # attributes
    def process_attributes (out)
      out.gsub /<[a-z\-:]+\s([^>]+)>/i do |m|
        reserve attrs(m, '[a-z\-:]+', true)
      end
    end

    # replace two or more whitespaces with one
    def process_whitespaces (out)
      out.gsub!(/[\r\n]+/, @options[:strip_crlf] ? ' ' : "\n")
      out.gsub!(/\s+/, ' ')
      out
    end

    # fill placeholders
    def fill_placeholders (out)
      re = Regexp.new('%' + @replacement_hash + '%(\d+)%')
      out.gsub re do |m|
        m.gsub!(re, "\\1")
        @placeholders[m.to_i]
      end
    end

    def log (text)
      @options[:logger].error text if @options[:logger]
    end

    def reserve (content)
      @placeholders.push content
      '%' + @replacement_hash + '%' + (@placeholders.size - 1).to_s + '%'
    end

    def attrs (m, tag_name, r)
      re = "<(" + tag_name + ")(\s[^>]+)?>"
      re = Regexp.new(re, true)
      attributes = m.gsub(re, "\\2")
      if r
        tag = m.gsub(re, "\\1")
      else
        tag = tag_name
      end

      if attributes.size > 0
        attributes_compressed = attributes.gsub(/([a-z\-_:]+(="[^"]*")?(='[^']*')?)\s*/i, " \\1")

        attributes_compressed.gsub! /([a-z\-_:]+="[^"]*")/i do |k|
          attr k, "\"", tag
        end

        attributes_compressed.gsub! /([a-z\-_:]+='[^']*')/i do |k|
          attr k, "'", tag
        end

        attributes_compressed = " " + attributes_compressed.strip

        if attributes_compressed == " /"
          attributes_compressed = "/"
        elsif attributes_compressed == " "
          attributes_compressed = ""
        end
        m.gsub(attributes, attributes_compressed)
      else
        m
      end
    end

    def attr(attribute, delimiter, tag)
      re = "([a-z\\-_:]+)(=" + delimiter + "[^" + delimiter + "]*" + delimiter + ")?"
      re = Regexp.new re, true
      value_original = attribute.gsub(re, "\\2")
      value = value_original.downcase
      name_original = attribute.gsub(re, "\\1")
      name = name_original.downcase
      tag_name = tag.downcase

      if value.size > 0
        re = "^=" + delimiter + "|" + delimiter + "$"
        re = Regexp.new re
        value_original.gsub!(re, "")
      end

      case tag_name
      when "script"
        if (name == "type" && value_original == "text/javascript") || (name == "language" && value_original == "JavaScript")
          return ""
        elsif name == "async" || name == "defer"
          return name_original
        end
      when "form"
        if name == "method" && value_original == "get"
          return ""
        end
      when /link|style/
        if name == "type" && value_original == "text/stylesheet"
          return ""
        end
      when /input|textarea|button|select|option|optgroup/
        if name == "disabled"
          return name_original
        end
        if (tag_name == "input" || tag_name == "textarea") && name == "readonly"
          return name_original
        end
        if tag_name == "option" && name == "selected"
          return name_original
        end
        if tag_name == "input"
          if name == "type" && value_original == "text"
            return ""
          end
          if name == "checked"
            return name_original
          end
          # if name == "value" && (value == "=\"\"" || value == "=''")
            # return ''
          # end
        end
      end

      if value.size > 0

        if name == "style"
          begin
            value_original = MultiCss.min_attr value_original
            # TODO what about escaped attribute values?
            if delimiter == "\""
              value_original.gsub!("\"", "'")
            else
              value_original.gsub!("'", "\"")
            end
          rescue MultiCss::ParseError => e
            log e.message
          end
        end

        if name == "class"
          value_original.gsub!(/\s+/, " ")
          value_original.gsub!(/^\s+|\s+$/, "")
        end

        events = %w[onfocus onblur onselect onchange onclick
          ondblclick onmousedown onmouseup onmouseover onmousemove
          onmouseout onkeypress onkeydown onkeyup]

        if events.include? name
          value_original.gsub! /^javascript:\s+|;$/, ''
          begin
            value_original = HtmlPress.js_compressor value_original, @options[:js_minifier_options]
            # TODO what about escaped attribute values?
            if delimiter == "\""
              value_original.gsub! "\"", "'"
            end
          rescue MultiJs::ParseError => e
            log e.message
          end
        end

        if value_original.size == 0
          #attribute without value may be dropped by IE7
          if @options[:drop_empty_values]
            attribute = name_original
          else
            attribute = name_original + "=" + delimiter + delimiter
          end
        elsif @options[:unquoted_attributes] && !(value_original =~ /[ \t\r\n\f"'`=<>]/)
          attribute = name_original + "=" + value_original
        else
          attribute = name_original + "=" + delimiter + value_original + delimiter
        end

      end

      attribute
    end

  end
end


text:
package net.violet.platform.feeds;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Collections;
import java.util.List;

import net.violet.common.utils.io.TmpFileManager.TmpFile;
import net.violet.platform.dataobjects.FeedData;
import net.violet.platform.dataobjects.FilesData;
import net.violet.platform.dataobjects.GroupData;
import net.violet.platform.dataobjects.VObjectData;
import net.violet.platform.feeds.processors.EntryProcessor;
import net.violet.platform.feeds.processors.FullTTSProcessor;
import net.violet.platform.feeds.processors.ProcessedEntry;
import net.violet.platform.feeds.processors.ProcessingException;
import net.violet.platform.feeds.senders.EntrySender;
import net.violet.platform.feeds.senders.FullSender;
import net.violet.platform.files.FilesManager;
import net.violet.platform.files.FilesManagerFactory;
import net.violet.platform.util.CCalendar;
import net.violet.platform.util.StringTools;

import org.apache.log4j.Logger;

import com.sun.syndication.feed.synd.SyndContent;
import com.sun.syndication.feed.synd.SyndContentImpl;
import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.feed.synd.SyndEntryImpl;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.feed.synd.SyndFeedImpl;
import com.sun.syndication.io.FeedException;
import com.sun.syndication.io.SyndFeedInput;
import com.sun.syndication.io.SyndFeedOutput;

/**
 * A tool class currently mainly used by the group feature to interact with the group's wall (actually a rss feed).
 */
public class FeedsManager {

	private static final int MAX_ITEMS_AMOUNT = 10;

	private static final Logger LOGGER = Logger.getLogger(FeedsManager.class);

	private static final String FEED_TYPE = "rss_2.0";
	private static final String VIOLET_LINK = "http://my.violet.net";
	private static final int DESC_MAX_LENGTH = 140;

	/**
	 * Adds an entry to the given group's feed.
	 * Optimization : this method silently adds the new entry to the feed and broadcast it to the group members (rabbit members actually)
	 * @param group
	 * @param author
	 * @param title
	 * @param content
	 * @throws IllegalArgumentException
	 * @throws FeedException
	 * @throws IOException
	 */
	public static void addEntry(GroupData group, VObjectData author, String title, String content) throws IllegalArgumentException, FeedException, IOException {

		final SyndFeed theFeed = new SyndFeedInput().build(FilesManagerFactory.FILE_MANAGER.getReaderFor(group.getStream().getReference()));
		theFeed.setPublishedDate(new CCalendar(false, CCalendar.UNIVERSAL_TIME).getTime());

		final List<SyndEntry> entries = theFeed.getEntries();
		final SyndEntry theEntry = new SyndEntryImpl();
		theEntry.setAuthor(author.getEmailAddress());
		theEntry.setTitle(title);

		final SyndContent entryContent = new SyndContentImpl();
		entryContent.setValue(content);

		theEntry.setDescription(entryContent);
		theEntry.setLink(FeedsManager.VIOLET_LINK);
		theEntry.setPublishedDate(new CCalendar(false, CCalendar.UNIVERSAL_TIME).getTime());
		theEntry.setUri(System.currentTimeMillis() + entries.size() + "");
		entries.add(0, theEntry);
		theFeed.setEntries(entries);
		FeedsManager.writeContentToFiles(theFeed, group.getStream());

		// we'll now add the new item and broadcast its contents to members
		try {
			final FeedData theGroupFeed = group.getFeed();
			final EntryProcessor processor = FullTTSProcessor.getProcessor(theGroupFeed.getLanguage().getReference());
			final ProcessedEntry processedEntry = processor.processEntry(theEntry);

			final EntrySender sender = new FullSender(theGroupFeed, FeedsManager.MAX_ITEMS_AMOUNT, group.getMembers());
			sender.performTreatment(Collections.singletonList(processedEntry));
		} catch (final ProcessingException e) {
			FeedsManager.LOGGER.fatal(e, e);
		}

	}

	/**
	 * This method uses the group's feed file (which must exist !) and fills it up with the required elements
	 * of an empty feed (RSS 2.0)
	 * @param group
	 * @throws IOException
	 * @throws FeedException
	 */
	public static void createEmptyFeed(GroupData group) throws IOException, FeedException {
		final FilesData streamFile = group.getStream();
		final SyndFeed theFeed = new SyndFeedImpl();

		theFeed.setFeedType(FeedsManager.FEED_TYPE);
		theFeed.setTitle(group.getName());
		theFeed.setLink(FeedsManager.VIOLET_LINK);
		theFeed.setDescription(StringTools.getFirstSentence(group.getDescription(), FeedsManager.DESC_MAX_LENGTH));
		theFeed.setLanguage(group.getLanguage().getLang_iso_code());
		theFeed.setPublishedDate(new CCalendar(false, CCalendar.UNIVERSAL_TIME).getTime());

		final VObjectData creator = group.getCreator();
		theFeed.setAuthor(creator.getEmailAddress());
		FeedsManager.writeContentToFiles(theFeed, streamFile);
	}

	private static void writeContentToFiles(SyndFeed feed, FilesData file) throws IOException, FeedException {
		TmpFile tmpFile = null;
		try {
			tmpFile = FilesManager.TMP_MANAGER.new TmpFile();
			new SyndFeedOutput().output(feed, tmpFile.get());

			FilesManagerFactory.FILE_MANAGER.writeContentTo(new FileInputStream(tmpFile.get()), file.getReference());
		} catch (final IOException e) {
			FeedsManager.LOGGER.fatal(e, e);
			throw e;
		} catch (final FeedException e) {
			FeedsManager.LOGGER.fatal(e, e);
			throw e;
		} finally {
			if (tmpFile != null) {
				tmpFile.delete();
			}
		}
	}

}


text:
// ------------------------------------------------------------------------------
//  <auto-generated>
//      This code was generated by SpecFlow (http://www.specflow.org/).
//      SpecFlow Version:1.9.0.77
//      SpecFlow Generator Version:1.9.0.0
//      Runtime Version:4.0.30319.34003
//
//      Changes to this file may cause incorrect behavior and will be lost if
//      the code is regenerated.
//  </auto-generated>
// ------------------------------------------------------------------------------
#region Designer generated code
#pragma warning disable
namespace SpecsAndDemos._30SpecFlowAssistDynamic
{
    using TechTalk.SpecFlow;

    [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.9.0.77")]
    [System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    [NUnit.Framework.TestFixtureAttribute()]
    [NUnit.Framework.DescriptionAttribute("Comparing dynamic instances")]
    public partial class ComparingDynamicInstancesFeature
    {

        private static TechTalk.SpecFlow.ITestRunner testRunner;

#line 1 "ComparingDynamicInstances.feature"
#line hidden

        [NUnit.Framework.TestFixtureSetUpAttribute()]
        public virtual void FeatureSetup()
        {
            testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner();
            TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Comparing dynamic instances", "In order to be able to easy do assertions\r\nAs a SpecFlow developer\r\nI want to be " +
                    "able to compare dynamic instances", ProgrammingLanguage.CSharp, ((string[])(null)));
            testRunner.OnFeatureStart(featureInfo);
        }

        [NUnit.Framework.TestFixtureTearDownAttribute()]
        public virtual void FeatureTearDown()
        {
            testRunner.OnFeatureEnd();
            testRunner = null;
        }

        [NUnit.Framework.SetUpAttribute()]
        public virtual void TestInitialize()
        {
        }

        [NUnit.Framework.TearDownAttribute()]
        public virtual void ScenarioTearDown()
        {
            testRunner.OnScenarioEnd();
        }

        public virtual void ScenarioSetup(TechTalk.SpecFlow.ScenarioInfo scenarioInfo)
        {
            testRunner.OnScenarioStart(scenarioInfo);
        }

        public virtual void ScenarioCleanup()
        {
            testRunner.CollectScenarioErrors();
        }

        [NUnit.Framework.TestAttribute()]
        [NUnit.Framework.DescriptionAttribute("Matching a dynamic instance against a table")]
        public virtual void MatchingADynamicInstanceAgainstATable()
        {
            TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Matching a dynamic instance against a table", ((string[])(null)));
#line 6
this.ScenarioSetup(scenarioInfo);
#line hidden
            TechTalk.SpecFlow.Table table1 = new TechTalk.SpecFlow.Table(new string[] {
                        "Name",
                        "Age",
                        "Birth date",
                        "Length in meters"});
            table1.AddRow(new string[] {
                        "Marcus",
                        "39",
                        "1972-10-09",
                        "1.96"});
#line 7
 testRunner.Given("I create a dynamic instance from this table", ((string)(null)), table1, "Given ");
#line hidden
            TechTalk.SpecFlow.Table table2 = new TechTalk.SpecFlow.Table(new string[] {
                        "Name",
                        "Age",
                        "Birth date",
                        "Length in meters"});
            table2.AddRow(new string[] {
                        "Marcus",
                        "39",
                        "1972-10-09",
                        "1.96"});
#line 10
 testRunner.When("I compare it to this table", ((string)(null)), table2, "When ");
#line 13
 testRunner.Then("no instance comparison exception should have been thrown", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
            this.ScenarioCleanup();
        }

        [NUnit.Framework.TestAttribute()]
        [NUnit.Framework.DescriptionAttribute("Not matching when 1 header differ")]
        public virtual void NotMatchingWhen1HeaderDiffer()
        {
            TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Not matching when 1 header differ", ((string[])(null)));
#line 15
this.ScenarioSetup(scenarioInfo);
#line hidden
            TechTalk.SpecFlow.Table table3 = new TechTalk.SpecFlow.Table(new string[] {
                        "Name"});
            table3.AddRow(new string[] {
                        "Marcus"});
#line 16
 testRunner.Given("I create a dynamic instance from this table", ((string)(null)), table3, "Given ");
#line hidden
            TechTalk.SpecFlow.Table table4 = new TechTalk.SpecFlow.Table(new string[] {
                        "N"});
            table4.AddRow(new string[] {
                        "Marcus"});
#line 19
 testRunner.When("I compare it to this table", ((string)(null)), table4, "When ");
#line 22
 testRunner.Then("an instance comparison exception should be thrown with 2 differences", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 23
  testRunner.And("one difference should be on the \'Name\' field of the instance", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 24
  testRunner.And("one difference should be on the \'N\' column of the table", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
            this.ScenarioCleanup();
        }

        [NUnit.Framework.TestAttribute()]
        [NUnit.Framework.DescriptionAttribute("Not matching when 2 header differ")]
        public virtual void NotMatchingWhen2HeaderDiffer()
        {
            TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Not matching when 2 header differ", ((string[])(null)));
#line 26
this.ScenarioSetup(scenarioInfo);
#line hidden
            TechTalk.SpecFlow.Table table5 = new TechTalk.SpecFlow.Table(new string[] {
                        "Name",
                        "Birth date"});
            table5.AddRow(new string[] {
                        "Marcus",
                        "2000-01-01"});
#line 27
 testRunner.Given("I create a dynamic instance from this table", ((string)(null)), table5, "Given ");
#line hidden
            TechTalk.SpecFlow.Table table6 = new TechTalk.SpecFlow.Table(new string[] {
                        "N",
                        "Date of birth"});
            table6.AddRow(new string[] {
                        "Marcus",
                        "2000-01-01"});
#line 30
 testRunner.When("I compare it to this table", ((string)(null)), table6, "When ");
#line 33
 testRunner.Then("an instance comparison exception should be thrown with 4 differences", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 34
  testRunner.And("one difference should be on the \'Name\' field of the instance", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 35
  testRunner.And("one difference should be on the \'BirthDate\' field of the instance", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 36
  testRunner.And("one difference should be on the \'N\' column of the table", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 37
  testRunner.And("one difference should be on the \'DateOfBirth\' column of the table", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
            this.ScenarioCleanup();
        }

        [NUnit.Framework.TestAttribute()]
        [NUnit.Framework.DescriptionAttribute("Not matching when 1 value differ")]
        public virtual void NotMatchingWhen1ValueDiffer()
        {
            TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Not matching when 1 value differ", ((string[])(null)));
#line 39
this.ScenarioSetup(scenarioInfo);
#line hidden
            TechTalk.SpecFlow.Table table7 = new TechTalk.SpecFlow.Table(new string[] {
                        "Name"});
            table7.AddRow(new string[] {
                        "Marcus"});
#line 40
 testRunner.Given("I create a dynamic instance from this table", ((string)(null)), table7, "Given ");
#line hidden
            TechTalk.SpecFlow.Table table8 = new TechTalk.SpecFlow.Table(new string[] {
                        "Name"});
            table8.AddRow(new string[] {
                        "Albert"});
#line 43
 testRunner.When("I compare it to this table", ((string)(null)), table8, "When ");
#line 46
 testRunner.Then("an instance comparison exception should be thrown with 1 difference", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 47
  testRunner.And("one difference should be on the \'Name\' property", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 48
  testRunner.And("one message should state that the instance had the value \'Marcus\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 49
  testRunner.And("one message should state that the table had the value \'Albert\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
            this.ScenarioCleanup();
        }

        [NUnit.Framework.TestAttribute()]
        [NUnit.Framework.DescriptionAttribute("Not matching when several value differ")]
        public virtual void NotMatchingWhenSeveralValueDiffer()
        {
            TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Not matching when several value differ", ((string[])(null)));
#line 51
this.ScenarioSetup(scenarioInfo);
#line hidden
            TechTalk.SpecFlow.Table table9 = new TechTalk.SpecFlow.Table(new string[] {
                        "Name",
                        "BirthDate",
                        "LengthInMeters"});
            table9.AddRow(new string[] {
                        "Marcus",
                        "1972-10-09",
                        "1.96"});
#line 52
 testRunner.Given("I create a dynamic instance from this table", ((string)(null)), table9, "Given ");
#line hidden
            TechTalk.SpecFlow.Table table10 = new TechTalk.SpecFlow.Table(new string[] {
                        "Name",
                        "Birth date",
                        "Length in meters"});
            table10.AddRow(new string[] {
                        "Albert",
                        "2008-01-24",
                        "1.04"});
#line 55
 testRunner.When("I compare it to this table", ((string)(null)), table10, "When ");
#line 58
 testRunner.Then("an instance comparison exception should be thrown with 3 difference", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 59
  testRunner.And("one difference should be on the \'Name\' property", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 60
  testRunner.And("one difference should be on the \'BirthDate\' property", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 61
  testRunner.And("one difference should be on the \'LengthInMeters\' property", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
            this.ScenarioCleanup();
        }
    }
}
#pragma warning restore
#endregion


text:
{-# LANGUAGE CPP #-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Tinc.SourceDependency (
  GitCache
, SourceDependencyCache
, SourceDependency(..)
, SourceDependencyWithVersion
, sourceDependencyPath
, extractSourceDependencies
#ifdef TEST
, HpackSourceDependency(..)
, Source(..)
, Ref(..)
, Rev(..)
, CachedRev(..)
, mapLocalDependencyToGitDependency
, parseAddSourceDependencies
, removeDuplicates
, populateSourceDependencyCache

, copyPackageConfig

, gitClone_impl

, gitRefToRev_impl
, isGitRev
, checkCabalName
, findCabalFile
, CabalPackage(..)
, parseCabalFile
#endif
) where

import           Control.Monad
import           Data.Function
import           Data.List
import           Data.Maybe
import           Data.String
import           Data.Tree
import           Data.Version

import qualified Distribution.Version as Cabal

import           Distribution.Package hiding (Package)
import           Distribution.PackageDescription hiding (Git)
import           Distribution.PackageDescription.Parsec (readGenericPackageDescription)
import           Distribution.Verbosity
import           GHC.Fingerprint
import qualified Hpack.Config as Hpack
import           System.Directory hiding (getDirectoryContents, withCurrentDirectory)
import           System.FilePath
import           System.IO.Temp
import           Data.Aeson
import           GHC.Generics
import           GHC.Exts

import           Tinc.Fail
import           Tinc.Types
import           Tinc.Process
import           Tinc.Hpack
import           Util

data GitCache
data SourceDependencyCache

data SourceDependency = SourceDependency {
  sourceDependencyPackageName :: String

-- This is one of:
--  + git revision for git dependencies
--  + md5(md5(git revision), md5(subdir)) for git dependencies that specify a subdir
--  + md5 of local dependency for local dependencies
, sourceDependencyHash :: String

} deriving (Eq, Show, Generic)

type SourceDependencyWithVersion = (SourceDependency, Version)

data HpackSourceDependency a = HpackSourceDependency {
  _hpackSourceDependencyName :: String
, _hpackSourceDependencySource :: Source a
} deriving (Eq, Show)

newtype Ref = Ref String
  deriving (Eq, Show, IsString)

newtype Rev = Rev String
  deriving (Eq, Show, IsString)

newtype CachedRev = CachedRev {unCachedRev :: String}
  deriving (Eq, Show, IsString)

data Source a = Local FilePath | Git String a (Maybe FilePath)
  deriving (Eq, Show)

addSourceJsonOptions :: Options
addSourceJsonOptions = defaultOptions{fieldLabelModifier = camelTo2 '-' . drop (length ("SourceDependency" :: String))}

instance FromJSON SourceDependency where
  parseJSON = genericParseJSON addSourceJsonOptions

instance ToJSON SourceDependency where
  toJSON = genericToJSON addSourceJsonOptions

sourceDependencyPath :: Path SourceDependencyCache -> SourceDependency -> Path SourceDependency
sourceDependencyPath (Path cache) (SourceDependency name rev) = Path $ cache </> name </> rev

extractSourceDependencies :: Path GitCache -> Path SourceDependencyCache -> Hpack.Dependencies -> IO [SourceDependencyWithVersion]
extractSourceDependencies gitCache sourceDependencyCache additionalDeps = do
  parseAddSourceDependencies (toList additionalDeps) >>= fmap removeDuplicates . unfoldForestM go
  where
    go :: HpackSourceDependency Ref -> IO (SourceDependencyWithVersion, [HpackSourceDependency Ref])
    go dep@(HpackSourceDependency _ source) = do
      resolvedDep <- resolveGitReferences dep
      cachedDep <- cacheGitRev gitCache resolvedDep >>= populateSourceDependencyCache gitCache sourceDependencyCache
      deps <- addSourceDependenciesFrom sourceDependencyCache (resolvedDep, cachedDep)
      version <- cabalPackageVersion <$> parseCabalFile (path $ sourceDependencyPath sourceDependencyCache cachedDep) source
      return ((cachedDep, version), deps)

removeDuplicates :: Forest (SourceDependency, a) -> [(SourceDependency, a)]
removeDuplicates = nubByPackageName . concat . removeFakeRoot . levels . addFakeRoot
  where
    fakeRoot = error "Tinc.SourceDependency.removeDuplicates: fake-root"
    addFakeRoot = Node fakeRoot
    removeFakeRoot = drop 1
    nubByPackageName = nubBy ((==) `on` (sourceDependencyPackageName . fst))

mapLocalDependencyToGitDependency :: Source Rev -> HpackSourceDependency Ref -> HpackSourceDependency Ref
mapLocalDependencyToGitDependency source (HpackSourceDependency name dep) = case (source, dep) of
  (_, Git _ _ _) -> HpackSourceDependency name dep
  (Git url (Rev rev) subdir, Local path) -> HpackSourceDependency name (Git url (Ref rev) (Just p))
      where
        p = normalise $ fromMaybe "." subdir </> path
  (Local path, Local p) -> HpackSourceDependency name (Local $ normalise (path </> p))

resolveGitReferences :: HpackSourceDependency Ref -> IO (HpackSourceDependency Rev)
resolveGitReferences (HpackSourceDependency name source) = HpackSourceDependency name <$> case source of
  Git url ref subdir -> Git url <$> gitRefToRev url ref <*> pure subdir
  Local dir -> return (Local dir)

cacheGitRev :: Path GitCache -> HpackSourceDependency Rev -> IO (HpackSourceDependency CachedRev)
cacheGitRev cache (HpackSourceDependency name source) = HpackSourceDependency name <$> case source of
  Git url rev subdir -> Git url <$> gitClone cache url rev <*> pure subdir
  Local dir -> return (Local dir)

gitClone :: Path GitCache -> String -> Rev -> IO CachedRev
gitClone = gitClone_impl process

gitClone_impl :: Process IO -> Path GitCache -> String -> Rev -> IO CachedRev
gitClone_impl Process{..} cache url (Rev rev) = do
  createDirectoryIfMissing True (path cache)
  withTempDirectory (path cache) "tmp" $ \sandbox -> do
    let tmp = sandbox </> rev
    alreadyInCache <- doesDirectoryExist dst
    unless alreadyInCache $ do
      callProcess "git" ["clone", url, tmp]
      withCurrentDirectory tmp $ do
        callProcess "git" ["reset", "--hard", rev]
        removeDirectoryRecursive ".git"
      renameDirectory tmp dst
  return cachedRev
  where
    cachedRev = CachedRev rev
    Path dst = cachedRevPath cache cachedRev

cachedRevPath :: Path GitCache -> CachedRev -> Path CachedRev
cachedRevPath (Path cache) (CachedRev rev) = Path (cache </> rev)

addSourceDependenciesFrom :: Path SourceDependencyCache -> (HpackSourceDependency Rev, SourceDependency) -> IO [HpackSourceDependency Ref]
addSourceDependenciesFrom sourceDependencyCache (HpackSourceDependency _ source, addSource) = map (mapLocalDependencyToGitDependency source) <$> do
  exists <- doesFileExist config
  if exists
    then Hpack.readPackageConfig options >>= either die (return . filterAddSource . Hpack.packageDependencies . Hpack.decodeResultPackage)
    else return []
  where
    options = Hpack.defaultDecodeOptions {Hpack.decodeOptionsTarget = config}
    config = path (sourceDependencyPath sourceDependencyCache addSource) </> Hpack.packageConfig

filterAddSource :: [(String, Hpack.DependencyInfo)] -> [HpackSourceDependency Ref]
filterAddSource deps = [HpackSourceDependency name (toSource addSource) | (name, Hpack.DependencyInfo _ (Hpack.DependencyVersion (Just addSource) _)) <- deps]
  where
    toSource :: Hpack.SourceDependency -> Source Ref
    toSource x = case x of
      Hpack.GitRef repo ref subdir -> Git repo (Ref ref) subdir
      Hpack.Local dir -> Local dir

parseAddSourceDependencies :: [(String, Hpack.DependencyInfo)] ->  IO [HpackSourceDependency Ref]
parseAddSourceDependencies additionalDeps = do
  exists <- doesConfigExist
  packageDeps <- if exists
    then do
      pkg <- readConfig mempty
      return $ Hpack.packageDependencies (snd pkg)
    else return []
  let deps = additionalDeps ++ packageDeps
  return (nubBy ((==) `on` _hpackSourceDependencyName) $ filterAddSource deps)

populateSourceDependencyCache :: Path GitCache -> Path SourceDependencyCache -> HpackSourceDependency CachedRev -> IO SourceDependency
populateSourceDependencyCache gitCache cache dep@(HpackSourceDependency name source) = do
  createDirectoryIfMissing True (path cache </> name)
  case source of
    Git _ rev subdir -> do
      let
        cacheKey = case subdir of
          Nothing -> unCachedRev rev
          Just dir -> show $ fingerprintFingerprints [fingerprintString (unCachedRev rev), fingerprintString dir]
        addSource = SourceDependency name cacheKey
        src = maybe revPath (revPath </>) subdir
          where revPath = path (cachedRevPath gitCache rev)
        dst = (path $ sourceDependencyPath cache addSource)
      alreadyInCache <- doesDirectoryExist dst
      unless alreadyInCache $ do
        checkCabalName src dep
        linkFile src dst
      return addSource
    Local dir -> do
      withTempDirectory (path cache) "tmp" $ \sandbox -> do
        let tmp = sandbox </> name
        createDirectory tmp
        cabalSdist dir tmp
        copyPackageConfig dir tmp
        fp <- fingerprint tmp
        let addSource = SourceDependency name fp
        moveToSourceDependencyCache cache tmp dep addSource
        return addSource

copyPackageConfig :: FilePath -> FilePath -> IO ()
copyPackageConfig srcDir dstDir = do
  whenM (doesFileExist src) $ do
    copyFile src dst
  where
    src = srcDir </> Hpack.packageConfig
    dst = dstDir </> Hpack.packageConfig

gitRefToRev :: String -> Ref -> IO Rev
gitRefToRev = gitRefToRev_impl process {readProcess = verboseReadProcess}
  where
    verboseReadProcess command args input = do
      putStrLn (unwords $ command : args)
      r <- readProcess process command args input
      putStr r
      return r

gitRefToRev_impl :: Fail m => Process m -> String -> Ref -> m Rev
gitRefToRev_impl Process{..} repo (Ref ref)
  | isGitRev ref = return (Rev ref)
  | otherwise = do
      r <- readProcess "git" ["ls-remote", repo, ref] ""
      case words r of
        rev : _ | isGitRev rev -> return (Rev rev)
        _ -> die ("invalid reference " ++ show ref ++ " for git repository " ++ repo)

isGitRev :: String -> Bool
isGitRev ref = length ref == 40 && all (`elem` "0123456789abcdef") ref

cabalSdist :: FilePath -> FilePath -> IO ()
cabalSdist sourceDirectory dst = do
  withCurrentDirectory sourceDirectory $ do
    callProcessM "cabal" ["v1-sdist", "--output-directory", dst]

moveToSourceDependencyCache :: Path SourceDependencyCache -> FilePath -> HpackSourceDependency a -> SourceDependency -> IO ()
moveToSourceDependencyCache cache src hpackDep dep = do
  checkCabalName src hpackDep
  let dst = sourceDependencyPath cache dep
  unlessM (doesDirectoryExist $ path dst) $ do
    renameDirectory src $ path dst

checkCabalName :: FilePath -> HpackSourceDependency a -> IO ()
checkCabalName directory (HpackSourceDependency expectedName source) = do
  name <- cabalPackageName <$> parseCabalFile directory source
  if name == expectedName
    then return ()
    else die ("the " ++ subject source ++ " contains package " ++ show name
      ++ ", expected: " ++ show expectedName)

subject :: Source a -> String
subject addSource = case addSource of
  Git url _ subdir -> maybe "" (\dir -> "directory " ++ show dir ++ " of ") subdir ++ "git repository " ++ url
  Local dir -> "directory " ++ dir

data CabalPackage = CabalPackage {
  cabalPackageName :: String
, cabalPackageVersion :: Version
} deriving (Eq, Show)

parseCabalFile :: FilePath -> Source a -> IO CabalPackage
parseCabalFile dir source = do
  cabalFile <- findCabalFile dir source
  pkg <- package . packageDescription <$> readGenericPackageDescription silent cabalFile
  case Cabal.versionNumbers (pkgVersion pkg) of
    [] -> die $ "the cabal file in " ++ subject source ++ " does not specify a version"
    v -> return $ CabalPackage (unPackageName $ pkgName pkg) (makeVersion v)

findCabalFile :: FilePath -> Source a -> IO FilePath
findCabalFile dir addSource = do
  cabalFiles <- getCabalFiles dir
  case cabalFiles of
    [cabalFile] -> return (dir </> cabalFile)
    [] -> die ("Couldn't find .cabal file in " ++ subject addSource)
    _ -> die ("Multiple cabal files found in " ++ subject addSource)


text:
package notifications

import (
	"fmt"
	log "github.com/Sirupsen/logrus"
	"github.com/mailgun/mailgun-go"
	"github.com/pandemicsyn/stalker/go/stalker"
)

type MailgunNotification struct {
	Domain    string
	ApiUser   string
	ApiKey    string
	Recipient string
	FromAddr  string
}

func NewMailgunNotification(domain, apiuser, apikey, recipient, fromaddr string) *MailgunNotification {
	return &MailgunNotification{domain, apiuser, apikey, recipient, fromaddr}
}

func (mn *MailgunNotification) genMessage(check stalker.Check) (string, error) {
	name := check.Check
	hostname := check.Hostname

	var status string
	if check.Status {
		status = "UP"
	} else {
		status = "DOWN"
	}
	subject := fmt.Sprintf("[stalker] %s on %s is %s", name, hostname, status)
	body := fmt.Sprintf("%+v", check)
	mg := mailgun.NewMailgun(mn.Domain, mn.ApiKey, "")
	m := mailgun.NewMessage(mn.FromAddr, subject, body, mn.Recipient)
	_, id, err := mg.Send(m)
	return id, err
}

func (mn *MailgunNotification) Fail(check stalker.Check) {
	incidentKey := fmt.Sprintf("%s:%s", check.Hostname, check.Check)
	id, err := mn.genMessage(check)
	if err != nil {
		log.Errorln("Error generating alert via mailgun:", err.Error(), id)
		// TODO: trigger fallback notifications
		return
	}
	log.Infoln("Sent mailgun alert for:", incidentKey)
}

func (mn *MailgunNotification) Clear(check stalker.Check) {
	incidentKey := fmt.Sprintf("%s:%s", check.Hostname, check.Check)
	id, err := mn.genMessage(check)
	if err != nil {
		log.Errorln("Error generating clear via mailgun:", err.Error(), id)
		// TODO: trigger fallback notifications
		return
	}
	log.Infoln("Sent mailgun clear for:", incidentKey)
}


text:
using AutoMapper;
using FluentValidation.AspNetCore;
using Hangfire;
using MediatR;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json.Serialization;
using Serilog;
using StructureMap;
using System;
using Web.Engine;
using Web.Engine.Filters;
using Web.Engine.Services;
using Web.Engine.Services.Hangfire;
using Web.Engine.Services.Hangfire.Jobs;
using Web.Models;

namespace Web
{
    public class Startup
    {
        public Startup(IConfiguration configuration)
        {
            //Log.Logger = new LoggerConfiguration()
            //    .Enrich.FromLogContext()
            //    .WriteTo.LiterateConsole()
            //    .WriteTo.Async(a => a.RollingFile(Path.Combine(env.ContentRootPath, "logs/log-{Date}.txt")))
            //    .CreateLogger();

            Configuration = configuration;
        }

        private static IConfiguration Configuration { get; set; }
        private static string DefaultConnectionString => Configuration.GetConnectionString("DefaultConnection");

        // This method gets called by the runtime. Use this method to add services to the container.
        public IServiceProvider ConfigureServices(IServiceCollection services)
        {
            // Add framework services.
            services.AddDbContext<ApplicationDbContext>(options =>
                options.UseSqlServer(DefaultConnectionString, o => o.EnableRetryOnFailure()));

            services.Configure<DRSConfig>(Configuration.GetSection("DRS"));
            services.Configure<Engine.Services.Lucene.Config>(Configuration.GetSection("DRS"));
            services.Configure<OcrEngine.Config>(Configuration.GetSection("DRS:Tess"));

            services.AddIdentity<ApplicationUser, IdentityRole>()
                .AddEntityFrameworkStores<ApplicationDbContext>()
                .AddDefaultTokenProviders();

            services.AddAuthentication();

            services.AddHangfire(x => x.UseSqlServerStorage(DefaultConnectionString));

            services
                .AddMvc(
                    options =>
                    {
                        options.Filters.Add(new ValidateModelStateFilter());
                        options.Filters.Add(new ApiExceptionFilter());
                    })
                .AddFeatureFolders()
                .AddJsonOptions(options => options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver())
                .AddFluentValidation(cfg => cfg.RegisterValidatorsFromAssemblyContaining<Startup>());

            services.AddAutoMapper(typeof(Startup));

            Mapper.AssertConfigurationIsValid();

            services.AddMediatR(typeof(Startup));

            var container = new Container(cfg => cfg.AddRegistry<WebRegistry>());

            // populates structuremap with .NET services

            container.Populate(services);

            FileDecoder.RegisterFileDecoders(container.GetInstance<IOcrEngine>(), container.GetInstance<IPdfRasterizer>());

            return container.GetInstance<IServiceProvider>();
        }

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(
            IApplicationBuilder app,
            IHostingEnvironment env,
            ILoggerFactory loggerFactory,
            IApplicationLifetime appLifetime,
            IServiceProvider serviceProvider)
        {
            loggerFactory.AddSerilog();
            // Ensure any buffered events are sent at shutdown
            appLifetime.ApplicationStopped.Register(Log.CloseAndFlush);

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
                app.UseBrowserLink();

                //app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
                //{
                //    HotModuleReplacement = true,
                //    ReactHotModuleReplacement = true
                //});
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseStaticFiles();
            app.UseAuthentication();

            // Hangfire

            GlobalConfiguration.Configuration.UseActivator(new HangfireActivator(serviceProvider));

            app.UseHangfireServer();
            app.UseHangfireDashboard("/hangfire", new DashboardOptions
            {
                Authorization = new[] { new DashboardAuthorizationFilter() }
            });

            RecurringJob
                .AddOrUpdate<IndexRevisions>(nameof(IndexRevisions)
                , j => j.Run()
                , "*/5 * * * *", TimeZoneInfo.Local);

            RecurringJob
                .AddOrUpdate<GenerateThumbnails>(nameof(GenerateThumbnails)
                , j => j.Run()
                , "*/5 * * * *", TimeZoneInfo.Local);

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    "default",
                    "{controller=Home}/{action=Index}");

                //routes.MapSpaFallbackRoute(
                //    "spa-fallback",
                //    "{controller=Documents}/{action=Index}");
            });
        }
    }
}


text:
/*================================================================================
  code generated by: java2cpp
  author: Zoran Angelov, mailto://baldzar@gmail.com
  class: android.graphics.drawable.DrawableContainer
================================================================================*/

#ifndef J2CPP_INCLUDE_IMPLEMENTATION

#ifndef J2CPP_ANDROID_GRAPHICS_DRAWABLE_DRAWABLECONTAINER_HPP_DECL
#define J2CPP_ANDROID_GRAPHICS_DRAWABLE_DRAWABLECONTAINER_HPP_DECL

namespace j2cpp { namespace java { namespace lang { class Runnable; } } }
namespace j2cpp { namespace android { namespace graphics { class Canvas; } } }
namespace j2cpp { namespace android { namespace graphics { namespace drawable { class Drawable; } } } }
namespace j2cpp { namespace android { namespace graphics { namespace drawable { namespace Drawable_ { class ConstantState; } } } } }
namespace j2cpp { namespace android { namespace graphics { namespace drawable { namespace Drawable_ { class Callback; } } } } }
namespace j2cpp { namespace android { namespace graphics { class Rect; } } }
namespace j2cpp { namespace android { namespace graphics { class ColorFilter; } } }

#include <android/graphics/Canvas.hpp>
#include <android/graphics/ColorFilter.hpp>
#include <android/graphics/Rect.hpp>
#include <android/graphics/drawable/Drawable.hpp>
#include <java/lang/Runnable.hpp>

namespace j2cpp {

namespace android { namespace graphics { namespace drawable {

	class DrawableContainer;
	namespace DrawableContainer_ {

		class DrawableContainerState;
		class DrawableContainerState
			: public object<DrawableContainerState>
		{
		public:

			J2CPP_DECLARE_CLASS

			J2CPP_DECLARE_METHOD(0)
			J2CPP_DECLARE_METHOD(1)
			J2CPP_DECLARE_METHOD(2)
			J2CPP_DECLARE_METHOD(3)
			J2CPP_DECLARE_METHOD(4)
			J2CPP_DECLARE_METHOD(5)
			J2CPP_DECLARE_METHOD(6)
			J2CPP_DECLARE_METHOD(7)
			J2CPP_DECLARE_METHOD(8)
			J2CPP_DECLARE_METHOD(9)
			J2CPP_DECLARE_METHOD(10)
			J2CPP_DECLARE_METHOD(11)
			J2CPP_DECLARE_METHOD(12)
			J2CPP_DECLARE_METHOD(13)
			J2CPP_DECLARE_METHOD(14)
			J2CPP_DECLARE_METHOD(15)
			J2CPP_DECLARE_METHOD(16)

			explicit DrawableContainerState(jobject jobj)
			: object<DrawableContainerState>(jobj)
			{
			}

			operator local_ref<android::graphics::drawable::Drawable_::ConstantState>() const;

			jint getChangingConfigurations();
			jint addChild(local_ref< android::graphics::drawable::Drawable >  const&);
			jint getChildCount();
			local_ref< array< local_ref< android::graphics::drawable::Drawable >, 1> > getChildren();
			void setVariablePadding(jboolean);
			local_ref< android::graphics::Rect > getConstantPadding();
			void setConstantSize(jboolean);
			jboolean isConstantSize();
			jint getConstantWidth();
			jint getConstantHeight();
			jint getConstantMinimumWidth();
			jint getConstantMinimumHeight();
			jint getOpacity();
			jboolean isStateful();
			void growArray(jint, jint);
			jboolean canConstantState();
		}; //class DrawableContainerState

	} //namespace DrawableContainer_

	class DrawableContainer
		: public object<DrawableContainer>
	{
	public:

		J2CPP_DECLARE_CLASS

		J2CPP_DECLARE_METHOD(0)
		J2CPP_DECLARE_METHOD(1)
		J2CPP_DECLARE_METHOD(2)
		J2CPP_DECLARE_METHOD(3)
		J2CPP_DECLARE_METHOD(4)
		J2CPP_DECLARE_METHOD(5)
		J2CPP_DECLARE_METHOD(6)
		J2CPP_DECLARE_METHOD(7)
		J2CPP_DECLARE_METHOD(8)
		J2CPP_DECLARE_METHOD(9)
		J2CPP_DECLARE_METHOD(10)
		J2CPP_DECLARE_METHOD(11)
		J2CPP_DECLARE_METHOD(12)
		J2CPP_DECLARE_METHOD(13)
		J2CPP_DECLARE_METHOD(14)
		J2CPP_DECLARE_METHOD(15)
		J2CPP_DECLARE_METHOD(16)
		J2CPP_DECLARE_METHOD(17)
		J2CPP_DECLARE_METHOD(18)
		J2CPP_DECLARE_METHOD(19)
		J2CPP_DECLARE_METHOD(20)
		J2CPP_DECLARE_METHOD(21)
		J2CPP_DECLARE_METHOD(22)
		J2CPP_DECLARE_METHOD(23)
		J2CPP_DECLARE_METHOD(24)

		typedef DrawableContainer_::DrawableContainerState DrawableContainerState;

		explicit DrawableContainer(jobject jobj)
		: object<DrawableContainer>(jobj)
		{
		}

		operator local_ref<android::graphics::drawable::Drawable>() const;
		operator local_ref<android::graphics::drawable::Drawable_::Callback>() const;

		DrawableContainer();
		void draw(local_ref< android::graphics::Canvas >  const&);
		jint getChangingConfigurations();
		jboolean getPadding(local_ref< android::graphics::Rect >  const&);
		void setAlpha(jint);
		void setDither(jboolean);
		void setColorFilter(local_ref< android::graphics::ColorFilter >  const&);
		jboolean isStateful();
		jint getIntrinsicWidth();
		jint getIntrinsicHeight();
		jint getMinimumWidth();
		jint getMinimumHeight();
		void invalidateDrawable(local_ref< android::graphics::drawable::Drawable >  const&);
		void scheduleDrawable(local_ref< android::graphics::drawable::Drawable >  const&, local_ref< java::lang::Runnable >  const&, jlong);
		void unscheduleDrawable(local_ref< android::graphics::drawable::Drawable >  const&, local_ref< java::lang::Runnable >  const&);
		jboolean setVisible(jboolean, jboolean);
		jint getOpacity();
		jboolean selectDrawable(jint);
		local_ref< android::graphics::drawable::Drawable > getCurrent();
		local_ref< android::graphics::drawable::Drawable_::ConstantState > getConstantState();
		local_ref< android::graphics::drawable::Drawable > mutate();
	}; //class DrawableContainer

} //namespace drawable
} //namespace graphics
} //namespace android

} //namespace j2cpp

#endif //J2CPP_ANDROID_GRAPHICS_DRAWABLE_DRAWABLECONTAINER_HPP_DECL

#else //J2CPP_INCLUDE_IMPLEMENTATION

#ifndef J2CPP_ANDROID_GRAPHICS_DRAWABLE_DRAWABLECONTAINER_HPP_IMPL
#define J2CPP_ANDROID_GRAPHICS_DRAWABLE_DRAWABLECONTAINER_HPP_IMPL

namespace j2cpp {

android::graphics::drawable::DrawableContainer_::DrawableContainerState::operator local_ref<android::graphics::drawable::Drawable_::ConstantState>() const
{
	return local_ref<android::graphics::drawable::Drawable_::ConstantState>(get_jobject());
}

jint android::graphics::drawable::DrawableContainer_::DrawableContainerState::getChangingConfigurations()
{
	return call_method<
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_CLASS_NAME,
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_METHOD_NAME(1),
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_METHOD_SIGNATURE(1),
		jint
	>(get_jobject());
}

jint android::graphics::drawable::DrawableContainer_::DrawableContainerState::addChild(local_ref< android::graphics::drawable::Drawable > const &a0)
{
	return call_method<
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_CLASS_NAME,
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_METHOD_NAME(2),
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_METHOD_SIGNATURE(2),
		jint
	>(get_jobject(), a0);
}

jint android::graphics::drawable::DrawableContainer_::DrawableContainerState::getChildCount()
{
	return call_method<
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_CLASS_NAME,
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_METHOD_NAME(3),
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_METHOD_SIGNATURE(3),
		jint
	>(get_jobject());
}

local_ref< array< local_ref< android::graphics::drawable::Drawable >, 1> > android::graphics::drawable::DrawableContainer_::DrawableContainerState::getChildren()
{
	return call_method<
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_CLASS_NAME,
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_METHOD_NAME(4),
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_METHOD_SIGNATURE(4),
		local_ref< array< local_ref< android::graphics::drawable::Drawable >, 1> >
	>(get_jobject());
}

void android::graphics::drawable::DrawableContainer_::DrawableContainerState::setVariablePadding(jboolean a0)
{
	return call_method<
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_CLASS_NAME,
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_METHOD_NAME(5),
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_METHOD_SIGNATURE(5),
		void
	>(get_jobject(), a0);
}

local_ref< android::graphics::Rect > android::graphics::drawable::DrawableContainer_::DrawableContainerState::getConstantPadding()
{
	return call_method<
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_CLASS_NAME,
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_METHOD_NAME(6),
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_METHOD_SIGNATURE(6),
		local_ref< android::graphics::Rect >
	>(get_jobject());
}

void android::graphics::drawable::DrawableContainer_::DrawableContainerState::setConstantSize(jboolean a0)
{
	return call_method<
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_CLASS_NAME,
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_METHOD_NAME(7),
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_METHOD_SIGNATURE(7),
		void
	>(get_jobject(), a0);
}

jboolean android::graphics::drawable::DrawableContainer_::DrawableContainerState::isConstantSize()
{
	return call_method<
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_CLASS_NAME,
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_METHOD_NAME(8),
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_METHOD_SIGNATURE(8),
		jboolean
	>(get_jobject());
}

jint android::graphics::drawable::DrawableContainer_::DrawableContainerState::getConstantWidth()
{
	return call_method<
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_CLASS_NAME,
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_METHOD_NAME(9),
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_METHOD_SIGNATURE(9),
		jint
	>(get_jobject());
}

jint android::graphics::drawable::DrawableContainer_::DrawableContainerState::getConstantHeight()
{
	return call_method<
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_CLASS_NAME,
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_METHOD_NAME(10),
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_METHOD_SIGNATURE(10),
		jint
	>(get_jobject());
}

jint android::graphics::drawable::DrawableContainer_::DrawableContainerState::getConstantMinimumWidth()
{
	return call_method<
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_CLASS_NAME,
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_METHOD_NAME(11),
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_METHOD_SIGNATURE(11),
		jint
	>(get_jobject());
}

jint android::graphics::drawable::DrawableContainer_::DrawableContainerState::getConstantMinimumHeight()
{
	return call_method<
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_CLASS_NAME,
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_METHOD_NAME(12),
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_METHOD_SIGNATURE(12),
		jint
	>(get_jobject());
}

jint android::graphics::drawable::DrawableContainer_::DrawableContainerState::getOpacity()
{
	return call_method<
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_CLASS_NAME,
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_METHOD_NAME(13),
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_METHOD_SIGNATURE(13),
		jint
	>(get_jobject());
}

jboolean android::graphics::drawable::DrawableContainer_::DrawableContainerState::isStateful()
{
	return call_method<
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_CLASS_NAME,
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_METHOD_NAME(14),
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_METHOD_SIGNATURE(14),
		jboolean
	>(get_jobject());
}

void android::graphics::drawable::DrawableContainer_::DrawableContainerState::growArray(jint a0, jint a1)
{
	return call_method<
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_CLASS_NAME,
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_METHOD_NAME(15),
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_METHOD_SIGNATURE(15),
		void
	>(get_jobject(), a0, a1);
}

jboolean android::graphics::drawable::DrawableContainer_::DrawableContainerState::canConstantState()
{
	return call_method<
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_CLASS_NAME,
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_METHOD_NAME(16),
		android::graphics::drawable::DrawableContainer_::DrawableContainerState::J2CPP_METHOD_SIGNATURE(16),
		jboolean
	>(get_jobject());
}

J2CPP_DEFINE_CLASS(android::graphics::drawable::DrawableContainer_::DrawableContainerState,"android/graphics/drawable/DrawableContainer$DrawableContainerState")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer_::DrawableContainerState,0,"<init>","()V")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer_::DrawableContainerState,1,"getChangingConfigurations","()I")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer_::DrawableContainerState,2,"addChild","(Landroid/graphics/drawable/Drawable;)I")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer_::DrawableContainerState,3,"getChildCount","()I")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer_::DrawableContainerState,4,"getChildren","()[android.graphics.drawable.Drawable")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer_::DrawableContainerState,5,"setVariablePadding","(Z)V")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer_::DrawableContainerState,6,"getConstantPadding","()Landroid/graphics/Rect;")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer_::DrawableContainerState,7,"setConstantSize","(Z)V")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer_::DrawableContainerState,8,"isConstantSize","()Z")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer_::DrawableContainerState,9,"getConstantWidth","()I")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer_::DrawableContainerState,10,"getConstantHeight","()I")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer_::DrawableContainerState,11,"getConstantMinimumWidth","()I")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer_::DrawableContainerState,12,"getConstantMinimumHeight","()I")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer_::DrawableContainerState,13,"getOpacity","()I")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer_::DrawableContainerState,14,"isStateful","()Z")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer_::DrawableContainerState,15,"growArray","(II)V")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer_::DrawableContainerState,16,"canConstantState","()Z")

android::graphics::drawable::DrawableContainer::operator local_ref<android::graphics::drawable::Drawable>() const
{
	return local_ref<android::graphics::drawable::Drawable>(get_jobject());
}

android::graphics::drawable::DrawableContainer::operator local_ref<android::graphics::drawable::Drawable_::Callback>() const
{
	return local_ref<android::graphics::drawable::Drawable_::Callback>(get_jobject());
}

android::graphics::drawable::DrawableContainer::DrawableContainer()
: object<android::graphics::drawable::DrawableContainer>(
	call_new_object<
		android::graphics::drawable::DrawableContainer::J2CPP_CLASS_NAME,
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_NAME(0),
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_SIGNATURE(0)
	>()
)
{
}

void android::graphics::drawable::DrawableContainer::draw(local_ref< android::graphics::Canvas > const &a0)
{
	return call_method<
		android::graphics::drawable::DrawableContainer::J2CPP_CLASS_NAME,
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_NAME(1),
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_SIGNATURE(1),
		void
	>(get_jobject(), a0);
}

jint android::graphics::drawable::DrawableContainer::getChangingConfigurations()
{
	return call_method<
		android::graphics::drawable::DrawableContainer::J2CPP_CLASS_NAME,
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_NAME(2),
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_SIGNATURE(2),
		jint
	>(get_jobject());
}

jboolean android::graphics::drawable::DrawableContainer::getPadding(local_ref< android::graphics::Rect > const &a0)
{
	return call_method<
		android::graphics::drawable::DrawableContainer::J2CPP_CLASS_NAME,
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_NAME(3),
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_SIGNATURE(3),
		jboolean
	>(get_jobject(), a0);
}

void android::graphics::drawable::DrawableContainer::setAlpha(jint a0)
{
	return call_method<
		android::graphics::drawable::DrawableContainer::J2CPP_CLASS_NAME,
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_NAME(4),
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_SIGNATURE(4),
		void
	>(get_jobject(), a0);
}

void android::graphics::drawable::DrawableContainer::setDither(jboolean a0)
{
	return call_method<
		android::graphics::drawable::DrawableContainer::J2CPP_CLASS_NAME,
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_NAME(5),
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_SIGNATURE(5),
		void
	>(get_jobject(), a0);
}

void android::graphics::drawable::DrawableContainer::setColorFilter(local_ref< android::graphics::ColorFilter > const &a0)
{
	return call_method<
		android::graphics::drawable::DrawableContainer::J2CPP_CLASS_NAME,
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_NAME(6),
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_SIGNATURE(6),
		void
	>(get_jobject(), a0);
}

jboolean android::graphics::drawable::DrawableContainer::isStateful()
{
	return call_method<
		android::graphics::drawable::DrawableContainer::J2CPP_CLASS_NAME,
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_NAME(8),
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_SIGNATURE(8),
		jboolean
	>(get_jobject());
}

jint android::graphics::drawable::DrawableContainer::getIntrinsicWidth()
{
	return call_method<
		android::graphics::drawable::DrawableContainer::J2CPP_CLASS_NAME,
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_NAME(11),
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_SIGNATURE(11),
		jint
	>(get_jobject());
}

jint android::graphics::drawable::DrawableContainer::getIntrinsicHeight()
{
	return call_method<
		android::graphics::drawable::DrawableContainer::J2CPP_CLASS_NAME,
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_NAME(12),
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_SIGNATURE(12),
		jint
	>(get_jobject());
}

jint android::graphics::drawable::DrawableContainer::getMinimumWidth()
{
	return call_method<
		android::graphics::drawable::DrawableContainer::J2CPP_CLASS_NAME,
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_NAME(13),
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_SIGNATURE(13),
		jint
	>(get_jobject());
}

jint android::graphics::drawable::DrawableContainer::getMinimumHeight()
{
	return call_method<
		android::graphics::drawable::DrawableContainer::J2CPP_CLASS_NAME,
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_NAME(14),
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_SIGNATURE(14),
		jint
	>(get_jobject());
}

void android::graphics::drawable::DrawableContainer::invalidateDrawable(local_ref< android::graphics::drawable::Drawable > const &a0)
{
	return call_method<
		android::graphics::drawable::DrawableContainer::J2CPP_CLASS_NAME,
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_NAME(15),
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_SIGNATURE(15),
		void
	>(get_jobject(), a0);
}

void android::graphics::drawable::DrawableContainer::scheduleDrawable(local_ref< android::graphics::drawable::Drawable > const &a0, local_ref< java::lang::Runnable > const &a1, jlong a2)
{
	return call_method<
		android::graphics::drawable::DrawableContainer::J2CPP_CLASS_NAME,
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_NAME(16),
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_SIGNATURE(16),
		void
	>(get_jobject(), a0, a1, a2);
}

void android::graphics::drawable::DrawableContainer::unscheduleDrawable(local_ref< android::graphics::drawable::Drawable > const &a0, local_ref< java::lang::Runnable > const &a1)
{
	return call_method<
		android::graphics::drawable::DrawableContainer::J2CPP_CLASS_NAME,
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_NAME(17),
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_SIGNATURE(17),
		void
	>(get_jobject(), a0, a1);
}

jboolean android::graphics::drawable::DrawableContainer::setVisible(jboolean a0, jboolean a1)
{
	return call_method<
		android::graphics::drawable::DrawableContainer::J2CPP_CLASS_NAME,
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_NAME(18),
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_SIGNATURE(18),
		jboolean
	>(get_jobject(), a0, a1);
}

jint android::graphics::drawable::DrawableContainer::getOpacity()
{
	return call_method<
		android::graphics::drawable::DrawableContainer::J2CPP_CLASS_NAME,
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_NAME(19),
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_SIGNATURE(19),
		jint
	>(get_jobject());
}

jboolean android::graphics::drawable::DrawableContainer::selectDrawable(jint a0)
{
	return call_method<
		android::graphics::drawable::DrawableContainer::J2CPP_CLASS_NAME,
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_NAME(20),
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_SIGNATURE(20),
		jboolean
	>(get_jobject(), a0);
}

local_ref< android::graphics::drawable::Drawable > android::graphics::drawable::DrawableContainer::getCurrent()
{
	return call_method<
		android::graphics::drawable::DrawableContainer::J2CPP_CLASS_NAME,
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_NAME(21),
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_SIGNATURE(21),
		local_ref< android::graphics::drawable::Drawable >
	>(get_jobject());
}

local_ref< android::graphics::drawable::Drawable_::ConstantState > android::graphics::drawable::DrawableContainer::getConstantState()
{
	return call_method<
		android::graphics::drawable::DrawableContainer::J2CPP_CLASS_NAME,
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_NAME(22),
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_SIGNATURE(22),
		local_ref< android::graphics::drawable::Drawable_::ConstantState >
	>(get_jobject());
}

local_ref< android::graphics::drawable::Drawable > android::graphics::drawable::DrawableContainer::mutate()
{
	return call_method<
		android::graphics::drawable::DrawableContainer::J2CPP_CLASS_NAME,
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_NAME(23),
		android::graphics::drawable::DrawableContainer::J2CPP_METHOD_SIGNATURE(23),
		local_ref< android::graphics::drawable::Drawable >
	>(get_jobject());
}

J2CPP_DEFINE_CLASS(android::graphics::drawable::DrawableContainer,"android/graphics/drawable/DrawableContainer")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer,0,"<init>","()V")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer,1,"draw","(Landroid/graphics/Canvas;)V")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer,2,"getChangingConfigurations","()I")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer,3,"getPadding","(Landroid/graphics/Rect;)Z")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer,4,"setAlpha","(I)V")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer,5,"setDither","(Z)V")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer,6,"setColorFilter","(Landroid/graphics/ColorFilter;)V")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer,7,"onBoundsChange","(Landroid/graphics/Rect;)V")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer,8,"isStateful","()Z")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer,9,"onStateChange","([I)Z")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer,10,"onLevelChange","(I)Z")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer,11,"getIntrinsicWidth","()I")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer,12,"getIntrinsicHeight","()I")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer,13,"getMinimumWidth","()I")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer,14,"getMinimumHeight","()I")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer,15,"invalidateDrawable","(Landroid/graphics/drawable/Drawable;)V")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer,16,"scheduleDrawable","(Landroid/graphics/drawable/Drawable;Ljava/lang/Runnable;J)V")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer,17,"unscheduleDrawable","(Landroid/graphics/drawable/Drawable;Ljava/lang/Runnable;)V")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer,18,"setVisible","(ZZ)Z")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer,19,"getOpacity","()I")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer,20,"selectDrawable","(I)Z")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer,21,"getCurrent","()Landroid/graphics/drawable/Drawable;")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer,22,"getConstantState","()Landroid/graphics/drawable/Drawable$ConstantState;")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer,23,"mutate","()Landroid/graphics/drawable/Drawable;")
J2CPP_DEFINE_METHOD(android::graphics::drawable::DrawableContainer,24,"setConstantState","(Landroid/graphics/drawable/DrawableContainer$DrawableContainerState;)V")

} //namespace j2cpp

#endif //J2CPP_ANDROID_GRAPHICS_DRAWABLE_DRAWABLECONTAINER_HPP_IMPL

#endif //J2CPP_INCLUDE_IMPLEMENTATION


text:
import {Component, Input, OnInit} from '@angular/core';
import {FormGroup, FormControl, Validators} from '@angular/forms'
import {DiveLogEntry} from './dive-log-entry';

@Component({
  selector: 'dive-log-form',
  templateUrl: 'app/dive-log-form.template.html'
})
export class DiveLogFormComponent implements OnInit {
  specialDives = [
    "Night dive",
    "Deep dive",
    "Cave dive"
  ]

  entry: DiveLogEntry = {
    site: 'Shab El Erg',
    location: 'Hurghada, Egypt',
    depth: 125,
    time: 56,
    isFavorite: true,
    special: "Deep dive"
  }

  @Input() diveLogForm: FormGroup;

  ngOnInit() {
    this.diveLogForm = new FormGroup({
      site: new FormControl(this.entry.site,
        Validators.required),
      location: new FormControl(this.entry.location,
        Validators.required),
      depth: new FormControl(this.entry.depth,
        Validators.required),
      time: new FormControl(this.entry.time,
        Validators.required),
      isFavorite: new FormControl(this.entry.isFavorite),
      special: new FormControl(this.entry.special),
      comments: new FormControl(this.entry.comments),
    });
  }

  isInvalid(controlName: string) {
    return this.diveLogForm.controls[controlName].invalid
  }

  submitted = false;
  submittedDive: DiveLogEntry;

  submitForm() {
    this.submittedDive = this.diveLogForm.value;
    this.submitted = true;
  }
}