text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>Qt 4.8: mainwindow.h Example File (graphicsview/diagramscene/mainwindow.h)</title>
  <link rel="stylesheet" type="text/css" href="style/style.css" />

  <link rel="stylesheet" type="text/css" href="style/superfish.css" />
  <link rel="stylesheet" type="text/css" href="style/narrow.css" />

      Home

    Qt Reference Documentation

Qt HOME

DEV

          DOC

BLOG

Qt 4.8

ALL VERSIONS

API Lookup

Class index

Function index

Modules

Namespaces

Global Declarations

QML elements

Qt Topics

Programming with Qt

Device UIs & Qt Quick

UI Design with Qt

Supported Platforms

Qt and Key Technologies

How-To's and Best Practices

Examples

Examples

Tutorials

Demos

QML Examples

          Search index:

          <form id="qtdocsearch" action="" onsubmit="return false;">
            <fieldset>
              <input type="text" name="searchstring" id="pageType" value="" />

 Close

All | API | Articles | Examples

 results:

            </fieldset>
          </form>

            API Lookup

Class index

Function index

Modules

Namespaces

Global Declarations

QML elements

            Qt Topics

Programming with Qt

Device UIs & Qt Quick

UI Design with Qt

Supported Platforms

Qt and Key Technologies

How-To's and Best Practices

            Examples

Examples

Tutorials

Demos

QML Examples

Home

A

A

A

                Print

mainwindow.h Example File

graphicsview/diagramscene/mainwindow.h

 #ifndef MAINWINDOW_H
 #define MAINWINDOW_H

 #include <QMainWindow>

 #include "diagramitem.h"

 class DiagramScene;

 class QAction;
 class QToolBox;
 class QSpinBox;
 class QComboBox;
 class QFontComboBox;
 class QButtonGroup;
 class QLineEdit;
 class QGraphicsTextItem;
 class QFont;
 class QToolButton;
 class QAbstractButton;
 class QGraphicsView;

 class MainWindow : public QMainWindow
 {
     Q_OBJECT

 public:
    MainWindow();

 private slots:
     void backgroundButtonGroupClicked(QAbstractButton *button);
     void buttonGroupClicked(int id);
     void deleteItem();
     void pointerGroupClicked(int id);
     void bringToFront();
     void sendToBack();
     void itemInserted(DiagramItem *item);
     void textInserted(QGraphicsTextItem *item);
     void currentFontChanged(const QFont &font);
     void fontSizeChanged(const QString &size);
     void sceneScaleChanged(const QString &scale);
     void textColorChanged();
     void itemColorChanged();
     void lineColorChanged();
     void textButtonTriggered();
     void fillButtonTriggered();
     void lineButtonTriggered();
     void handleFontChange();
     void itemSelected(QGraphicsItem *item);
     void about();

 private:
     void createToolBox();
     void createActions();
     void createMenus();
     void createToolbars();
     QWidget *createBackgroundCellWidget(const QString &text,
                                         const QString &image);
     QWidget *createCellWidget(const QString &text,
                               DiagramItem::DiagramType type);
     QMenu *createColorMenu(const char *slot, QColor defaultColor);
     QIcon createColorToolButtonIcon(const QString &image, QColor color);
     QIcon createColorIcon(QColor color);

     DiagramScene *scene;
     QGraphicsView *view;

     QAction *exitAction;
     QAction *addAction;
     QAction *deleteAction;

     QAction *toFrontAction;
     QAction *sendBackAction;
     QAction *aboutAction;

     QMenu *fileMenu;
     QMenu *itemMenu;
     QMenu *aboutMenu;

     QToolBar *textToolBar;
     QToolBar *editToolBar;
     QToolBar *colorToolBar;
     QToolBar *pointerToolbar;

     QComboBox *sceneScaleCombo;
     QComboBox *itemColorCombo;
     QComboBox *textColorCombo;
     QComboBox *fontSizeCombo;
     QFontComboBox *fontCombo;

     QToolBox *toolBox;
     QButtonGroup *buttonGroup;
     QButtonGroup *pointerTypeGroup;
     QButtonGroup *backgroundButtonGroup;
     QToolButton *fontColorToolButton;
     QToolButton *fillColorToolButton;
     QToolButton *lineColorToolButton;
     QAction *boldAction;
     QAction *underlineAction;
     QAction *italicAction;
     QAction *textAction;
     QAction *fillAction;
     QAction *lineAction;
 };

 #endif

      <acronym title="Copyright">©</acronym> 2013 Digia Plc and/or its
      subsidiaries. Documentation contributions included herein are the copyrights of
      their respective owners.

      The documentation provided herein is licensed under the terms of the
      GNU Free Documentation
      License version 1.3 as published by the Free Software Foundation.

      Documentation sources may be obtained from
      www.qt-project.org.

      Digia, Qt and their respective logos are trademarks of Digia Plc
      in Finland and/or other countries worldwide. All other trademarks are property
      of their respective owners. Privacy Policy


text:
function kern = rbfhKernExpandParam(kern, params)

% RBFHKERNEXPANDPARAM Create kernel structure from RBFH kernel's parameters.
% FORMAT
% DESC returns a radial basis function HEAT kernel structure filled with
% the parameters in the given vector. This is used as a helper function to
% enable parameters to be optimised in, for example, the NETLAB
% optimisation functions.
% ARG kern : the kernel structure in which the parameters are to be
% placed.
% ARG param : vector of parameters which are to be placed in the
% kernel structure.
% RETURN kern : kernel structure with the given parameters in the
% relevant locations.
%
% SEEALSO : rbfhKernParamInit, rbfhKernExtractParam, kernExpandParam
%
% COPYRIGHT : Mauricio A. Alvarez, 2010

% GPMAT

kern.inverseWidthTime = params(1);
kern.inverseWidthSpace = params(2);

redpajama_set_name: RedPajamaGithub


text:
static BOOL kNavigationBarIsTranslucent = NO;

@interface BMYViewController () <UITableViewDataSource, UITableViewDelegate>

@property (nonatomic, strong) UITableView *tableView;

@end

@implementation BMYViewController

- (instancetype)init {
    self = [super init];
    if (self) {
        _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
        _tableView.delegate = self;
        _tableView.dataSource = self;
        _tableView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];

    self.title = @"ScrollableNavigationBar";
    [self.view addSubview:self.tableView];

    self.enableScrollableNavigationBar = YES;
    [self.navigationController.navigationBar setBarTintColor:[UIColor colorWithRed:209.0f/255.0f green:0.0f/255.0f blue:58.0f/255.0f    alpha:1.0f]];

    self.tableView.frame = self.view.bounds;
    [self.navigationController.navigationBar setTranslucent:kNavigationBarIsTranslucent];
    [self bindNavigationBarToScrollView:self.tableView];
}

- (void)refresh {
    [self.tableView reloadData];
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 30;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@""];
    cell.textLabel.text = [NSString stringWithFormat:@"Cell #%d", (int)indexPath.row];
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    BMYViewController *vc = [[BMYViewController alloc] init];
    [self.navigationController pushViewController:vc animated:YES];
}

@end


Message: IQueryableErrors.QueryableOfUnsupported is of type IQueryable, but the argument is not a realm object.

Message: IQueryableErrors.QueryableWithGetters has a setter but also has [Backlink] applied, which only supports getters.


text:
package org.hoteia.qalingo.web.mvc.controller.batch;

import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;

import org.apache.commons.lang.StringUtils;
import org.hoteia.qalingo.core.Constants;
import org.hoteia.qalingo.core.RequestConstants;
import org.hoteia.qalingo.core.domain.BatchProcessObject;
import org.hoteia.qalingo.core.domain.EngineSetting;
import org.hoteia.qalingo.core.domain.enumtype.BatchProcessObjectType;
import org.hoteia.qalingo.core.domain.enumtype.BoUrls;
import org.hoteia.qalingo.core.pojo.RequestData;
import org.hoteia.qalingo.core.service.BatchProcessObjectService;
import org.hoteia.qalingo.core.service.EngineSettingService;
import org.hoteia.qalingo.core.web.mvc.form.BatchValueForm;
import org.hoteia.qalingo.core.web.mvc.viewbean.BatchViewBean;
import org.hoteia.qalingo.core.web.mvc.viewbean.LinkMenuViewBean;
import org.hoteia.qalingo.core.web.servlet.ModelAndViewThemeDevice;
import org.hoteia.qalingo.web.mvc.controller.AbstractTechnicalBackofficeController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.support.PagedListHolder;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

/**
 *
 */
@Controller("batchController")
public class BatchController extends AbstractTechnicalBackofficeController {

	@Autowired
	protected BatchProcessObjectService batchProcessObjectService;

	@Autowired
	protected EngineSettingService engineSettingService;

	@RequestMapping("/search-batch.html*")
	public ModelAndView searchBatch(final HttpServletRequest request, final HttpServletResponse response) throws Exception {
		ModelAndViewThemeDevice modelAndView = new ModelAndViewThemeDevice(getCurrentVelocityPath(request), BoUrls.BATCH.getVelocityPage());
		final RequestData requestData = requestUtil.getRequestData(request);

		backofficeFormFactory.buildBatchQuickSearchForm(requestData);

        return modelAndView;
	}

	@RequestMapping(value = BoUrls.BATCH_URL, method = RequestMethod.GET)
	public ModelAndView batchSuccessAndError(final HttpServletRequest request, final Model model) throws Exception {
		ModelAndViewThemeDevice modelAndView = new ModelAndViewThemeDevice(getCurrentVelocityPath(request), BoUrls.BATCH.getVelocityPage());

        final RequestData requestData = requestUtil.getRequestData(request);
        final Locale locale = requestData.getLocale();

		List<BatchProcessObject> batchProcessObjects = batchProcessObjectService.findBatchProcessObjects();//batchProcessObjectService.findBatchProcessObjectsByTypeObject(BatchProcessObjectType.Customer);
		initPaginationResult(request, modelAndView, batchProcessObjects);
		initLinks(request, modelAndView, locale);

		EngineSetting springBatchUrlEngineSetting = engineSettingService.getEngineSettingByCode(EngineSettingService.ENGINE_SETTING_CODE_SPRING_BATCH_URL);
		String springBatchUrl = springBatchUrlEngineSetting.getEngineSettingValue(EngineSettingService.ENGINE_SETTING_CONTEXT_CRM).getValue();
		modelAndView.addObject("springBatchUrl", springBatchUrl);

		String tab =  request.getParameter(RequestConstants.REQUEST_PARAMETER_TAB);
		/**
		 * Save the user selected Tab page, when reset, still stuck in this tag page
		 * so that the user experience better. That is, when user can click
		 * one time mouse to complete an action, do not let user more than a few
		 * mouse clicks to complete the action
		 * */
		if(null == tab){
			tab = "0";
		}
		modelAndView.addObject("tab", tab);

        return modelAndView;
	}

	@RequestMapping(value = BoUrls.BATCH_URL, method = RequestMethod.POST)
	public ModelAndView batchReset(final HttpServletRequest request, final Model model, @Valid BatchValueForm batchValueForm,
			BindingResult result, ModelMap modelMap) throws Exception {

		final String id = batchValueForm.getId();

		final BatchProcessObject batchProcessObject = batchProcessObjectService.getBatchProcessObjectById(id);
		if (null != batchProcessObject) {
			batchProcessObject.setProcessedCount(0);
			// UPDATE PROCESSED_COUNT
			batchProcessObjectService.saveOrUpdateBatchProcessObject(batchProcessObject);

		}

        return batchSuccessAndError(request,model);
	}

	@RequestMapping(value = "/batch-customer.html*", method = RequestMethod.GET)
	public ModelAndView batchCustomer(final HttpServletRequest request, final HttpServletResponse response) throws Exception {
		ModelAndViewThemeDevice modelAndView = new ModelAndViewThemeDevice(getCurrentVelocityPath(request), BoUrls.BATCH.getVelocityPage());

        final RequestData requestData = requestUtil.getRequestData(request);
        final Locale locale = requestData.getLocale();

		List<BatchProcessObject> batchProcessObjects = batchProcessObjectService.findBatchProcessObjects();//batchProcessObjectService.findBatchProcessObjectsByTypeObject(BatchProcessObjectType.Customer);
		initPaginationResult(request, modelAndView, batchProcessObjects);
		initLinks(request, modelAndView, locale);

		EngineSetting springBatchUrlEngineSetting = engineSettingService.getEngineSettingByCode(EngineSettingService.ENGINE_SETTING_CODE_SPRING_BATCH_URL);
		String springBatchUrl = springBatchUrlEngineSetting.getEngineSettingValue(EngineSettingService.ENGINE_SETTING_CONTEXT_CRM).getValue();
		modelAndView.addObject("springBatchUrl", springBatchUrl);

        return modelAndView;
	}

	@RequestMapping(value = "/batch-order.html*", method = RequestMethod.GET)
	public ModelAndView batchOrder(final HttpServletRequest request, final HttpServletResponse response) throws Exception {
		ModelAndViewThemeDevice modelAndView = new ModelAndViewThemeDevice(getCurrentVelocityPath(request), BoUrls.BATCH.getVelocityPage());

        final RequestData requestData = requestUtil.getRequestData(request);
        final Locale locale = requestData.getLocale();

		List<BatchProcessObject> batchProcessObjects = batchProcessObjectService.findBatchProcessObjectsByTypeObject(BatchProcessObjectType.Order);
		initPaginationResult(request, modelAndView, batchProcessObjects);
		initLinks(request, modelAndView, locale);

		EngineSetting springBatchUrlEngineSetting = engineSettingService.getEngineSettingByCode(EngineSettingService.ENGINE_SETTING_CODE_SPRING_BATCH_URL);
		String springBatchUrl = springBatchUrlEngineSetting.getEngineSettingValue(EngineSettingService.ENGINE_SETTING_CONTEXT_CRM).getValue();
		modelAndView.addObject("springBatchUrl", springBatchUrl);

        return modelAndView;
	}

	@RequestMapping(value = "/batch-email.html*", method = RequestMethod.GET)
	public ModelAndView batchEmail(final HttpServletRequest request, final HttpServletResponse response) throws Exception {
		ModelAndViewThemeDevice modelAndView = new ModelAndViewThemeDevice(getCurrentVelocityPath(request), BoUrls.BATCH.getVelocityPage());

        final RequestData requestData = requestUtil.getRequestData(request);
        final Locale locale = requestData.getLocale();

		List<BatchProcessObject> batchProcessObjects = batchProcessObjectService.findBatchProcessObjectsByTypeObject(BatchProcessObjectType.Email);
		initPaginationResult(request, modelAndView, batchProcessObjects);
		initLinks(request, modelAndView, locale);

		EngineSetting springBatchUrlEngineSetting = engineSettingService.getEngineSettingByCode(EngineSettingService.ENGINE_SETTING_CODE_SPRING_BATCH_URL);
		String springBatchUrl = springBatchUrlEngineSetting.getEngineSettingValue(EngineSettingService.ENGINE_SETTING_CONTEXT_NOTIFICATION).getValue();
		modelAndView.addObject("springBatchUrl", springBatchUrl);

        return modelAndView;
	}

	@RequestMapping(value = "/batch-cms.html*", method = RequestMethod.GET)
	public ModelAndView batchCms(final HttpServletRequest request, final HttpServletResponse response) throws Exception {
		ModelAndViewThemeDevice modelAndView = new ModelAndViewThemeDevice(getCurrentVelocityPath(request), BoUrls.BATCH.getVelocityPage());

        final RequestData requestData = requestUtil.getRequestData(request);
        final Locale locale = requestData.getLocale();

		List<BatchProcessObject> batchProcessObjects = batchProcessObjectService.findBatchProcessObjectsByTypeObject(BatchProcessObjectType.Cms);
		initPaginationResult(request, modelAndView, batchProcessObjects);
		initLinks(request, modelAndView, locale);

		EngineSetting springBatchUrlEngineSetting = engineSettingService.getEngineSettingByCode(EngineSettingService.ENGINE_SETTING_CODE_SPRING_BATCH_URL);
		String springBatchUrl = springBatchUrlEngineSetting.getEngineSettingValue(EngineSettingService.ENGINE_SETTING_CONTEXT_CMS).getValue();
		modelAndView.addObject("springBatchUrl", springBatchUrl);

        return modelAndView;
	}

	@RequestMapping(value = "/batch-stock.html*", method = RequestMethod.GET)
	public ModelAndView batchStock(final HttpServletRequest request, final HttpServletResponse response) throws Exception {
		ModelAndViewThemeDevice modelAndView = new ModelAndViewThemeDevice(getCurrentVelocityPath(request), BoUrls.BATCH.getVelocityPage());

        final RequestData requestData = requestUtil.getRequestData(request);
        final Locale locale = requestData.getLocale();

		List<BatchProcessObject> batchProcessObjects = batchProcessObjectService.findBatchProcessObjectsByTypeObject(BatchProcessObjectType.Stock);
		initPaginationResult(request, modelAndView, batchProcessObjects);
		initLinks(request, modelAndView, locale);

		EngineSetting springBatchUrlEngineSetting = engineSettingService.getEngineSettingByCode(EngineSettingService.ENGINE_SETTING_CODE_SPRING_BATCH_URL);
		String springBatchUrl = springBatchUrlEngineSetting.getEngineSettingValue(EngineSettingService.ENGINE_SETTING_CONTEXT_ERP).getValue();
		modelAndView.addObject("springBatchUrl", springBatchUrl);

        return modelAndView;
	}

	protected void initPaginationResult(final HttpServletRequest request, final ModelAndViewThemeDevice modelAndView, final List<BatchProcessObject> batchProcessObjects) throws Exception {
	    final RequestData requestData = requestUtil.getRequestData(request);

		String url = requestUtil.getCurrentRequestUrl(request);

		String sessionKey = "PagedListHolder_Search_List_Product_" + request.getSession().getId();
        String page = request.getParameter(Constants.PAGINATION_PAGE_PARAMETER);
		PagedListHolder<BatchViewBean> batchViewBeanPagedListHolder;

        if(StringUtils.isEmpty(page)){
        	batchViewBeanPagedListHolder = initList(request, sessionKey, batchProcessObjects, new PagedListHolder<BatchViewBean>());
        } else {
	        batchViewBeanPagedListHolder = (PagedListHolder) request.getSession().getAttribute(sessionKey);
	        if (batchViewBeanPagedListHolder == null) {
	        	batchViewBeanPagedListHolder = initList(request, sessionKey, batchProcessObjects, batchViewBeanPagedListHolder);
	        }
	        int pageTarget = new Integer(page).intValue() - 1;
	        int pageCurrent = batchViewBeanPagedListHolder.getPage();
	        if (pageCurrent < pageTarget) {
	        	for (int i = pageCurrent; i < pageTarget; i++) {
	        		batchViewBeanPagedListHolder.nextPage();
				}
	        } else if (pageCurrent > pageTarget) {
	        	for (int i = pageTarget; i < pageCurrent; i++) {
		        	batchViewBeanPagedListHolder.previousPage();
				}
	        }
        }
		modelAndView.addObject(Constants.PAGINATION_PAGE_URL, url);
		modelAndView.addObject(Constants.PAGINATION_PAGE_PAGED_LIST_HOLDER, batchViewBeanPagedListHolder);

		backofficeFormFactory.buildBatchQuickSearchForm(requestData);
	}

	protected PagedListHolder<BatchViewBean> initList(final HttpServletRequest request, final String sessionKey,
			final List<BatchProcessObject> batchProcessObjects, PagedListHolder<BatchViewBean> batchViewBeanPagedListHolder) throws Exception{
		List<BatchViewBean> batchViewBeans = backofficeViewBeanFactory.buildListViewBeanBatch(requestUtil.getRequestData(request), batchProcessObjects);
		batchViewBeanPagedListHolder = new PagedListHolder<BatchViewBean>(batchViewBeans);

		batchViewBeanPagedListHolder.setPageSize(Constants.PAGINATION_DEFAULT_PAGE_SIZE);
		String pageSize = engineSettingService.getEngineSettingValueByCode(EngineSettingService.ENGINE_SETTING_CODE_COUNT_ITEM_BY_PAGE, EngineSettingService.ENGINE_SETTING_CONTEXT_BO_TECHNICAL_ENGINE_SETTING_LIST);
		if(StringUtils.isNotEmpty(pageSize)){
			batchViewBeanPagedListHolder.setPageSize(Integer.parseInt(pageSize));
		}

        request.getSession().setAttribute(sessionKey, batchViewBeanPagedListHolder);
        return batchViewBeanPagedListHolder;
	}

	protected void initLinks(final HttpServletRequest request, final ModelAndViewThemeDevice modelAndView, final Locale locale) throws Exception{
		List<LinkMenuViewBean> batchLinks = new ArrayList<LinkMenuViewBean>();

		LinkMenuViewBean linkMenuViewBean = new LinkMenuViewBean();
		linkMenuViewBean.setName(coreMessageSource.getMessage("header.menu.batch.customer.list", locale));
		linkMenuViewBean.setUrl(backofficeUrlService.generateUrl(BoUrls.BATCH_CUSTOMER, requestUtil.getRequestData(request)));
		batchLinks.add(linkMenuViewBean);

		linkMenuViewBean = new LinkMenuViewBean();
		linkMenuViewBean.setName(coreMessageSource.getMessage("header.menu.batch.order.list", locale));
		linkMenuViewBean.setUrl(backofficeUrlService.generateUrl(BoUrls.BATCH_ORDER, requestUtil.getRequestData(request)));
		batchLinks.add(linkMenuViewBean);

		linkMenuViewBean = new LinkMenuViewBean();
		linkMenuViewBean.setName(coreMessageSource.getMessage("header.menu.batch.email.list", locale));
		linkMenuViewBean.setUrl(backofficeUrlService.generateUrl(BoUrls.BATCH_EMAIL, requestUtil.getRequestData(request)));
		batchLinks.add(linkMenuViewBean);

		linkMenuViewBean = new LinkMenuViewBean();
		linkMenuViewBean.setName(coreMessageSource.getMessage("header.menu.batch.cms.list", locale));
		linkMenuViewBean.setUrl(backofficeUrlService.generateUrl(BoUrls.BATCH_CMS, requestUtil.getRequestData(request)));
		batchLinks.add(linkMenuViewBean);

		linkMenuViewBean = new LinkMenuViewBean();
		linkMenuViewBean.setName(coreMessageSource.getMessage("header.menu.batch.stock.list", locale));
		linkMenuViewBean.setUrl(backofficeUrlService.generateUrl(BoUrls.BATCH_STOCK, requestUtil.getRequestData(request)));
		batchLinks.add(linkMenuViewBean);

		modelAndView.addObject("links", batchLinks);
	}

}


text:
CREATE TABLE IF NOT EXISTS lake_cusum
(
lake_cusum_key serial primary key,
Trading_Date date,
Cusum double precision,
Lake varchar(12),
Unit varchar(3),
UNIQUE(Trading_Date, Lake)
);


text:
#include "globals.h"
#include "operator.h"

#include <iostream>
using namespace std;

Prevail::Prevail(istream &in) {
    in >> var >> prev;
}

PrePost::PrePost(istream &in) {
    int condCount;
    in >> condCount;
    for (int i = 0; i < condCount; i++)
        cond.push_back(Prevail(in));
    in >> var >> pre >> post;
}

Operator::Operator(istream &in, bool axiom) {
    marked = false;

    is_an_axiom = axiom;
    if (!is_an_axiom) {
        check_magic(in, "begin_operator");
        in >> ws;
        getline(in, name);
        int count;
        in >> count;
        for (int i = 0; i < count; i++)
            prevail.push_back(Prevail(in));
        in >> count;
        for (int i = 0; i < count; i++)
            pre_post.push_back(PrePost(in));

        if (g_legacy_file_format) {
            cost = 1;
        } else {
            int op_cost;
            in >> op_cost;
            cost = g_use_metric ? op_cost : 1;
        }
        g_min_action_cost = min(g_min_action_cost, cost);
        g_max_action_cost = max(g_max_action_cost, cost);

        check_magic(in, "end_operator");
    } else {
        name = "<axiom>";
        cost = 0;
        check_magic(in, "begin_rule");
        pre_post.push_back(PrePost(in));
        check_magic(in, "end_rule");
    }

    marker1 = marker2 = false;
}

void Prevail::dump() const {
    cout << g_variable_name[var] << ": " << prev;
}

void PrePost::dump() const {
    cout << g_variable_name[var] << ": " << pre << " => " << post;
    if (!cond.empty()) {
        cout << " if";
        for (int i = 0; i < cond.size(); i++) {
            cout << " ";
            cond[i].dump();
        }
    }
}

void Operator::dump() const {
    cout << name << ":";
    for (int i = 0; i < prevail.size(); i++) {
        cout << " [";
        prevail[i].dump();
        cout << "]";
    }
    for (int i = 0; i < pre_post.size(); i++) {
        cout << " [";
        pre_post[i].dump();
        cout << "]";
    }
    cout << endl;
}

/* [raz-ipc-integration] HACK HACK HACK: The following
   code was added for the IPC integration.
 */

//TODO - not using this now - verify that this method actually gives the distance...
int Operator::get_distance_from_op(const Operator *other_op) {
    int distance = 0;
    //PRE_POST
    const vector<PrePost> &other_pre_post = other_op->pre_post;
    for (int cond_idx = 0; cond_idx < pre_post.size(); cond_idx++) {
        bool contains_condition = false;
        for (int other_cond_idx = 0; other_cond_idx < other_pre_post.size(); other_cond_idx++) {
            if (pre_post[cond_idx] == other_pre_post[other_cond_idx]) {
                contains_condition = true;
                break;
            }
        }
        if (!contains_condition)
            distance++;
    }

    for (int other_cond_idx = 0; other_cond_idx < other_pre_post.size(); other_cond_idx++) {
        bool contains_condition = false;
        for (int cond_idx = 0; cond_idx < pre_post.size(); cond_idx++) {
            if (pre_post[cond_idx] == other_pre_post[other_cond_idx]) {
                contains_condition = true;
                break;
            }
        }
        if (!contains_condition)
            distance++;
    }
    //PREVAIL
    const vector<Prevail> &other_prevail = other_op->prevail;
    for (int cond_idx = 0; cond_idx < prevail.size(); cond_idx++) {
        bool contains_condition = false;
        for (int other_cond_idx = 0; other_cond_idx < other_prevail.size(); other_cond_idx++) {
            if (prevail[cond_idx] == other_prevail[other_cond_idx]) {
                contains_condition = true;
                break;
            }
        }
        if (!contains_condition)
            distance++;
    }

    for (int other_cond_idx = 0; other_cond_idx < other_prevail.size(); other_cond_idx++) {
        bool contains_condition = false;
        for (int cond_idx = 0; cond_idx < prevail.size(); cond_idx++) {
            if (prevail[cond_idx] == other_prevail[other_cond_idx]) {
                contains_condition = true;
                break;
            }
        }
        if (!contains_condition)
            distance++;
    }
    return distance;
}

bool Operator::have_same_op_name(const Operator *other_op) const {
    return name.compare(0, name.find(' '), other_op->name.substr(0, other_op->name.find(' '))) == 0;
}

bool Operator::affect_a_common_variable(const Operator *other_op) const {
    for (int i = 0; i < pre_post.size(); i++) {
        int var = pre_post[i].var;
        for (int j = 0; j < other_op->pre_post.size(); j++)
            if (other_op->pre_post[j].var == var)
                return true;
    }
    return false;
}


text:
from .prefix import prefix_spec, A1, E1
from . import L3
from .register import PrefixReg

__all__  = 'A1 E1 L3'.split()


text:
<?xml version="1.0" encoding="UTF-8"?>
<dxl:DXLMessage xmlns:dxl="http://greenplum.com/dxl/2010/12/">
  <dxl:Statistics>
    <dxl:DerivedRelationStats Rows="5.000000" EmptyRelation="false">
      <dxl:DerivedColumnStats ColId="113" Width="4.000000" NullFreq="0.000000" NdvRemain="0.000000" FreqRemain="0.000000">
        <dxl:StatsBucket Frequency="0.800000" DistinctValues="1.000000">
          <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" IsNull="false" IsByValue="true" Value="2001"/>
          <dxl:UpperBound Closed="true" TypeMdid="0.23.1.0" IsNull="false" IsByValue="true" Value="2001"/>
        </dxl:StatsBucket>
        <dxl:StatsBucket Frequency="0.200000" DistinctValues="1.000000">
          <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" IsNull="false" IsByValue="true" Value="2002"/>
          <dxl:UpperBound Closed="true" TypeMdid="0.23.1.0" IsNull="false" IsByValue="true" Value="2002"/>
        </dxl:StatsBucket>
      </dxl:DerivedColumnStats>
      <dxl:DerivedColumnStats ColId="142" Width="8.000000" NullFreq="0.000000" NdvRemain="0.000000" FreqRemain="0.000000">
        <dxl:StatsBucket Frequency="1.000000" DistinctValues="1.000000">
          <dxl:LowerBound Closed="true" TypeMdid="0.25.1.0" IsNull="false" IsByValue="false" Value="AAAABXc=" LintValue="160621100"/>
          <dxl:UpperBound Closed="true" TypeMdid="0.25.1.0" IsNull="false" IsByValue="false" Value="AAAABXc=" LintValue="160621100"/>
        </dxl:StatsBucket>
      </dxl:DerivedColumnStats>
    </dxl:DerivedRelationStats>
  </dxl:Statistics>
</dxl:DXLMessage>


text:
namespace es1
{
	using namespace sw;

	Device::Device(Context *context) : Renderer(context, OpenGL, true), context(context)
	{
		renderTarget = nullptr;
		depthBuffer = nullptr;
		stencilBuffer = nullptr;

		setDepthBufferEnable(true);
		setFillMode(FILL_SOLID);
		setShadingMode(SHADING_GOURAUD);
		setDepthWriteEnable(true);
		setAlphaTestEnable(false);
		setSourceBlendFactor(BLEND_ONE);
		setDestBlendFactor(BLEND_ZERO);
		setCullMode(CULL_COUNTERCLOCKWISE, true);
		setDepthCompare(DEPTH_LESSEQUAL);
		setAlphaReference(0.0f);
		setAlphaCompare(ALPHA_ALWAYS);
		setAlphaBlendEnable(false);
		setFogEnable(false);
		setSpecularEnable(true);
		setLocalViewer(false);
		setFogColor(0);
		setPixelFogMode(FOG_NONE);
		setFogStart(0.0f);
		setFogEnd(1.0f);
		setFogDensity(1.0f);
		setRangeFogEnable(false);
		setStencilEnable(false);
		setStencilFailOperation(OPERATION_KEEP);
		setStencilZFailOperation(OPERATION_KEEP);
		setStencilPassOperation(OPERATION_KEEP);
		setStencilCompare(STENCIL_ALWAYS);
		setStencilReference(0);
		setStencilMask(0xFFFFFFFF);
		setStencilWriteMask(0xFFFFFFFF);
		setVertexFogMode(FOG_NONE);
		setClipFlags(0);
		setPointSize(1.0f);
		setPointSizeMin(0.125f);
        setPointSizeMax(8192.0f);
		setColorWriteMask(0, 0x0000000F);
		setBlendOperation(BLENDOP_ADD);
		scissorEnable = false;
		setSlopeDepthBias(0.0f);
		setTwoSidedStencil(false);
		setStencilFailOperationCCW(OPERATION_KEEP);
		setStencilZFailOperationCCW(OPERATION_KEEP);
		setStencilPassOperationCCW(OPERATION_KEEP);
		setStencilCompareCCW(STENCIL_ALWAYS);
		setColorWriteMask(1, 0x0000000F);
		setColorWriteMask(2, 0x0000000F);
		setColorWriteMask(3, 0x0000000F);
		setBlendConstant(0xFFFFFFFF);
		setWriteSRGB(false);
		setDepthBias(0.0f);
		setSeparateAlphaBlendEnable(false);
		setSourceBlendFactorAlpha(BLEND_ONE);
		setDestBlendFactorAlpha(BLEND_ZERO);
		setBlendOperationAlpha(BLENDOP_ADD);
		setPointSpriteEnable(true);

		for(int i = 0; i < 16; i++)
		{
			setAddressingModeU(sw::SAMPLER_PIXEL, i, ADDRESSING_WRAP);
			setAddressingModeV(sw::SAMPLER_PIXEL, i, ADDRESSING_WRAP);
			setAddressingModeW(sw::SAMPLER_PIXEL, i, ADDRESSING_WRAP);
			setBorderColor(sw::SAMPLER_PIXEL, i, 0x00000000);
			setTextureFilter(sw::SAMPLER_PIXEL, i, FILTER_POINT);
			setMipmapFilter(sw::SAMPLER_PIXEL, i, MIPMAP_NONE);
			setMipmapLOD(sw::SAMPLER_PIXEL, i, 0.0f);
		}

		for(int i = 0; i < 4; i++)
		{
			setAddressingModeU(sw::SAMPLER_VERTEX, i, ADDRESSING_WRAP);
			setAddressingModeV(sw::SAMPLER_VERTEX, i, ADDRESSING_WRAP);
			setAddressingModeW(sw::SAMPLER_VERTEX, i, ADDRESSING_WRAP);
			setBorderColor(sw::SAMPLER_VERTEX, i, 0x00000000);
			setTextureFilter(sw::SAMPLER_VERTEX, i, FILTER_POINT);
			setMipmapFilter(sw::SAMPLER_VERTEX, i, MIPMAP_NONE);
			setMipmapLOD(sw::SAMPLER_VERTEX, i, 0.0f);
		}

		for(int i = 0; i < 6; i++)
		{
			float plane[4] = {0, 0, 0, 0};

			setClipPlane(i, plane);
		}
	}

	Device::~Device()
	{
		if(renderTarget)
		{
			renderTarget->release();
			renderTarget = nullptr;
		}

		if(depthBuffer)
		{
			depthBuffer->release();
			depthBuffer = nullptr;
		}

		if(stencilBuffer)
		{
			stencilBuffer->release();
			stencilBuffer = nullptr;
		}

		delete context;
	}

	// This object has to be mem aligned
	void* Device::operator new(size_t size)
	{
		ASSERT(size == sizeof(Device)); // This operator can't be called from a derived class
		return sw::allocate(sizeof(Device), 16);
	}

	void Device::operator delete(void * mem)
	{
		sw::deallocate(mem);
	}

	void Device::clearColor(float red, float green, float blue, float alpha, unsigned int rgbaMask)
	{
		if(!renderTarget || !rgbaMask)
		{
			return;
		}

		float rgba[4];
		rgba[0] = red;
		rgba[1] = green;
		rgba[2] = blue;
		rgba[3] = alpha;

		sw::Rect clearRect = renderTarget->getRect();

		if(scissorEnable)
		{
			clearRect.clip(scissorRect.x0, scissorRect.y0, scissorRect.x1, scissorRect.y1);
		}

		clear(rgba, FORMAT_A32B32G32R32F, renderTarget, clearRect, rgbaMask);
	}

	void Device::clearDepth(float z)
	{
		if(!depthBuffer)
		{
			return;
		}

		z = clamp01(z);
		sw::Rect clearRect = depthBuffer->getRect();

		if(scissorEnable)
		{
			clearRect.clip(scissorRect.x0, scissorRect.y0, scissorRect.x1, scissorRect.y1);
		}

		depthBuffer->clearDepth(z, clearRect.x0, clearRect.y0, clearRect.width(), clearRect.height());
	}

	void Device::clearStencil(unsigned int stencil, unsigned int mask)
	{
		if(!stencilBuffer)
		{
			return;
		}

		sw::Rect clearRect = stencilBuffer->getRect();

		if(scissorEnable)
		{
			clearRect.clip(scissorRect.x0, scissorRect.y0, scissorRect.x1, scissorRect.y1);
		}

		stencilBuffer->clearStencil(stencil, mask, clearRect.x0, clearRect.y0, clearRect.width(), clearRect.height());
	}

	void Device::drawIndexedPrimitive(sw::DrawType type, unsigned int indexOffset, unsigned int primitiveCount)
	{
		if(!bindResources() || !primitiveCount)
		{
			return;
		}

		draw(type, indexOffset, primitiveCount);
	}

	void Device::drawPrimitive(sw::DrawType type, unsigned int primitiveCount)
	{
		if(!bindResources() || !primitiveCount)
		{
			return;
		}

		setIndexBuffer(nullptr);

		draw(type, 0, primitiveCount);
	}

	void Device::setScissorEnable(bool enable)
	{
		scissorEnable = enable;
	}

	void Device::setRenderTarget(int index, egl::Image *renderTarget)
	{
		if(renderTarget)
		{
			renderTarget->addRef();
		}

		if(this->renderTarget)
		{
			this->renderTarget->release();
		}

		this->renderTarget = renderTarget;

		Renderer::setRenderTarget(index, renderTarget);
	}

	void Device::setDepthBuffer(egl::Image *depthBuffer)
	{
		if(this->depthBuffer == depthBuffer)
		{
			return;
		}

		if(depthBuffer)
		{
			depthBuffer->addRef();
		}

		if(this->depthBuffer)
		{
			this->depthBuffer->release();
		}

		this->depthBuffer = depthBuffer;

		Renderer::setDepthBuffer(depthBuffer);
	}

	void Device::setStencilBuffer(egl::Image *stencilBuffer)
	{
		if(this->stencilBuffer == stencilBuffer)
		{
			return;
		}

		if(stencilBuffer)
		{
			stencilBuffer->addRef();
		}

		if(this->stencilBuffer)
		{
			this->stencilBuffer->release();
		}

		this->stencilBuffer = stencilBuffer;

		Renderer::setStencilBuffer(stencilBuffer);
	}

	void Device::setScissorRect(const sw::Rect &rect)
	{
		scissorRect = rect;
	}

	void Device::setViewport(const Viewport &viewport)
	{
		this->viewport = viewport;
	}

	bool Device::stretchRect(sw::Surface *source, const sw::SliceRect *sourceRect, sw::Surface *dest, const sw::SliceRect *destRect, bool filter)
	{
		if(!source || !dest || !validRectangle(sourceRect, source) || !validRectangle(destRect, dest))
		{
			ERR("Invalid parameters");
			return false;
		}

		int sWidth = source->getWidth();
		int sHeight = source->getHeight();
		int dWidth = dest->getWidth();
		int dHeight = dest->getHeight();

		SliceRect sRect;
		SliceRect dRect;

		if(sourceRect)
		{
			sRect = *sourceRect;
		}
		else
		{
			sRect.y0 = 0;
			sRect.x0 = 0;
			sRect.y1 = sHeight;
			sRect.x1 = sWidth;
		}

		if(destRect)
		{
			dRect = *destRect;
		}
		else
		{
			dRect.y0 = 0;
			dRect.x0 = 0;
			dRect.y1 = dHeight;
			dRect.x1 = dWidth;
		}

		bool scaling = (sRect.x1 - sRect.x0 != dRect.x1 - dRect.x0) || (sRect.y1 - sRect.y0 != dRect.y1 - dRect.y0);
		bool equalFormats = source->getInternalFormat() == dest->getInternalFormat();
		bool depthStencil = egl::Image::isDepth(source->getInternalFormat()) || egl::Image::isStencil(source->getInternalFormat());
		bool alpha0xFF = false;

		if((source->getInternalFormat() == FORMAT_A8R8G8B8 && dest->getInternalFormat() == FORMAT_X8R8G8B8) ||
		   (source->getInternalFormat() == FORMAT_X8R8G8B8 && dest->getInternalFormat() == FORMAT_A8R8G8B8))
		{
			equalFormats = true;
			alpha0xFF = true;
		}

		if(depthStencil)   // Copy entirely, internally   // FIXME: Check
		{
			if(source->hasDepth())
			{
				sw::byte *sourceBuffer = (sw::byte*)source->lockInternal(0, 0, sRect.slice, LOCK_READONLY, PUBLIC);
				sw::byte *destBuffer = (sw::byte*)dest->lockInternal(0, 0, dRect.slice, LOCK_DISCARD, PUBLIC);

				unsigned int height = source->getHeight();
				unsigned int pitch = source->getInternalPitchB();

				for(unsigned int y = 0; y < height; y++)
				{
					memcpy(destBuffer, sourceBuffer, pitch);   // FIXME: Only copy width * bytes

					sourceBuffer += pitch;
					destBuffer += pitch;
				}

				source->unlockInternal();
				dest->unlockInternal();
			}

			if(source->hasStencil())
			{
				sw::byte *sourceBuffer = (sw::byte*)source->lockStencil(0, 0, 0, PUBLIC);
				sw::byte *destBuffer = (sw::byte*)dest->lockStencil(0, 0, 0, PUBLIC);

				unsigned int height = source->getHeight();
				unsigned int pitch = source->getStencilPitchB();

				for(unsigned int y = 0; y < height; y++)
				{
					memcpy(destBuffer, sourceBuffer, pitch);   // FIXME: Only copy width * bytes

					sourceBuffer += pitch;
					destBuffer += pitch;
				}

				source->unlockStencil();
				dest->unlockStencil();
			}
		}
		else if(!scaling && equalFormats)
		{
			unsigned char *sourceBytes = (unsigned char*)source->lockInternal(sRect.x0, sRect.y0, sRect.slice, LOCK_READONLY, PUBLIC);
			unsigned char *destBytes = (unsigned char*)dest->lockInternal(dRect.x0, dRect.y0, dRect.slice, LOCK_READWRITE, PUBLIC);
			unsigned int sourcePitch = source->getInternalPitchB();
			unsigned int destPitch = dest->getInternalPitchB();

			unsigned int width = dRect.x1 - dRect.x0;
			unsigned int height = dRect.y1 - dRect.y0;
			unsigned int bytes = width * egl::Image::bytes(source->getInternalFormat());

			for(unsigned int y = 0; y < height; y++)
			{
				memcpy(destBytes, sourceBytes, bytes);

				if(alpha0xFF)
				{
					for(unsigned int x = 0; x < width; x++)
					{
						destBytes[4 * x + 3] = 0xFF;
					}
				}

				sourceBytes += sourcePitch;
				destBytes += destPitch;
			}

			source->unlockInternal();
			dest->unlockInternal();
		}
		else
		{
			sw::SliceRectF sRectF((float)sRect.x0, (float)sRect.y0, (float)sRect.x1, (float)sRect.y1, sRect.slice);
			blit(source, sRectF, dest, dRect, scaling && filter);
		}

		return true;
	}

	bool Device::bindResources()
	{
		if(!bindViewport())
		{
			return false;   // Zero-area target region
		}

		return true;
	}

	bool Device::bindViewport()
	{
		if(viewport.width <= 0 || viewport.height <= 0)
		{
			return false;
		}

		if(scissorEnable)
		{
			if(scissorRect.x0 >= scissorRect.x1 || scissorRect.y0 >= scissorRect.y1)
			{
				return false;
			}

			sw::Rect scissor;
			scissor.x0 = scissorRect.x0;
			scissor.x1 = scissorRect.x1;
			scissor.y0 = scissorRect.y0;
			scissor.y1 = scissorRect.y1;

			setScissor(scissor);
		}
		else
		{
			sw::Rect scissor;
			scissor.x0 = viewport.x0;
			scissor.x1 = viewport.x0 + viewport.width;
			scissor.y0 = viewport.y0;
			scissor.y1 = viewport.y0 + viewport.height;

			if(renderTarget)
			{
				scissor.x0 = max(scissor.x0, 0);
				scissor.x1 = min(scissor.x1, renderTarget->getWidth());
				scissor.y0 = max(scissor.y0, 0);
				scissor.y1 = min(scissor.y1, renderTarget->getHeight());
			}

			if(depthBuffer)
			{
				scissor.x0 = max(scissor.x0, 0);
				scissor.x1 = min(scissor.x1, depthBuffer->getWidth());
				scissor.y0 = max(scissor.y0, 0);
				scissor.y1 = min(scissor.y1, depthBuffer->getHeight());
			}

			if(stencilBuffer)
			{
				scissor.x0 = max(scissor.x0, 0);
				scissor.x1 = min(scissor.x1, stencilBuffer->getWidth());
				scissor.y0 = max(scissor.y0, 0);
				scissor.y1 = min(scissor.y1, stencilBuffer->getHeight());
			}

			setScissor(scissor);
		}

		sw::Viewport view;
		view.x0 = (float)viewport.x0;
		view.y0 = (float)viewport.y0;
		view.width = (float)viewport.width;
		view.height = (float)viewport.height;
		view.minZ = viewport.minZ;
		view.maxZ = viewport.maxZ;

		Renderer::setViewport(view);

		return true;
	}

	bool Device::validRectangle(const sw::Rect *rect, sw::Surface *surface)
	{
		if(!rect)
		{
			return true;
		}

		if(rect->x1 <= rect->x0 || rect->y1 <= rect->y0)
		{
			return false;
		}

		if(rect->x0 < 0 || rect->y0 < 0)
		{
			return false;
		}

		if(rect->x1 > (int)surface->getWidth() || rect->y1 > (int)surface->getHeight())
		{
			return false;
		}

		return true;
	}

	void Device::finish()
	{
		synchronize();
	}
}


text:
import os
import pdb
import sys
import time
import math
import copy
import shutil

from glob import glob
import output as output

def MakeDirectories(output_dir):
  '''make a new directory for output data.  overwrite if prior directory
  exists '''

  # does write directory exist?
  angst_results_dir = output_dir + "/"
  results_dirs = {}
  results_dirs["angst"] = angst_results_dir
  return results_dirs

def SaveResults(output_args):
  ''' write the results of AnGSTs analysis to file '''

  model = output_args["model"]
  results_dirs = output_args["results"]
  start_time = output_args["start_time"]
  counts = output_args["counts"]
  mem_str = output_args["mem_str"]
  gene_tree = output_args["gene_tree"]
  gene_num = counts["gene"]
  spec_num = counts["spec"]
  node_link = output_args["node_link"]
  #scaling_list = output_args["scaling"]
  scaling_list = []

  hgt_penalty = model.hgt_penalty
  los_penalty = model.los_penalty
  dup_penalty = model.dup_penalty
  spc_penalty = model.spc_penalty
  angst_results_dir = results_dirs["angst"]
  species_tree = model.species_tree
  luca = species_tree.root
  gene_root = gene_tree.root

  # find best rooting
  best_dict = output_args["res_dict"]
  best_node = None
  best_newick = None
  best_events = None

  if model.luca == "Root" or model.special == "hr":
    best_score = best_dict["scores"][luca]
    best_node = luca
  else:
    best_score = min(best_dict["scores"].values())
    for node in best_dict["scores"]:
      if best_dict["scores"][node] == best_score:
        best_node = node
  best_newick = best_dict["newick"][best_node]
  best_events = best_dict["events"][best_node]

  # dump best rootings to output files
  output_newick = open(angst_results_dir + "AnGST.newick",'w')
  output_events = open(angst_results_dir + "AnGST.events",'w')
  output_score = open(angst_results_dir + "AnGST.score",'w')
  output_leaf = open(angst_results_dir + "AnGST.leaf",'w')
  output_counts = open(angst_results_dir + "AnGST.counts",'w')

  # give root branch a "meaningless" length so that rooted gene_tree
  # formatted correctly
  output_newick.write("(" + best_newick + ":0.01337);")
  output_score.write(str(best_score) + "\n")

  # write out a leaf-centric list of events
  LeafBasedEvents(gene_root,best_node)
  PrintLeafEvents(gene_root,output_leaf)

  # print out all events
  output_events.write("[brn]: " + str(best_node) + "\n")
  event_counts = PrintAllEvents(gene_root,best_node,output_events)

  # do counts
  CountGenes(gene_root,species_tree,output_counts)

  # look for paradoxes
  #output_paradox = open(angst_results_dir + "AnGST.paradox",'w')
  #best_paradox = best_dict['paradox'][best_node]
  #paradox_count = ParadoxProcess(best_paradox,output_paradox)
  #output_paradox.close()

  # get branch distances
  #output_branches = open(angst_results_dir + "AnGST.branches",'w')
  #path_dict = {}
  #GetBranchDists(gene_root,best_node,None,path_dict,output_branches)
  #output_branches.close()

  # get distances
  #output_dists = open(angst_results_dir + "AnGST.dists",'w')
  #output_dists.close()

  output_newick.close()
  output_counts.close()
  output_score.close()
  output_events.close()
  output_leaf.close()

  # save information on transfer distances
  #output_hgt_dists = open(angst_results_dir + "AnGST.hgts",'w')
  #PrintHGTDists(gene_root,best_node,species_tree,output_hgt_dists)
  #output_hgt_dists.close()

  # how many possible hgt were there?
  possible_hgt = len(species_tree.possible_hgt)

  # save run statistics and notes
  output_stats = open(angst_results_dir + "AnGST.stats",'w')
  output_stats.write("\n# angst version info #\n")
  output_stats.write("angst v\n")

  output_stats.write("\n# input data #\n")
  output_stats.write("species file:\t")
  output_stats.write(output_args["species_file"] + "\n")
  output_stats.write("species count:\t" + str(spec_num) + "\n")
  output_stats.write("bootstrap file:\t")
  output_stats.write(output_args["boot_file"] + "\n")
  output_stats.write("gene count:\t" + str(gene_num) + "\n")
  output_stats.write("bootstraps:\t" + str(counts["boots"]) + "\n")
  output_stats.write("possible hgt:\t" + str(possible_hgt) + "\n")

  output_stats.write("\n# model settings #\n")
  output_stats.write("event guide:\t")
  output_stats.write(str(output_args["event_guide"]) + "\n")
  output_stats.write("hgt penalty: " + str(hgt_penalty) + "\n")
  output_stats.write("dup penalty: " + str(dup_penalty) + "\n")
  output_stats.write("los penalty: " + str(los_penalty) + "\n")
  output_stats.write("spc penalty: " + str(spc_penalty) + "\n")
  #output_stats.write("cog scaling: " + str(node_link.cog_scaling) + "\n")
  #output_stats.write("hr scaling: " + str(node_link.hr_scaling) + "\n")

  output_stats.write("\n# inference counts #\n")
  output_stats.write("hgt inferred: " + str(event_counts['hgt']) + "\n")
  output_stats.write("dup inferred: " + str(event_counts['dup']) + "\n")
  output_stats.write("los inferred: " + str(event_counts['los']) + "\n")
  output_stats.write("spc inferred: " + str(event_counts['spc']) + "\n")
  #output_stats.write("time paradoxes: " + str(paradox_count) + "\n")

  output_stats.write("\n# running time #\n")
  output_stats.write("run-time: " + str(time.time()-start_time) + " sec\n")

  output_stats.write("\n# memory usage #\n")
  output_stats.write(mem_str)

  output_stats.close()

  return best_score

def PrintEventList(events,out_list):
  '''print out events.  recurse if the list actually has another list
  in it'''
  if type(events) == type(""):
    if len(events) > 0:
      if events.count('[') < 2:
        out_list.append(events)
      else:
        event_parts = events.split('[')
        for event_ind in xrange(1,len(event_parts)):
          out_list.append('[' + event_parts[event_ind])
  else:
    for event in events:
      PrintEventList(event,out_list)
  return out_list

def LeafBasedEvents(this_node,lca):
  ''' print out events in the history of a particular leaf '''
  event_list = this_node.lca_lookups['events'][lca]
  this_node.event_list = PrintEventList(event_list,[])

  if this_node.raw_list is not None:
    print "there should be no raw list here already"
    sys.exit(1)
  this_node.raw_list = copy.copy(this_node.event_list)

  # get the events in your kids
  kids = this_node.kid_nodes.keys()
  for kid in kids:
    kid_lca = this_node.lca_map[lca][kid]
    LeafBasedEvents(kid,kid_lca)
    kid.rec_lca = kid_lca
    # remove kids events from all ancestors
    for event in kid.event_list:
      ParentEventRemove(this_node,event)

def PrintDistances(this_node,lca,dist_file):
  ''' print out distance ratios for all nodes on gene tree '''
  kids = this_node.kid_nodes.keys()
  if len(kids) < 1:
    return

  # break out the distances
  dist_diff = this_node.dist_ratios[lca][2]
  event_str = this_node.dist_ratios[lca][3]
  dist_file.write(str(dist_diff) + "\t" + event_str + "\n")
  for kid in kids:
    PrintDistances(kid,this_node.lca_map[lca][kid],dist_file)
  return

def PrintLeafEvents(this_node,output_file):

  if this_node.leaf_event_list is None:
    this_node.leaf_event_list = []

  # pass to kids the events at this node
  kids = this_node.kid_nodes.keys()
  for kid in kids:
    kid.leaf_event_list = []
    kid.leaf_event_list.extend(this_node.leaf_event_list)
    kid_lca = kid.rec_lca

    # handle events happening at the leaves as well
    all_events = []
    all_events.extend(this_node.event_list)
    if len(kid.branch_list) < 2:
      for kid_event in kid.event_list:
        if 'cur' not in kid_event:
          all_events.append(kid_event)

    for event in all_events:
      if event.count('hgt') > 0:
        spec_spec = event.split(' --> ')[1]
      else:
        if len(event.split(': ')) < 2:
          pdb.set_trace()
        spec_spec = event.split(': ')[1]
      spec_spec = "-" + spec_spec + "-"
      # is this species in there?
      this_spec = "-" + kid_lca.species + "-"
      if spec_spec.count(this_spec) > 0:
        kid.leaf_event_list.append(event)
    PrintLeafEvents(kid,output_file)

  # now, if you're at a leaf, print events
  if len(this_node.branch_list) < 2:
    output_file.write("leaf " + this_node.name + ":\n")
    for event in this_node.leaf_event_list:
      output_file.write("\t" + event + "\n")
    output_file.write("\t" + this_node.event_list[0] + "\n")
    output_file.write("\n")

def ParentEventRemove(this_node,event):
  this_node.event_list.remove(event)
  if this_node is this_node.tree.root:
    return
  p_ends = this_node.parent_branch.ends
  parent = filter(lambda i: i is not this_node,p_ends)[0]
  ParentEventRemove(parent,event)

def PrintHGTDists(this_node,lca,tree,output_file):
  events = this_node.raw_list
  for event in events:
    if 'hgt' in event:
      this_str = event.lstrip('[hgt]: ')
      parts = this_str.split(' --> ')
      donor = tree.node_dict[parts[0]]
      accep = tree.node_dict[parts[1]]
      n1n2_dist = tree.dist_dict[donor][accep]

      output_str = this_str
      output_str += "\t" + str(n1n2_dist)
      output_str += "\t" + str(donor.DistTo(tree.root)[1])
      output_str += "\t" + str(accep.DistTo(tree.root)[1])
      output_str += "\t" + str(tree.height_dict[donor])
      output_str += "\t" + str(tree.height_dict[accep])
      output_file.write(output_str + "\n")

def PrintAllEvents(this_node,lca,output_file):
  event_counts = {'hgt':0, 'dup':0, 'los':0, 'spc':0}
  events = this_node.raw_list
  for event in events:
    output_file.write(event + "\n")
    if event.count('hgt') > 0:
      event_counts['hgt'] += 1
    elif event.count('dup') > 0:
      event_counts['dup'] += 1
    elif event.count('los') > 0:
      event_counts['los'] += 1
    elif event.count('spc') > 0:
      event_counts['spc'] += 1

  return event_counts

def GetLeafList(this_node,leaf_list=[]):
  kids = this_node.kid_nodes.keys()
  if len(kids) < 1:
    leaf_list.append(this_node)
  else:
    for kid in kids:
      GetLeafList(kid,leaf_list)
  return leaf_list

def CountGenes(this_node,species_tree,output_file):
  all_species = species_tree.node_dict.keys()
  species_count_dict = {}
  for species in all_species:
    species_count_dict[species] = 0

  event_list = this_node.raw_list
  for event in event_list:
    if 'cur' in event or 'spc' in event:
      host = event.split(': ')[1]
      species_count_dict[host] += 1

  for species in species_count_dict:
    this_count = species_count_dict[species]
    output_file.write(species + ": " + str(this_count) + "\n")

  return

def ParadoxProcess(paradox_list,paradox_file):
  paradox_count = 0
  for paradox in paradox_list:
    paradox_count += 1
    paradox_file.write(paradox[0] + "\n")
    for ind in range(1,len(paradox[1])):
      paradox_file.write("\t" + paradox[1][ind] + "\n")
  return paradox_count

def GetBranchDists(this_node,this_lca,parent_lca,path_dict,output_f):
  ''' iterate through all nodes on the tree '''
  for kid in this_node.kid_nodes:
    kid_lca = this_node.lca_map[this_lca][kid]
    if kid_lca is not this_lca:
      GetPaths(this_node,kid,this_lca,kid_lca,path_dict,output_f)
    GetBranchDists(kid,kid_lca,this_lca,path_dict,output_f)

def GetPaths(root_node,this_node,root_lca,this_lca,path_dict,output_f):
  last_stop = True
  if this_lca.AreRelated(root_lca):
    for kid in this_node.kid_nodes:
      kid_lca = this_node.lca_map[this_lca][kid]
      if kid_lca is this_lca:
        last_stop = False
        path_dict[kid] = 1
        GetPaths(root_node,kid,root_lca,kid_lca,path_dict,output_f)
  if last_stop == True:
    gene_dist = root_node.DistTo(this_node)[1]
    # hgt
    label_str = "foo"
    if root_lca is this_lca:
      spec_dist = this_lca.parent_branch.length
      label_str = "dup"
    # speciation
    elif root_lca.AreRelated(this_lca):
      spec_dist = root_lca.DistTo(this_lca)[1]
      label_str = "ver"
    # hgt
    else:
      spec_dist = this_lca.parent_branch.length / 2
      label_str = "hgt"

    output_str = str(root_lca) + "\t"
    output_str += str(this_lca) + "\t"
    output_str += str(spec_dist) + "\t"
    output_str += str(gene_dist) + "\t"
    output_str += label_str + "\n"
    output_f.write(output_str)


text:
import * as ts from 'typescript';
import { parse_identifier } from './identifier';

export const parse_property_access_expression = (
  node: ts.PropertyAccessExpression,
): string[] => {
  const expressions: ts.Expression[] = [node.name];
  let current = node.expression;
  while (current.kind === ts.SyntaxKind.PropertyAccessExpression) {
    const access_expression = current as ts.PropertyAccessExpression;
    expressions.unshift(access_expression.name);
    current = access_expression.expression;
  }
  expressions.unshift(current);
  return expressions.map(expression =>
    parse_identifier(expression as ts.Identifier),
  );
};


text:
package org.biacode.jcronofy.api.model.response;

import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.biacode.jcronofy.api.model.TokenTypeModel;
import org.biacode.jcronofy.api.model.common.AbstractCronofyResponse;

/**
 * User: Arthur Asatryan
 * Date: 10/4/16
 * Time: 3:02 PM
 *

 * Read Requesting an Access Token
 *

 */
public class GetAccessTokenResponse extends AbstractCronofyResponse {
    private static final long serialVersionUID = -3802223800266935982L;

    //region Properties
    @JsonProperty("token_type")
    private TokenTypeModel tokenType;

    @JsonProperty("access_token")
    private String accessToken;

    @JsonProperty("refresh_token")
    private String refreshToken;

    @JsonProperty("scope")
    private String scope;

    @JsonProperty("expires_in")
    private int expiresIn;
    //endregion

    //region Constructors
    public GetAccessTokenResponse() {
    }

    public GetAccessTokenResponse(final TokenTypeModel tokenType,
                                  final String accessToken,
                                  final String refreshToken,
                                  final String scope,
                                  final int expiresIn) {
        this.tokenType = tokenType;
        this.accessToken = accessToken;
        this.refreshToken = refreshToken;
        this.scope = scope;
        this.expiresIn = expiresIn;
    }
    //endregion

    //region Equals, HashCode and ToString
    @Override
    public boolean equals(final Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof GetAccessTokenResponse)) {
            return false;
        }
        final GetAccessTokenResponse that = (GetAccessTokenResponse) o;
        return new EqualsBuilder()
                .append(expiresIn, that.expiresIn)
                .append(tokenType, that.tokenType)
                .append(accessToken, that.accessToken)
                .append(refreshToken, that.refreshToken)
                .append(scope, that.scope)
                .isEquals();
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder()
                .append(tokenType)
                .append(accessToken)
                .append(refreshToken)
                .append(scope)
                .append(expiresIn)
                .toHashCode();
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this)
                .append("tokenType", tokenType)
                .append("accessToken", accessToken)
                .append("refreshToken", refreshToken)
                .append("scope", scope)
                .append("expiresIn", expiresIn)
                .toString();
    }
    //endregion

    //region Properties getters and setters
    public TokenTypeModel getTokenType() {
        return tokenType;
    }

    public void setTokenType(final TokenTypeModel tokenType) {
        this.tokenType = tokenType;
    }

    public String getAccessToken() {
        return accessToken;
    }

    public void setAccessToken(final String accessToken) {
        this.accessToken = accessToken;
    }

    public String getRefreshToken() {
        return refreshToken;
    }

    public void setRefreshToken(final String refreshToken) {
        this.refreshToken = refreshToken;
    }

    public String getScope() {
        return scope;
    }

    public void setScope(final String scope) {
        this.scope = scope;
    }

    public int getExpiresIn() {
        return expiresIn;
    }

    public void setExpiresIn(final int expiresIn) {
        this.expiresIn = expiresIn;
    }
    //endregion
}


text:
[![Chef cookbook](https://img.shields.io/cookbook/v/collectd_ii.svg)]()
[![Code Climate](https://codeclimate.com/github/Stromweld/collectd_ii/badges/gpa.svg)](https://codeclimate.com/github/Stromweld/collectd_ii)
[![Issue Count](https://codeclimate.com/github/Stromweld/collectd_ii/badges/issue_count.svg)](https://codeclimate.com/github/Stromweld/collectd_ii)

# collectd_ii

## Description

Installs and configures collectd.  Much of the work in this cookbook reflects
work done by [coderanger](https://github.com/coderanger/chef-collectd) and
[realityforge](https://github.com/realityforge/chef-collectd).

This cookbook was copied from collectd-ng cookbook by Hector Castro. I updated it for chef-client 13+.

## Requirements

### Platforms

* Amazon
* CentOS
* Ubuntu

### Cookbooks

* build-essential
* yum

## Attributes

* `node['collectd_ii']['version']` - Version of collectd to install.
* `node['collectd_ii']['dir']` - Base directory for collectd.
* `node['collectd_ii']['plugins_conf_dir']`- Plugin directory for collectd.
* `node['collectd_ii']['url']` - URL to the collectd archive.
* `node['collectd_ii']['checksum']` - Checksum for the collectd archive.
* `node['collectd_ii']['interval']` - Number of seconds to wait between data reads.
* `node['collectd_ii']['read_threads']` - Number of threads performing data reads.
* `node['collectd_ii']['write_queue_limit_high']` - Upper bound on write queue size.
* `node['collectd_ii']['write_queue_limit_low']` - Lower bound on write queue size.
* `node['collectd_ii']['collect_internal_stats']` - Flag to collect internal
  collectd statistics.
* `node['collectd_ii']['name']` - Name of the node reporting statstics.
* `node['collectd_ii']['fqdnlookup']` - Flag to determine if the node should
  determine its own FQDN.
* `node['collectd_ii']['plugins']` - Mash of plugins for installation.
* `node['collectd_ii']['python_plugins']` - Mash of Python plugins for installation.
* `node['collectd_ii']['plugins_conf_dir']` - Directory for collectd plugins configuration files.
* `node['collectd_ii']['graphite_role']` – Role assigned to Graphite server for
  search.
* `node['collectd_ii']['graphite_ipaddress']` – IP address to Graphite server if
  you're trying to target one that isn't searchable.
* `node['collectd_ii']['packages']` – List of collectd packages.
* `node['collectd_ii']['configure_flag']` – Flag for enabling non-default collectd packages.

## Recipes

* `recipe[collectd_ii]` will install collectd from source.
* `recipe[collectd_ii::attribute_driven]` will install collectd via node attributes.
* `recipe[collectd_ii::packages]` will install collectd (and other plugins) from
  packages.
* `recipe[collectd_ii::recompile]` will attempt to recompile collectd.

**Note**: You need to include the default `recipe[collectd_ii]` when using `recipe[collectd_ii:attribute_driven]` to install `collectd`.

## Usage

By default this cookbook will attempt to download collectd from collectd.org.
If your HTTP request includes Chef as the user agent, collectd.org returns an
HTTP response with a message asking you to please stop using their downloads
via Chef. It is **highly recommended** that you override
`node['collectd_ii']['url']` with your own download location for collectd.

A list of alternative download locations for collectd:

* [https://s3.amazonaws.com/collectd-5.4.1/collectd-5.4.1.tar.gz](https://s3.amazonaws.com/collectd-5.4.1/collectd-5.4.1.tar.gz) (@ahochman)

In order to configure collectd via attributes, setup your roles like:

```ruby
default_attributes(
  'collectd' => {
    'plugins' => {
      'syslog' => {
        'config' => { 'LogLevel' => 'Info' }
      },
      'disk'      => { },
      'swap'      => { },
      'memory'    => { },
      'cpu'       => { },
      'interface' => {
        'config' => { 'Interface' => 'lo', 'IgnoreSelected' => true }
      },
      'df'        => {
        'config' => {
          'ReportReserved' => false,
          'FSType' => [ 'proc', 'sysfs', 'fusectl', 'debugfs', 'devtmpfs', 'devpts', 'tmpfs' ],
          'IgnoreSelected' => true
        }
      },
      'write_graphite' => {
        'config' => {
          'Prefix' => 'servers.'
        }
      }
    }
  }
)
```


text:
import plumber from 'gulp-plumber'
import babel from 'gulp-babel';

export default {
  name: 'script',
  stream(gulp, config) {
    return gulp.src(config[this.name][0])
    .pipe(plumber())
    .pipe(babel())
    .pipe(gulp.dest(config[this.name][1]))
  }
}


text:
"use strict";

exports.__esModule = true;
exports.CL_SPINNER_FAILED = exports.CL_SPINNER = exports.CL_ROOT = exports.CL_OPTIONS_ROW_ACTIVE = exports.CL_OPTIONS_ROW = exports.CL_OPTIONS_DIV = exports.CL_OPTIONS = exports.CL_NOT_SELECTED = exports.CL_INPUT_HR = exports.CL_INPUT = exports.CL_FOOTER_MARGIN = exports.CL_FOOTER_INDEX = exports.CL_FOOTER_BTS = exports.CL_FOOTER = void 0;
var CL_ROOT = 'zhn-select';
exports.CL_ROOT = CL_ROOT;
var CL_INPUT = CL_ROOT + "__input";
exports.CL_INPUT = CL_INPUT;
var CL_SPINNER = CL_ROOT + "__spinner";
exports.CL_SPINNER = CL_SPINNER;
var CL_SPINNER_FAILED = CL_ROOT + "__spinner--failed";
exports.CL_SPINNER_FAILED = CL_SPINNER_FAILED;
var CL_INPUT_HR = CL_ROOT + "__input__hr";
exports.CL_INPUT_HR = CL_INPUT_HR;
var CL_OPTIONS = CL_ROOT + "__options";
exports.CL_OPTIONS = CL_OPTIONS;
var CL_OPTIONS_DIV = CL_ROOT + "__options__div";
exports.CL_OPTIONS_DIV = CL_OPTIONS_DIV;
var CL_OPTIONS_ROW = CL_ROOT + "__row";
exports.CL_OPTIONS_ROW = CL_OPTIONS_ROW;
var CL_OPTIONS_ROW_ACTIVE = CL_ROOT + "__row--active";
exports.CL_OPTIONS_ROW_ACTIVE = CL_OPTIONS_ROW_ACTIVE;
var CL_FOOTER = CL_ROOT + "__footer";
exports.CL_FOOTER = CL_FOOTER;
var CL_FOOTER_INDEX = CL_ROOT + "__footer__index";
exports.CL_FOOTER_INDEX = CL_FOOTER_INDEX;
var CL_FOOTER_BTS = CL_ROOT + "__footer__bts";
exports.CL_FOOTER_BTS = CL_FOOTER_BTS;
var CL_FOOTER_MARGIN = CL_ROOT + "__footer--margin";
exports.CL_FOOTER_MARGIN = CL_FOOTER_MARGIN;
var CL_NOT_SELECTED = 'not-selected';
exports.CL_NOT_SELECTED = CL_NOT_SELECTED;
//# sourceMappingURL=CL.js.map


text:
<?php

namespace Destiny\Definitions;

use Destiny\Definitions\Manifest\HistoricalStat;
use Destiny\LeaderboardEntryCollection;

/**
 * Class Leaderboard.
 *
 * @property string         $statId
 * @property array          $entries
 * @property HistoricalStat $definition
 * @property-read LeaderboardEntryCollection $rankings
 */
class Leaderboard extends Definition
{
    protected function gDefinition()
    {
        return app('destiny.manifest')->historicalStat($this->statId);
    }

    protected function gStatName()
    {
        return $this->definition->statName;
    }

    protected function gRankings()
    {
        return new LeaderboardEntryCollection($this->entries);
    }
}


text:
;(function(){
var AlloyTouch = typeof require === 'function'
    ? require('alloytouch')
    : window.AlloyTouch
var Transform = typeof require === 'function'
    ? require('css3transform')
    : window.Transform
    //transform没有加包引入

let vueAlloyTouch = {};

vueAlloyTouch.install = function(Vue){

    var isVue2 = !!(Vue.version.substr(0,1) == 2);

    if(!AlloyTouch){
        throw new Error('you need include alloy_touch.js')
    }
    if(!Transform){
        throw new Error('you need include transform.js')
    }

    var directiveBinding = null;

    if(isVue2){
        directiveBinding = {
            bind: function(el, binding){
                //注册时的赋值 value, el已经挂载
                var options = getAlloyTouchConfig(el, binding.value);
                Transform(options.target);
                console.log(options)
                el.__alloytouch__handle = new AlloyTouch(options);
                console.log(el.__alloytouch__handle)
            },
            update: function (el, binding) {
                var value = binding.value;
                if(!el.__alloytouch__handle) {
                    return;
                }
                el.__alloytouch__handle.min = _getOption(value.min, 0);
                el.__alloytouch__handle.max = _getOption(value.max, 0);
            },
            unbind: function(el){
                el.__alloytouch__handle = null;
            }
        };
    }else {
        directiveBinding = {
            bind: function(){
                this.el.__alloytouch__handle = null;

            } ,
            update: function(binding){
                if(!this.el.__alloytouch__handle){
                    var options = getAlloyTouchConfig(this.el, binding);
                    Transform(options.target);
                    this.el.__alloytouch__handle = new AlloyTouch(options);
                }else {
                    console.log(binding)
                    this.el.__alloytouch__handle.min = _getOption(binding.min, 0);
                    this.el.__alloytouch__handle.max = _getOption(binding.max, 0);
                }
            },
           unbind: function(){
                this.el.__alloytouch__handle = null;
           }
        }
    }

    Vue.directive('alloytouch', directiveBinding)
    function noop(){

    }
    function _getOption(value, defaultValue){
        return value==undefined ?defaultValue: value
    }

    function getAlloyTouchConfig(el, value) {

        var options = value.options || {}
        var methods = value.methods;
        var result = {
            touch: el,//反馈触摸的dom
            target: el, //运动的对象
            property: _getOption(options.property, 'translateY'),  //被运动的属性
            vertical: _getOption(options.vertical,1),//不必需,默认是true代表监听竖直方向touch
            min: _getOption(options.min, 0), //不必需,运动属性的最小值
            max: _getOption(options.max, 0), //不必需,滚动属性的最大值
            sensitivity: _getOption(options.sensitivity, 1),//不必需,触摸区域的灵敏度,默认值为1,可以为负数
            factor: _getOption(options.factor, 1),//不必需,表示触摸位移与被运动属性映射关系,默认值是1
            spring: _getOption(options.spring, 1), //不必需,是否有回弹效果。默认是true
            step: _getOption(options.step, undefined),//用于校正到step的整数倍
            change : methods.change || noop,
            touchEnd : methods.touchEnd || noop,
            touchStart : methods.touchStart || noop,
            touchMove : methods.touchMove || noop,
            touchCancel : methods.touchCancel || noop,
            reboundEnd : methods.reboundEnd || noop,
            animationEnd : methods.animationEnd || noop,
            correctionEnd : methods.correctionEnd || noop
        }
        if(value.min !=undefined) {
            result.min = value.min;
        }
        if(value.max !=undefined) {
            result.max = value.max;
        }
        if(!!options.touch){
            var touchEl = el.querySelector(options.touch);
            result.touch = touchEl || el;
        }

        if(!!options.target){
            var target = el.querySelector(options.target);
            result.target = target || el;
        }

        return result;
    }
}

if(typeof module !== 'undefined' && typeof exports === 'object') {
    module.exports = vueAlloyTouch;
} else {
    window.vueAlloyTouch = vueAlloyTouch;
}

})();


text:
NumberClass::NumberClass (int n)
	: num (n)
{
}
int NumberClass::Number () const
{
	return this->num;
}
int NumberClass::NegativeNumber () const
{
	return -(this->Number ());
}
NumberClass::~NumberClass ()
{
	this->num = 0;
}

AdderClass::AdderClass (int n)
	: NumberClass (n)
{
}
void AdderClass::Add (int n)
{
	this->num += n;
}

AdderClassWithVirtualBase::AdderClassWithVirtualBase (int n)
	: NumberClass (n)
{
}
void AdderClassWithVirtualBase::Add (int n)
{
	this->num += n;
}

MultiplierClass::MultiplierClass (int n)
	: NumberClass (n)
{
}
void MultiplierClass::Multiply (int n)
{
	this->num *= n;
}

MultiplierClassWithVirtualBase::MultiplierClassWithVirtualBase (int n)
	: NumberClass (n)
{
}
void MultiplierClassWithVirtualBase::Multiply (int n)
{
	this->num *= n;
}

ClassThatOverridesStuff::ClassThatOverridesStuff (int num, int my)
	: NumberClass (num), myNum (my)
{
}
int ClassThatOverridesStuff::Number () const
{
	return this->myNum;
}
int ClassThatOverridesStuff::BaseNumber () const
{
	return this->NumberClass::Number ();
}
ClassThatOverridesStuff::~ClassThatOverridesStuff ()
{
	this->myNum = 0;
}
NumberClass* ClassThatOverridesStuff::GetInstance (int num, int my)
{
	return new ClassThatOverridesStuff (num, my);
}


text:
/*
*/

function _Value_global(name) {
  return eval(name)
}

function _Value_cast(value) {
  return value
}

function _Value_nativeType(value) {
  var type = typeof(value)
  if (type === "number") {
    if (Number.isInteger(value)) {
      type = "int"
    } else {
      type = "float"
    }
  }
  return type
}

var _Value_assign = F2(function(name, value) {
  eval(name + " = value")
  return value
})

var _Value_print = F2(function(label, value) {
  console.log(label, value)
  return value
})

function _Value_wrap(value) {
  return { '$': 0, 'a': value }
}

function _Value_unwrap(value) {
  if (value.$ === 0) {
    return value.a
  }
  return value
}


text:
const { Schema, arrayOf } = require('normalizr')
const spentFinance = require('./spentFinance')
const plannedFinance = require('./plannedFinance')

const makeAssignEntity = locale => (output, key, value, input) => {
  if (key === 'name') {
    output.name = {}
    output.name[locale] = value
  }
}

const createLocalizedSchema = locale => {
  const budgetItem = new Schema('budgetItems', {
    defaults: { loaded: [] },
    assignEntity: makeAssignEntity(locale)
  })

  budgetItem.define({
    spentFinances: arrayOf(spentFinance),
    plannedFinances: arrayOf(plannedFinance),
    overallBudget: budgetItem,
    spendingAgency: budgetItem,
    parentProgram: budgetItem,
    priorities: arrayOf(budgetItem),
    spendingAgencies: arrayOf(budgetItem),
    childPrograms: arrayOf(budgetItem)
  })

  return budgetItem
}

module.exports = createLocalizedSchema


text:
emulate
==========

Usage | Synopsis
---|---
<% if((isConsole && isMacOS) || isHtml) { %>General | `$ tns emulate <Platform>`<% } %><% if(isConsole && (isLinux || isWindows)) { %>General | `$ tns emulate android`<% } %>

Builds and runs the project in the native emulator for the selected target platform. <% if(isMacOS) { %>You must specify the target platform for which you want to build your project.<% } %>

<% if((isConsole && isMacOS) || isHtml) { %>### Attributes
`<Platform>` is the target mobile platform for which you want to emulate your project. You can set the following target platforms.
* `android` - Builds the specified project and runs it in the native Android emulator.
* `ios` - Builds the specified project and runs it in the native iOS Simulator.<% } %>

<% if(isHtml) { %>
### Related Commands

Command | Description
----------|----------
[build android](build-android.html) | Builds the project for Android and produces an APK that you can manually deploy on device or in the native emulator.
[build ios](build-ios.html) | Builds the project for iOS and produces an APP or IPA that you can manually deploy in the iOS Simulator or on device, respectively.
[build](build.html) | Builds the project for the selected target platform and produces an application package that you can manually deploy on device or in the native emulator.
[debug android](debug-android.html) | Debugs your project on a connected Android device or in a native emulator.
[debug ios](debug-ios.html) | Debugs your project on a connected iOS device or in a native emulator.
[debug](debug.html) | Debugs your project on a connected device or in a native emulator.
[deploy](deploy.html) | Builds and deploys the project to a connected physical or virtual device.
[emulate android](emulate-android.html) | Builds the specified project and runs it in a native Android emulator.
[emulate ios](emulate-ios.html) | Builds the specified project and runs it in the native iOS Simulator.
[livesync](livesync.html) | Synchronizes the latest changes in your project to devices.
[livesync ios](livesync-ios.html) | Synchronizes the latest changes in your project to iOS devices or the iOS Simulator.
[livesync android](livesync-android.html) | Synchronizes the latest changes in your project to Android devices.
[run android](run-android.html) | Runs your project on a connected Android device or in a native Android emulator, if configured.
[run ios](run-ios.html) | Runs your project on a connected iOS device or in the iOS Simulator, if configured.
[run](run.html) | Runs your project on a connected device or in the native emulator for the selected platform.
<% } %>


text:
mod builtin;
mod characters;
mod font;
mod linebreak;
mod lines;
mod section;
mod words;

/// Re-exported ab_glyph types.
pub mod ab_glyph {
    pub use ab_glyph::*;
}
pub use self::{builtin::*, font::*, linebreak::*, section::*};

use ::ab_glyph::*;
use std::hash::Hash;

/// Logic to calculate glyph positioning using [`Font`](struct.Font.html),
/// [`SectionGeometry`](struct.SectionGeometry.html) and
/// [`SectionText`](struct.SectionText.html).
pub trait GlyphPositioner: Hash {
    /// Calculate a sequence of positioned glyphs to render. Custom implementations should
    /// return the same result when called with the same arguments to allow layout caching.
    fn calculate_glyphs<F, S>(
        &self,
        fonts: &[F],
        geometry: &SectionGeometry,
        sections: &[S],
    ) -> Vec<SectionGlyph>
    where
        F: Font,
        S: ToSectionText;

    /// Return a screen rectangle according to the requested render position and bounds
    /// appropriate for the glyph layout.
    fn bounds_rect(&self, geometry: &SectionGeometry) -> Rect;

    /// Recalculate a glyph sequence after a change.
    ///
    /// The default implementation simply calls `calculate_glyphs` so must be implemented
    /// to provide benefits as such benefits are spefic to the internal layout logic.
    fn recalculate_glyphs<F, S, P>(
        &self,
        previous: P,
        change: GlyphChange,
        fonts: &[F],
        geometry: &SectionGeometry,
        sections: &[S],
    ) -> Vec<SectionGlyph>
    where
        F: Font,
        S: ToSectionText,
        P: IntoIterator<Item = SectionGlyph>,
    {
        let _ = (previous, change);
        self.calculate_glyphs(fonts, geometry, sections)
    }
}

#[derive(Debug)]
#[non_exhaustive]
pub enum GlyphChange {
    /// Only the geometry has changed, contains the old geometry
    Geometry(SectionGeometry),
    Unknown,
}


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<groupId>ysoserial</groupId>
	<artifactId>ysoserial</artifactId>
	<version>0.0.5-SNAPSHOT</version>

	<name>ysoserial</name>
	<url>http://maven.apache.org</url>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	</properties>

	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.2</version>
				<configuration>
					<source>1.7</source>
					<target>1.7</target><!-- maximize compatibility -->
					<optimize>true</optimize>
				</configuration>
			</plugin>
			<plugin>
				<artifactId>maven-assembly-plugin</artifactId>
				<configuration>
					<finalName>${project.artifactId}-${project.version}-all</finalName>
					<appendAssemblyId>false</appendAssemblyId>
					<archive>
						<manifest>
							<mainClass>ysoserial.GeneratePayload</mainClass>
						</manifest>
					</archive>
					<descriptorRefs>
						<descriptorRef>jar-with-dependencies</descriptorRef>
					</descriptorRefs>
				</configuration>
				<executions>
					<execution>
						<id>make-assembly</id>
						<phase>package</phase>
						<goals>
							<goal>single</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			<plugin>
		        <groupId>org.apache.maven.plugins</groupId>
		        <artifactId>maven-surefire-plugin</artifactId>
		        <configuration>
			        <systemPropertyVariables>
			        	<java.rmi.server.useCodebaseOnly>false</java.rmi.server.useCodebaseOnly>
			        </systemPropertyVariables>
		        </configuration>
		    </plugin>
		</plugins>
		<pluginManagement>
			<plugins>
				<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
				<plugin>
					<groupId>org.eclipse.m2e</groupId>
					<artifactId>lifecycle-mapping</artifactId>
					<version>1.0.0</version>
					<configuration>
						<lifecycleMappingMetadata>
							<pluginExecutions>
								<pluginExecution>
									<pluginExecutionFilter>
										<groupId>
											org.apache.maven.plugins
										</groupId>
										<artifactId>
											maven-compiler-plugin
										</artifactId>
										<versionRange>
											[3.2,)
										</versionRange>
										<goals>
											<goal>compile</goal>
										</goals>
									</pluginExecutionFilter>
									<action>
										<ignore></ignore>
									</action>
								</pluginExecution>
							</pluginExecutions>
						</lifecycleMappingMetadata>
					</configuration>
				</plugin>
			</plugins>
		</pluginManagement>
	</build>

	<repositories>
		<repository>
			<id>jenkins</id>
			<layout>default</layout>
			<url>http://repo.jenkins-ci.org/public/</url>
		</repository>
	</repositories>

	<dependencies>

		<!-- testing depedencies -->

		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.12</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.mockito</groupId>
			<artifactId>mockito-core</artifactId>
			<version>1.10.19</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>com.github.stefanbirkner</groupId>
			<artifactId>system-rules</artifactId>
			<version>1.8.0</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.nanohttpd</groupId>
			<artifactId>nanohttpd</artifactId>
			<version>2.2.0</version>
			<scope>test</scope>
		</dependency>

		<!-- non-gadget dependencies -->

		<dependency>
			<groupId>org.reflections</groupId>
			<artifactId>reflections</artifactId>
			<version>0.9.9</version>
		</dependency>
		<dependency>
			<groupId>org.jboss.shrinkwrap.resolver</groupId>
			<artifactId>shrinkwrap-resolver-depchain</artifactId>
			<version>2.1.1</version>
			<type>pom</type>
		</dependency>
		<dependency>
			<groupId>org.javassist</groupId>
			<artifactId>javassist</artifactId>
			<version>3.19.0-GA</version>
		</dependency>
		<dependency>
			<groupId>commons-codec</groupId>
			<artifactId>commons-codec</artifactId>
			<version>1.9</version>
		</dependency>
		<dependency>
			<artifactId>remoting</artifactId>
			<groupId>org.jenkins-ci.main</groupId>
			<version>2.55</version>
		</dependency>
		<dependency>
			<groupId>org.jboss.logging</groupId>
			<artifactId>jboss-logging</artifactId>
			<version>3.3.0.Final</version>
		</dependency>
		<dependency>
			<groupId>org.jboss.remoting</groupId>
			<artifactId>jboss-remoting</artifactId>
			<version>4.0.19.Final</version>
		</dependency>
		<dependency>
			<groupId>org.jboss</groupId>
			<artifactId>jboss-common-core</artifactId>
			<version>2.5.0.Final</version>
			<exclusions>
				<exclusion>
					<groupId>org.jboss.logging</groupId>
					<artifactId>jboss-logging-spi</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.jboss.xnio</groupId>
			<artifactId>xnio-nio</artifactId>
			<version>3.3.4.Final</version>
		</dependency>
		<dependency>
			<groupId>org.jboss.sasl</groupId>
			<artifactId>jboss-sasl</artifactId>
			<version>1.0.5.Final</version>
		</dependency>
		<dependency>
			<groupId>org.jboss.remotingjmx</groupId>
			<artifactId>remoting-jmx</artifactId>
			<version>2.0.1.Final</version>
		</dependency>

		<!-- gadget dependecies -->

		<dependency>
			<groupId>commons-collections</groupId>
			<artifactId>commons-collections</artifactId>
			<version>3.1</version>
		</dependency>
		<dependency>
			<groupId>org.beanshell</groupId>
			<artifactId>bsh</artifactId>
			<version>2.0b5</version>
		</dependency>
		<dependency>
			<groupId>commons-beanutils</groupId>
			<artifactId>commons-beanutils</artifactId>
			<version>1.9.2</version>
		</dependency>
		<dependency>
			<groupId>org.apache.commons</groupId>
			<artifactId>commons-collections4</artifactId>
			<version>4.0</version>
		</dependency>
		<dependency>
			<groupId>org.codehaus.groovy</groupId>
			<artifactId>groovy</artifactId>
			<version>2.3.9</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-core</artifactId>
			<version>4.1.4.RELEASE</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-beans</artifactId>
			<version>4.1.4.RELEASE</version>
		</dependency>
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-core</artifactId>
			<version>4.3.11.Final</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-aop</artifactId>
			<version>4.1.4.RELEASE</version>
		</dependency>
		<dependency>
			<groupId>net.sf.json-lib</groupId>
			<artifactId>json-lib</artifactId>
			<classifier>jdk15</classifier>
			<version>2.4</version>
		</dependency>
		<dependency>
			<groupId>commons-fileupload</groupId>
			<artifactId>commons-fileupload</artifactId>
			<version>1.3</version>
		</dependency>
		<dependency>
			<groupId>org.apache.wicket</groupId>
			<artifactId>wicket-util</artifactId>
			<version>6.23.0</version>
		</dependency>
		<dependency>
			<groupId>com.mchange</groupId>
			<artifactId>c3p0</artifactId>
			<version>0.9.5.2</version>
		</dependency>
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>javax.servlet-api</artifactId>
			<version>3.1.0</version>
		</dependency>
		<dependency>
			<groupId>org.apache.myfaces.core</groupId>
			<artifactId>myfaces-impl</artifactId>
			<version>2.2.9</version>
		</dependency>
		<dependency>
			<groupId>xalan</groupId>
			<artifactId>xalan</artifactId>
			<version>2.7.2</version>
		</dependency>
		<dependency>
			<groupId>rome</groupId>
			<artifactId>rome</artifactId>
			<version>1.0</version>
		</dependency>
        <dependency>
            <groupId>org.python</groupId>
            <artifactId>jython-standalone</artifactId>
            <version>2.5.2</version>
        </dependency>
		<dependency>
			<groupId>rhino</groupId>
			<artifactId>js</artifactId>
			<version>1.7R2</version>
		</dependency>
		<dependency>
		<groupId>javassist</groupId>
		<artifactId>javassist</artifactId>
		<version>3.12.0.GA</version>
		</dependency>
		<dependency>
			<groupId>org.jboss.weld</groupId>
			<artifactId>weld-core</artifactId>
			<version>1.1.33.Final</version>
		</dependency>
		<dependency>
			<groupId>org.jboss.interceptor</groupId>
			<artifactId>jboss-interceptor-core</artifactId>
			<version>2.0.0.Final</version>
		</dependency>
		<dependency>
			<groupId>org.jboss.interceptor</groupId>
			<artifactId>jboss-interceptor-spi</artifactId>
			<version>2.0.0.Final</version>
		</dependency>
		<dependency>
			<groupId>javax.enterprise</groupId>
			<artifactId>cdi-api</artifactId>
			<version>1.0-SP1</version>
		</dependency>
		<dependency>
			<groupId>javax.interceptor</groupId>
			<artifactId>javax.interceptor-api</artifactId>
			<version>3.1</version>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
			<version>1.7.21</version>
		</dependency>
	</dependencies>

	<profiles>
		<profile>
			<id>hibernate5</id>
			<activation>
				<property>
					<name>hibernate5</name>
				</property>
			</activation>
			<dependencies>
				<dependency>
					<groupId>org.hibernate</groupId>
					<artifactId>hibernate-core</artifactId>
					<version>5.0.7.Final</version>
				</dependency>
			</dependencies>
		</profile>

		<profile>
			<id>apache-el</id>
			<activation>
				<activeByDefault>true</activeByDefault>
				<property>
					<name>el</name>
					<value>apache</value>
				</property>
			</activation>
			<dependencies>
				<dependency>
					<groupId>org.mortbay.jasper</groupId>
					<artifactId>apache-el</artifactId>
					<version>8.0.27</version>
				</dependency>
			</dependencies>
		</profile>

		<profile>
			<id>juel</id>
			<activation>
				<property>
					<name>el</name>
					<value>juel</value>
				</property>
			</activation>
			<dependencies>
				<dependency>
					<groupId>de.odysseus.juel</groupId>
					<artifactId>juel-impl</artifactId>
					<version>2.2.7</version>
				</dependency>
				<dependency>
					<groupId>de.odysseus.juel</groupId>
					<artifactId>juel-api</artifactId>
					<version>2.2.7</version>
				</dependency>
			</dependencies>
		</profile>

	</profiles>
</project>


text:
package com.github.bingoohuang.utils.lang;

import com.github.bingoohuang.utils.reflect.Fields;
import lombok.RequiredArgsConstructor;
import lombok.val;
import org.objenesis.ObjenesisStd;

import java.lang.reflect.Field;
import java.math.BigInteger;
import java.util.Random;
import java.util.UUID;

@RequiredArgsConstructor
public class ObjectRandomizer {
    private final Class<?> beanClass;

    public Object random() {
        Object bean = new ObjenesisStd().getInstantiatorOf(beanClass).newInstance();
        for (val field : beanClass.getDeclaredFields()) {
            if (Fields.shouldIgnored(field)) continue;

            Object value = getRandomValueForField(field);
            Fields.setField(field, bean, value);
        }

        return bean;
    }

    private Object getRandomValueForField(Field field) {
        Random random = new Random();
        Class<?> type = field.getType();

        // Note that we must handle the different types here! This is just an
        // example, so this list is not complete! Adapt this to your needs!
        if (type.isEnum()) {
            Object[] enumValues = type.getEnumConstants();
            return enumValues[random.nextInt(enumValues.length)];
        } else if (type.equals(Integer.TYPE) || type.equals(Integer.class)) {
            return random.nextInt();
        } else if (type.equals(Long.TYPE) || type.equals(Long.class)) {
            return random.nextLong();
        } else if (type.equals(Double.TYPE) || type.equals(Double.class)) {
            return random.nextDouble();
        } else if (type.equals(Float.TYPE) || type.equals(Float.class)) {
            return random.nextFloat();
        } else if (type.equals(String.class)) {
            return UUID.randomUUID().toString();
        } else if (type.equals(BigInteger.class)) {
            return BigInteger.valueOf(random.nextInt());
        }

        return new ObjectRandomizer(type).random();
    }
}