text:
<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">

  <title>cnavg.cactusTree.cactusTree.Reduce</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />

         Home

         Trees

         Indices

         Help

        Package cnavg ::
        Package cactusTree ::
        Module cactusTree ::
        Class Reduce

[frames] | no frames]

Class Reduce

source code

  <map id="uml_class_diagram_for_cnavg_ca_18" name="uml_class_diagram_for_cnavg_ca_18">
<area shape="rect" id="node1_16" href="cnavg.cactusTree.cactusTree.Reduce-class.html#__init__" title="This method must be called by any overiding constructor." alt="" coords="172,377,308,396"/>
<area shape="rect" id="node1_17" href="cnavg.cactusTree.cactusTree.Reduce-class.html#run" title="Do user stuff here, including creating any follow on jobs." alt="" coords="172,396,308,415"/>
<area shape="rect" id="node1" href="cnavg.cactusTree.cactusTree.Reduce-class.html" title="Collects sampled histories and selects optimal ones for a separate file" alt="" coords="160,345,320,421"/>
<area shape="rect" id="node2_18" href="javascript:void(0);" title="Set the follow on target." alt="" coords="16,39,464,57"/>
<area shape="rect" id="node2_19" href="javascript:void(0);" title="Adds the child target to be run as child of this target." alt="" coords="16,57,464,76"/>
<area shape="rect" id="node2_20" href="javascript:void(0);" title="A command to be run as child of the job tree." alt="" coords="16,76,464,95"/>
<area shape="rect" id="node2_21" href="javascript:void(0);" title="Get the time the target is anticipated to run." alt="" coords="16,95,464,113"/>
<area shape="rect" id="node2_22" href="javascript:void(0);" title="Get the global temporary directory." alt="" coords="16,113,464,132"/>
<area shape="rect" id="node2_23" href="javascript:void(0);" title="Get the local temporary directory." alt="" coords="16,132,464,151"/>
<area shape="rect" id="node2_24" href="javascript:void(0);" title="Returns the number of bytes of memory that were requested by the job." alt="" coords="16,151,464,169"/>
<area shape="rect" id="node2_25" href="javascript:void(0);" title="Returns the number of cpus requested by the job." alt="" coords="16,169,464,188"/>
<area shape="rect" id="node2_26" href="javascript:void(0);" title="Get the follow on target." alt="" coords="16,188,464,207"/>
<area shape="rect" id="node2_27" href="javascript:void(0);" title="Get the child targets." alt="" coords="16,207,464,225"/>
<area shape="rect" id="node2_28" href="javascript:void(0);" title="Gets the child commands, as a list of tuples of strings and floats,  representing the run times." alt="" coords="16,225,464,244"/>
<area shape="rect" id="node2_29" href="javascript:void(0);" title="Send a logging message to the master." alt="" coords="16,244,464,263"/>
<area shape="rect" id="node2_30" href="javascript:void(0);" title="Sets the global temp dir." alt="" coords="16,263,464,281"/>
<area shape="rect" id="node2_31" href="javascript:void(0);" title="jobTree.scriptTree.target.Target.getMasterLoggingMessages" alt="" coords="16,300,464,319"/>
<area shape="rect" id="node2" href="javascript:void(0);" title="Each job wrapper extends this class." alt="" coords="4,6,476,325"/>
</map>

Collects sampled histories and selects optimal ones for a separate
  file

    Instance Methods

          __init__(self,
        options)

      This method must be called by any overiding constructor.

            source code

          run(self)

      Do user stuff here, including creating any follow on jobs.

            source code

Inherited from jobTree.scriptTree.target.Target:
      addChildCommand,
      addChildTarget,
      getChildCommands,
      getChildren,
      getCpu,
      getFollowOn,
      getGlobalTempDir,
      getLocalTempDir,
      getMasterLoggingMessages,
      getMemory,
      getRunTime,
      isGlobalTempDirSet,
      logToMaster,
      setFollowOnTarget,
      setGlobalTempDir,
      setStack

    Method Details

__init__(self,
        options)

(Constructor)

  	source code

This method must be called by any overiding constructor.

Overrides:
        jobTree.scriptTree.target.Target.__init__

(inherited documentation)

run(self)

  	source code

Do user stuff here, including creating any follow on jobs. This
  function must not re-pickle the pickle file, which is an input file.

Overrides:
        jobTree.scriptTree.target.Target.run

(inherited documentation)

         Home

         Trees

         Indices

         Help

    Generated by Epydoc 3.0.1 on Tue Mar 12 12:56:39 2013

      http://epydoc.sourceforge.net


text:
'use strict';

chrome.webRequest.onBeforeRequest.addListener(details => {
	if (details.method === 'GET') {
		const searchParams = new URLSearchParams(details.url.searchParams);
		searchParams.set('q', 'is:open');
		const newUrl = new URL(details.url + '?' + searchParams.toString());

		return {
			redirectUrl: newUrl.href
		};
	}
}, {
	urls: [
		'https://github.com/*/*/issues',
		'https://github.com/*/*/issues?_pjax=%23js-repo-pjax-container',
	],
	types: [
		'main_frame',
		'xmlhttprequest'
	]
}, [
	'blocking'
]);

redpajama_set_name: RedPajamaGithub


text:
var Emitter = function() {
  this.events = {};
}

Emitter.prototype.on = function(type, listener) {
  this.events[type] = this.events[type] || [];
  this.events[type].push(listener);
};

Emitter.prototype.emit = function(type) {
  // this is where you can pass in arguments, first arg is 'type'
  if (this.events[type]) {
    this.events[type].forEach(function(listener) {
      listener();
    });
  }
};

Emitter.prototype.constructor = Emitter;

module.exports = Emitter;


text:
@interface PushViewController : UIViewController

@property (nonatomic, strong) IBOutlet UIImageView *imageView;
@property (nonatomic, strong) UIImage *image;

@property (nonatomic, readonly) PopNavigationAnimator *popAnimator;

- (IBAction)hadlePinch:(UIPinchGestureRecognizer *)sender;

@end


text:
<?php $this->layout('layouts/status', ['template' => $template, 'components' => $components, 'incidents' => $incidents])?>

<?=$this->insert('partials/_header', ['template' => $template, 'components' => $components, 'incidents' => $incidents, 'path' => $path])?>

<?=$this->insert('partials/history/_month', ['template' => $template, 'components' => $components, 'incidents' => $incidents])?>

			← Current Status
			<?php if (SUPPORT_STATUS_CAT): ?>
				♥  🐱
			<?php endif?>

<?=$this->insert('partials/_footer', ['template' => $template, 'components' => $components, 'incidents' => $incidents])?>


text:
package com.zuoxiaolong.dynamic;

import com.zuoxiaolong.dao.ArticleDao;
import com.zuoxiaolong.dao.RecordDao;
import com.zuoxiaolong.model.Status;
import com.zuoxiaolong.model.ViewMode;
import com.zuoxiaolong.mvc.DataMap;
import com.zuoxiaolong.mvc.Namespace;
import com.zuoxiaolong.orm.DaoFactory;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**
 * @author 左潇龙
 * @since 2015年6月18日 下午2:47:47
 */
@Namespace("admin")
public class RecordInput implements DataMap {

    @Override
    public void putCustomData(Map<String, Object> data, HttpServletRequest request, HttpServletResponse response) {
        String id = request.getParameter("id");
        if (id != null) {
            data.put("record", DaoFactory.getDao(RecordDao.class).getRecord(Integer.valueOf(id), ViewMode.DYNAMIC));
        }
    }

}


text:
package org.kaaproject.kaa.server.admin.client.mvp.view.log;

import org.kaaproject.kaa.server.admin.client.mvp.view.schema.BaseSchemaViewImpl;
import org.kaaproject.kaa.server.admin.client.util.Utils;

public class LogSchemaViewImpl extends BaseSchemaViewImpl {

    public LogSchemaViewImpl(boolean create) {
        super(create);
    }

    @Override
    protected String getCreateTitle() {
        return Utils.constants.addLogSchema();
    }

    @Override
    protected String getViewTitle() {
        return Utils.constants.logSchema();
    }

    @Override
    protected String getSubTitle() {
        return Utils.constants.logSchemaDetails();
    }

}


text:
package com.brainy.command.http;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;

import java.util.*;

/**
 * Created by eossth on 10/4/2017 AD.
 */
public class GoogleCommandNodeTest {

    public static void main(String[]args) throws Exception {
        Map<String, String> googleMap = new TreeMap<>();

        googleMap.put("Albania", "https://www.google.al");
        googleMap.put("Algeria", "https://www.google.dz");
        googleMap.put("Argentina", "https://www.google.com.ar");
        googleMap.put("Armenia", "https://www.google.am");
        googleMap.put("Australia", "https://www.google.com.au");
        googleMap.put("Austria", "https://www.google.at");
        googleMap.put("Azerbaijan", "https://www.google.az");
        googleMap.put("Bahrain", "https://www.google.com.bh");
        googleMap.put("Bangladesh", "https://www.google.com.bd");
        googleMap.put("Belarus", "https://www.google.by");
        googleMap.put("Belgium", "https://www.google.be");
        googleMap.put("Bolivia", "https://www.google.com.bo");
        googleMap.put("Bosnia and Herzegovina", "https://www.google.ba");
        googleMap.put("Brazil", "https://www.google.com.br");
        googleMap.put("Bulgaria", "https://www.google.bg");
        googleMap.put("Cambodia", "https://www.google.com.kh");
        googleMap.put("Canada", "https://www.google.ca");
        googleMap.put("Chile", "https://www.google.cl");
        googleMap.put("China", "https://www.google.cn");
        googleMap.put("Colombia", "https://www.google.com.co");
        googleMap.put("Costa Rica", "https://www.google.co.cr");
        googleMap.put("Croatia", "https://www.google.hr");
        googleMap.put("Cuba", "https://www.google.com.cu");
        googleMap.put("Cyprus", "https://www.google.com.cy");
        googleMap.put("Czech Republic", "https://www.google.cz");
        googleMap.put("Denmark", "https://www.google.dk");
        googleMap.put("Dominican Republic", "https://www.google.com.do");
        googleMap.put("Ecuador", "https://www.google.com.ec");
        googleMap.put("Egypt", "https://www.google.com.eg");
        googleMap.put("El Salvador", "https://www.google.com.sv");
        googleMap.put("Estonia", "https://www.google.ee");
        googleMap.put("Ethiopia", "https://www.google.com.et");
        googleMap.put("Finland", "https://www.google.fi");
        googleMap.put("France", "https://www.google.fr");
        googleMap.put("Georgia", "https://www.google.ge");
        googleMap.put("Germany", "https://www.google.de");
        googleMap.put("Ghana", "https://www.google.com.gh");
        googleMap.put("Greece", "https://www.google.gr");
        googleMap.put("Guatemala", "https://www.google.com.gt");
        googleMap.put("Honduras", "https://www.google.hn");
        googleMap.put("Hong Kong", "https://www.google.com.hk");
        googleMap.put("Hungary", "https://www.google.co.hu");
        googleMap.put("Iceland", "https://www.google.is");
        googleMap.put("India", "https://www.google.co.in");
        googleMap.put("Indonesia", "https://www.google.co.id");
        googleMap.put("Iraq", "https://www.google.com.iq");
        googleMap.put("Ireland", "https://www.google.ie");
        googleMap.put("Israel", "https://www.google.co.il");
        googleMap.put("Italy", "https://www.google.it");
        googleMap.put("Japan", "https://www.google.co.jp");
        googleMap.put("Jordan", "https://www.google.jo");
        googleMap.put("Kenya", "https://www.google.co.ke");
        googleMap.put("Kuwait", "https://www.google.com.kw");
        googleMap.put("Laos", "https://www.google.la");
        googleMap.put("Latvia", "https://www.google.lv");
        googleMap.put("Lebanon", "https://www.google.com.lb");
        googleMap.put("Libya", "https://www.google.com.ly");
        googleMap.put("Lithuania", "https://www.google.lt");
        googleMap.put("Luxembourg", "https://www.google.lu");
        googleMap.put("Macedonia", "https://www.google.mk");
        googleMap.put("Malaysia", "https://www.google.com.my");
        googleMap.put("Malta", "https://www.google.com.mt");
        googleMap.put("Mexico", "https://www.google.com.mx");
        googleMap.put("Montenegro", "https://www.google.me");
        googleMap.put("Morocco", "https://www.google.co.ma");
        googleMap.put("Nepal", "https://www.google.com.np");
        googleMap.put("Netherlands", "https://www.google.nl");
        googleMap.put("New Zealand", "https://www.google.co.nz");
        googleMap.put("Nicaragua", "https://www.google.com.ni");
        googleMap.put("Nigeria", "https://www.google.com.ng");
        googleMap.put("Norway", "https://www.google.no");
        googleMap.put("Oman", "https://www.google.com.om");
        googleMap.put("Pakistan", "https://www.google.com.pk");
        googleMap.put("Panama", "https://www.google.com.pa");
        googleMap.put("Paraguay", "https://www.google.com.py");
        googleMap.put("Peru", "https://www.google.com.pe");
        googleMap.put("Philippines", "https://www.google.com.ph");
        googleMap.put("Poland", "https://www.google.pl");
        googleMap.put("Portugal", "https://www.google.pt");
        googleMap.put("Puerto Rico", "https://www.google.com.pr");
        googleMap.put("Qatar", "https://www.google.com.qa");
        googleMap.put("Romania", "https://www.google.ro");
        googleMap.put("Russia", "https://www.google.ru");
        googleMap.put("Saudi Arabia", "https://www.google.com.sa");
        googleMap.put("Serbia", "https://www.google.rs");
        googleMap.put("Singapore", "https://www.google.com.sg");
        googleMap.put("Slovakia", "https://www.google.sk");
        googleMap.put("Slovenia", "https://www.google.si");
        googleMap.put("South Africa", "https://www.google.co.za");
        googleMap.put("South Korea", "https://www.google.co.kr");
        googleMap.put("Spain", "https://www.google.es");
        googleMap.put("Sri Lanka", "https://www.google.lk");
        googleMap.put("Srilanka", "https://www.google.lk");
        googleMap.put("State of Palestine", "https://www.google.ps");
        googleMap.put("Sweden", "https://www.google.se");
        googleMap.put("Switzerland", "https://www.google.ch");
        googleMap.put("Taiwan", "https://www.google.com.tw");
        googleMap.put("Tanzania", "https://www.google.co.tz");
        googleMap.put("Thailand", "https://www.google.co.th");
        googleMap.put("Tunisia", "https://www.google.tn");
        googleMap.put("Turkey", "https://www.google.com.tr");
        googleMap.put("Ukraine", "https://www.google.com.ua");
        googleMap.put("United Arab Emirates", "https://www.google.ae");
        googleMap.put("United Kingdom", "https://www.google.co.uk");
        googleMap.put("United States", "https://www.google.com");
        googleMap.put("Uruguay", "https://www.google.com.uy");
        googleMap.put("Venezuela", "https://www.google.co.ve");
        googleMap.put("Vietnam", "https://www.google.com.vn");

        for (Map.Entry<String, String> entry:googleMap.entrySet()) {
            System.out.printf("googleMap.put(\"%s\", \"%s\");", entry.getKey(), entry.getValue() );
            System.out.println();
        }

        Document doc = Jsoup.connect("https://translate.google.com/#en/ja/yes").userAgent("Mozilla/5.0").get();

        System.out.println(doc);
    }

}


text:
ONCE
This is a rules engine, API, and web application that assesses Medicaid Eligibility based on an applicant's household's Modified Adjusted Gross Income (MAGI) and other eligibility criteria, a requirement of the Affordable Care Act which sets the new baseline for eligibility. This system was implemented in partnership with the HHSEntrepeneurs program, BlueLabs, and the State Health Reform Assistance Network (State Network), a Robert Wood Johnson Foundation funded program. It makes determinations without accepting any personally identifiable information.

This is provided as a reference implementation and out of the box solution for states and other interested parties to determine an individual's medicaid eligibility. It is not currently used in any federal systems.

A hosted version of this tool is available at https://www.medicaideligibilityapi.org/

To run the tool locally, run:
```
bundle install
rails s
browse to http://localhost:3000/
```

To calculate Medicaid eligibility for a group of applications, post the JSON blob for an application to `/determinations/eval`

You can also evaluate a specific ruleset on specified inputs/configs. POST the JSON to `http://localhost:3000/rulesets/MAGI/{ruleset}/eval` For example:
```
~ $ curl -d '{"config": {"Option Adult Group": "Y"}, "inputs":{"Applicant Age": 25, "Applicant Pregnancy Category Indicator": "N", "Medicare Entitlement Indicator": "N"}}' http://0.0.0:3000/rulesets/MAGI/adult_group/eval --header "Content-Type: application/json" -H 'Accept: application/json'; echo
{"Applicant Adult Group Category Indicator":"Y","Adult Group Category Determination Date":"2014-01-17","Adult Group Category Ineligibility Reason":999}
```

Additional information about how to integrate the project using the API can be found in doc/MitC integration.docx

The test suite is Minitest and Rspec. To run all the tests:
```
~ $ rake build
```
In the event that this returns a Gem::LoadError or a mysterious error about how `+' is an undefined method, run bundle update first.

This project is licensed with a BSD license, open source with attribution. Details in the LICENSE file.

(c) 2013 BlueLabs.


text:
var slice = [].slice;
var tstr = ({}).toString;

function extend(o1, o2 ){
  for(var i in o2) if( o1[i] === undefined){
    o1[i] = o2[i]
  }
}

// String proto ;
extend(String.prototype, {
  trim: function(){
    return this.replace(/^\s+|\s+$/g, '');
  }
});

// Array proto;
extend(Array.prototype, {
  indexOf: function(obj, from){
    from = from || 0;
    for (var i = from, len = this.length; i < len; i++) {
      if (this[i] === obj) return i;
    }
    return -1;
  },
  forEach: function(callback, context){
    for (var i = 0, len = this.length; i < len; i++) {
      callback.call(context, this[i], i, this);
    }
  },
  filter: function(callback, context){
    var res = [];
    for (var i = 0, length = this.length; i < length; i++) {
      var pass = callback.call(context, this[i], i, this);
      if(pass) res.push(this[i]);
    }
    return res;
  },
  map: function(callback, context){
    var res = [];
    for (var i = 0, length = this.length; i < length; i++) {
      res.push(callback.call(context, this[i], i, this));
    }
    return res;
  }
});

// Function proto;
extend(Function.prototype, {
  bind: function(context){
    var fn = this;
    var preArgs = slice.call(arguments, 1);
    return function(){
      var args = preArgs.concat(slice.call(arguments));
      return fn.apply(context, args);
    }
  }
})

// Object
extend(Object, {
  keys: function(obj){
    var keys = [];
    for(var i in obj) if(obj.hasOwnProperty(i)){
      keys.push(i);
    }
    return keys;
  }
})

// Date
extend(Date, {
  now: function(){
    return +new Date;
  }
})
// Array
extend(Array, {
  isArray: function(arr){
    return tstr.call(arr) === "[object Array]";
  }
})


text:
using System;

namespace GoogleApi.Entities.Places.Search.Find.Request.Enums
{
    /// <summary>
    /// Field Types.
    /// </summary>
    [Flags]
    public enum FieldTypes
    {
        /// <summary>
        /// Formatted Address (billing: basic).
        /// </summary>
        Formatted_Address = 1 << 1,

        /// <summary>
        /// Geometry (billing: basic).
        /// </summary>
        Geometry = 1 << 2,

        /// <summary>
        /// Icon (billing: basic).
        /// </summary>
        Icon = 1 << 3,

        /// <summary>
        /// Name (billing: basic).
        /// </summary>
        Name = 1 << 4,

        /// <summary>
        /// Photos (billing: basic).
        /// </summary>
        Photos = 1 << 5,

        /// <summary>
        /// Place_Id (billing: basic).
        /// </summary>
        Place_Id = 1 << 6,

        /// <summary>
        /// Plus_Code (billing: basic).
        /// </summary>
        Plus_Code = 1 << 7,

        /// <summary>
        /// Types (billing: basic).
        /// </summary>
        Types = 1 << 8,

        /// <summary>
        /// Opening Hours (billing: contact).
        /// </summary>
        Opening_Hours = 1 << 9,

        /// <summary>
        /// Price Level (billing: atmosphere)
        /// </summary>
        Price_Level = 1 << 10,

        /// <summary>
        /// Rating (billing: atmosphere).
        /// </summary>
        Rating = 1 << 11,

        /// <summary>
        /// User Ratings Total (billing: atmosphere).
        /// </summary>
        User_Ratings_Total = 1 << 12,

        /// <summary>
        /// Business Status.
        /// </summary>
        Business_Status = 1 << 13,

        /// <summary>
        /// Basic (all).
        /// </summary>
        Basic = Formatted_Address | Geometry | Icon | Name | Photos | Place_Id | Plus_Code | Types | Business_Status,

        /// <summary>
        /// Contact (all).
        /// </summary>
        Contact = Opening_Hours,

        /// <summary>
        /// Atmosphere (all).
        /// </summary>
        Atmosphere = Price_Level | Rating | User_Ratings_Total
    }
}


text:
//  Copyright 2011年 Renren Inc. All rights reserved.
//  - Powered by Team Pegasus. -

using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace RenrenSDKLibrary
{
    public class Friend
    {
        public int id { get; set; }

        public string tinyurl { get; set; }

        public string name { get; set; }

        public string headurl { get; set; }

        public string headurl_with_logo { get; set; }

        public string tinyurl_with_logo { get; set; }
    }
}


text:
#ifndef LIB_BLOCKINGQUEUE_H_
#define LIB_BLOCKINGQUEUE_H_

#include <boost/thread/mutex.hpp>
#include <boost/thread/condition.hpp>
#include <boost/circular_buffer.hpp>

/**
 * Following structs are defined for holding a predicate in wait() call on condition variables.
 * This is done in order to avoid spurious wake up problem.
 * Details: https://www.justsoftwaresolutions.co.uk/threading/condition-variable-spurious-wakes.html
 */
template<typename Container>
struct QueueNotEmpty {
    const Container& queue_;
    QueueNotEmpty(const Container& queue)
            : queue_(queue) {

    }
    bool operator()() const {
        return !queue_.isEmptyNoMutex();
    }
};

template<typename Container>
struct QueueNotFull {
    const Container& queue_;
    QueueNotFull(const Container& queue)
            : queue_(queue) {

    }
    bool operator()() const {
        return !queue_.isFullNoMutex();
    }
};

template<typename T>
class BlockingQueue {
 public:
    typedef typename boost::circular_buffer<T> Container;
    typedef typename Container::iterator iterator;
    typedef typename Container::const_iterator const_iterator;

    class ReservedSpot {
     public:
        ReservedSpot()
                : queue_(),
                  released_(true) {
        }

        ReservedSpot(BlockingQueue<T>& queue)
                : queue_(&queue),
                  released_(false) {
        }

        ~ReservedSpot() {
            release();
        }

        void release() {
            if (!released_) {
                queue_->releaseReservedSpot();
                released_ = true;
            }
        }

     private:
        BlockingQueue<T>* queue_;
        bool released_;

        friend class BlockingQueue<T> ;
    };

    BlockingQueue(size_t maxSize)
            : maxSize_(maxSize),
              mutex_(),
              queue_(maxSize),
              reservedSpots_(0) {
    }

    bool tryReserve(size_t noOfSpots) {
        assert(noOfSpots <= maxSize_);
        Lock lock(mutex_);
        if(noOfSpots <= maxSize_ - (reservedSpots_ + queue_.size())) {
            reservedSpots_ += noOfSpots;
            return true;
        }
        return false;
    }

    void reserve(size_t noOfSpots) {
        assert(noOfSpots <= maxSize_);
        Lock lock(mutex_);
        while(noOfSpots--) {
            queueFullCondition.wait(lock, QueueNotFull<BlockingQueue<T> >(*this));
            reservedSpots_++;
        }
    }

    void release(size_t noOfSpots) {
        Lock lock(mutex_);
        assert(noOfSpots <= reservedSpots_);
        bool wasFull = isFullNoMutex();
        reservedSpots_ -= noOfSpots;
        lock.unlock();

        if (wasFull) {
            // Notify that one spot is now available
            queueFullCondition.notify_all();
        }
    }

    ReservedSpot reserve() {
        Lock lock(mutex_);
        // If the queue is full, wait for space to be available
        queueFullCondition.wait(lock, QueueNotFull<BlockingQueue<T> >(*this));
        reservedSpots_++;
        return ReservedSpot(*this);
    }

    void push(const T& value, bool wasReserved = false) {
        Lock lock(mutex_);
        if (wasReserved) {
            reservedSpots_--;
        }
        // If the queue is full, wait for space to be available
        queueFullCondition.wait(lock, QueueNotFull<BlockingQueue<T> >(*this));
        bool wasEmpty = queue_.empty();
        queue_.push_back(value);
        lock.unlock();
        if (wasEmpty) {
            // Notify that an element is pushed
            queueEmptyCondition.notify_one();
        }
    }

    void push(const T& value, ReservedSpot& spot) {
        Lock lock(mutex_);

        // Since the value already had a spot reserved in the queue, we need to
        // discount it
        assert(reservedSpots_ > 0);
        reservedSpots_--;
        spot.released_ = true;

        bool wasEmpty = queue_.empty();
        queue_.push_back(value);
        lock.unlock();

        if (wasEmpty) {
            // Notify that an element is pushed
            queueEmptyCondition.notify_one();
        }
    }

    bool tryPush(const T& value) {
        Lock lock(mutex_);

        // Need to consider queue_.size() + reserved spot
        if (isFullNoMutex()) {
            return false;
        }

        bool wasEmpty = queue_.empty();
        queue_.push_back(value);
        lock.unlock();

        if (wasEmpty) {
            // Notify that an element is pushed
            queueEmptyCondition.notify_one();
        }

        return true;
    }

    void pop() {
        Lock lock(mutex_);
        // If the queue is empty, wait until an element is available to be popped
        queueEmptyCondition.wait(lock, QueueNotEmpty<BlockingQueue<T> >(*this));

        bool wasFull = isFullNoMutex();
        queue_.pop_front();
        lock.unlock();

        if (wasFull) {
            // Notify that an element is popped
            queueFullCondition.notify_one();
        }
    }

    void pop(T& value) {
        Lock lock(mutex_);
        // If the queue is empty, wait until an element is available to be popped
        queueEmptyCondition.wait(lock, QueueNotEmpty<BlockingQueue<T> >(*this));
        value = queue_.front();

        bool wasFull = isFullNoMutex();
        queue_.pop_front();
        lock.unlock();

        if (wasFull) {
            // Notify that an element is popped
            queueFullCondition.notify_one();
        }
    }

    bool pop(T& value, const boost::posix_time::time_duration& timeout) {
        Lock lock(mutex_);
        if (!queueEmptyCondition.timed_wait(lock, timeout,
                                            QueueNotEmpty<BlockingQueue<T> >(*this))) {
            return false;
        }

        bool wasFull = isFullNoMutex();
        value = queue_.front();
        queue_.pop_front();
        lock.unlock();

        if (wasFull) {
            // Notify that an element is popped
            queueFullCondition.notify_all();
        }

        return true;
    }

    // Check the 1st element of the queue
    bool peek(T& value) {
        Lock lock(mutex_);
        if (queue_.empty()) {
            return false;
        }

        value = queue_.front();
        return true;
    }

    // Remove all elements from the queue
    void clear() {
        Lock lock(mutex_);
        queue_.clear();
        queueFullCondition.notify_all();
    }

    size_t size() const {
        Lock lock(mutex_);
        return queue_.size();
    }

    size_t maxSize() const {
        return maxSize_;
    }

    bool empty() const {
        Lock lock(mutex_);
        return isEmptyNoMutex();
    }

    bool full() const {
        Lock lock(mutex_);
        return isFullNoMutex();
    }

    const_iterator begin() const {
        return queue_.begin();
    }

    const_iterator end() const {
        return queue_.end();
    }

    iterator begin() {
        return queue_.begin();
    }

    iterator end() {
        return queue_.end();
    }

 private:
    void releaseReservedSpot() {
        Lock lock(mutex_);
        bool wasFull = isFullNoMutex();
        --reservedSpots_;
        lock.unlock();

        if (wasFull) {
            // Notify that one spot is now available
            queueFullCondition.notify_one();
        }
    }

    bool isEmptyNoMutex() const {
        return queue_.empty();
    }

    bool isFullNoMutex() const {
        return (queue_.size() + reservedSpots_) == maxSize_;
    }

    const size_t maxSize_;
    mutable boost::mutex mutex_;
    boost::condition_variable queueFullCondition;
    boost::condition_variable queueEmptyCondition;
    Container queue_;
    int reservedSpots_;

    typedef boost::unique_lock<boost::mutex> Lock;
    friend class QueueReservedSpot;
    friend struct QueueNotEmpty<BlockingQueue<T> > ;
    friend struct QueueNotFull<BlockingQueue<T> > ;
};

#endif /* LIB_BLOCKINGQUEUE_H_ */


text:
exports.acl = ['*'];

exports.execute = function (state, topic, index, data, mediaType, encoding, expirationTime, cb) {
	var clientVault = state.archivist.getPrivateVault('client');
	if (!clientVault) {
		return state.error(null, 'Client vault not configured in writeOrder.', cb);
	}

	var topicApi = state.archivist.getTopicApi(topic, clientVault.name);
	if (!topicApi) {
		return state.error(
			null, 'Unable to load topic API on client vault for topic: ' + topic, cb
		);
	}

	var options = {
		mediaTypes: [mediaType],
		encodings: [encoding]
	};

	state.archivist.getValue(topic, index, options, function (error, value) {
		if (error) {
			return cb(error);
		}

		var allowedActors;

		try {
			allowedActors = topicApi.shard(value);
		} catch (apiError) {
			return state.error(null, apiError, cb);
		}

		if (!clientVault.operationAllowedForSession(state, topicApi.acl, 'set', allowedActors)) {
			return state.error(
				null,
				'Actor ' + state.actorId + ' not allowed to add data to topic "' + topic + '".',
				cb
			);
		}

		try {
			state.archivist.add(topic, index, data, mediaType, encoding, expirationTime);
		} catch (error) {
			return state.error(null, error, cb);
		}

		cb();
	});
};


text:
title: "Trapping Rain Water"
description: "Some description ..."
authors: ["lek-tin"]
tags: ["leetcode", "dynamic-programming", "two-pointers"]
categories: ["algorithm"]
date: 2019-01-26T23:39:49-08:00
lastmod: 2019-01-26T23:39:49-08:00
draft: false
archive: false
---
Given n non-negative integers representing an elevation map where the width of each bar is `1`, compute how much water it is able to trap after raining.

![Trapping Rain Water Illustration](/img/post/trapping-rain-water-illustration.png)
The above elevation map is represented by array `[0,1,0,2,1,0,1,3,2,1,2,1]`. In this case, 6 units of rain water (blue section) are being trapped. Thanks Marcos for contributing this image!

### Example:
```
Input: [0,1,0,2,1,0,1,3,2,1,2,1]
Output: 6
```

### Solution 1

Time: `O(n)`
Space: `O(1)`
```java
class Solution {
    public int trap(int[] height) {
        int n = height.length;
        int res = 0;
        int left = 0;
        int right = n - 1;
        int leftHeight = 0;
        int rightHeight = 0;

        while(left <= right){
            if(height[left] <= height[right]){
                if(height[left] >= leftHeight) {
                    leftHeight = height[left];
                }
                else {
                    res += leftHeight - height[left];
                }
                left++;
            }
            else{
                if(height[right] >= rightHeight) {
                    rightHeight = height[right];
                }
                else {
                    res += rightHeight - height[right];
                }
                right--;
            }
        }
        return res;
    }
}
```

### Solution 2

Dynamic programming version
Time: `O(n)`
Space: `O(n)`
![Trapping Rain Water Dynamic Programming](/img/post/trapping-rain-water-dynamic-programming.png)
```python
class Solution:
    def trap(self, height: List[int]) -> int:
        N = len(height)

        if not height or N == 0:
            return 0

        amount = 0
        left_max, right_max = [0] * N, [0] * N

        # left -> right
        left_max[0] = height[0]
        for i in range(N-1):
            left_max[i] = max(left_max[i-1], height[i])
        # right <- left
        right_max[-1] = height[-1]
        for i in range(N-2, -1, -1):
            right_max[i] = max(right_max[i+1], height[i])

        # scan water at each coloum from left -> right
        for i in range(1, N-1):
            amount += min(left_max[i], right_max[i]) - height[i]

        return amount
```


text:
package com.jtbdevelopment.TwistedHangman.game.handlers;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame;

import com.jtbdevelopment.TwistedHangman.TwistedHangmanTestCase;
import com.jtbdevelopment.TwistedHangman.dao.GameRepository;
import com.jtbdevelopment.TwistedHangman.game.state.GameFeature;
import com.jtbdevelopment.TwistedHangman.game.state.GamePhaseTransitionEngine;
import com.jtbdevelopment.TwistedHangman.game.state.THGame;
import com.jtbdevelopment.TwistedHangman.game.state.masking.THGameMasker;
import com.jtbdevelopment.TwistedHangman.game.state.masking.THMaskedGame;
import com.jtbdevelopment.games.dao.AbstractGameRepository;
import com.jtbdevelopment.games.dao.AbstractPlayerRepository;
import com.jtbdevelopment.games.events.GamePublisher;
import com.jtbdevelopment.games.mongo.dao.MongoPlayerRepository;
import com.jtbdevelopment.games.mongo.players.MongoPlayer;
import com.jtbdevelopment.games.state.GamePhase;
import com.jtbdevelopment.games.state.transition.GameTransitionEngine;
import com.jtbdevelopment.games.tracking.GameEligibilityTracker;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import org.bson.types.ObjectId;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;

/**
 * Date: 11/10/14 Time: 7:06 PM
 */
public class AbstractPlayerRotatingGameActionHandlerTest extends TwistedHangmanTestCase {

  private static final String testParam = "TESTPARAM";
  private final THGame gameParam = new THGame();
  private final ObjectId gameId = new ObjectId();
  private THGame handledGame = new THGame();
  private MongoPlayerRepository playerRepository = Mockito.mock(MongoPlayerRepository.class);
  private GameRepository gameRepository = Mockito.mock(GameRepository.class);
  private GamePhaseTransitionEngine transitionEngine = Mockito
      .mock(GamePhaseTransitionEngine.class);
  private GamePublisher gamePublisher = Mockito.mock(GamePublisher.class);
  private GameEligibilityTracker eligibilityTracker = Mockito.mock(GameEligibilityTracker.class);
  private THGameMasker gameMasker = Mockito.mock(THGameMasker.class);
  private TestHandler handler = new TestHandler(playerRepository, gameRepository, transitionEngine,
      gamePublisher, eligibilityTracker, gameMasker);

  @Before
  public void setup() {
    Mockito.when(gameRepository.findById(gameId)).thenReturn(Optional.of(gameParam));
    Mockito.when(playerRepository.findById(PONE.getId())).thenReturn(Optional.of(PONE));
    gameParam.setId(new ObjectId());
    handledGame.setId(new ObjectId());
  }

  @Test
  public void testAbstractHandlerBasic() {
    THGame saved = new THGame();
    saved.setId(new ObjectId());
    THGame transitioned = new THGame();
    transitioned.setId(new ObjectId());
    THGame published = new THGame();
    published.setId(new ObjectId());
    gameParam.setPlayers(Arrays.asList(PONE, PTWO));
    Mockito.when(gameRepository.save(transitioned)).thenReturn(saved);
    Mockito.when(transitionEngine.evaluateGame(handledGame)).thenReturn(transitioned);
    Mockito.when(gamePublisher.publish(saved, PONE)).thenReturn(published);
    THMaskedGame maskedGame = new THMaskedGame();
    maskedGame.setId(gameParam.getId().toHexString());
    Mockito.when(gameMasker.maskGameForPlayer(published, PONE)).thenReturn(maskedGame);
    assertSame(maskedGame, handler.handleAction(PONE.getId(), gameId, testParam));
  }

  @Test
  public void testAbstractHandlerBaseRotatesTurn() {
    gameParam.setPlayers(Arrays.asList(PTWO, PONE));
    gameParam.getFeatures().add(GameFeature.TurnBased);
    gameParam.getFeatureData().put(GameFeature.TurnBased, PONE.getId());
    handledGame.getFeatureData().clear();
    handledGame.getFeatureData().putAll(gameParam.getFeatureData());
    handledGame.getFeatures().clear();
    handledGame.getFeatures().addAll(gameParam.getFeatures());
    handledGame.getPlayers().clear();
    handledGame.getPlayers().addAll(gameParam.getPlayers());
    handledGame.setGamePhase(GamePhase.Playing);
    gameParam.setGamePhase(GamePhase.Playing);

    THGame saved = makeSimpleGame();
    THGame transitioned = makeSimpleGame();
    THGame published = makeSimpleGame();
    Mockito.when(gameRepository.save(transitioned)).thenReturn(saved);
    Mockito.when(transitionEngine.evaluateGame(handledGame)).thenReturn(transitioned);
    Mockito.when(gamePublisher.publish(saved, PONE)).thenReturn(published);
    THMaskedGame maskedGame = new THMaskedGame();
    Mockito.when(gameMasker.maskGameForPlayer(published, PONE)).thenReturn(maskedGame);

    assertSame(maskedGame, handler.handleAction(PONE.getId(), gameId, testParam));
    assertEquals(PTWO.getId(), handledGame.getFeatureData().get(GameFeature.TurnBased));
  }

  @Test
  public void testAbstractHandlerBaseRotatesTurnPastWordPhraseSetter() {
    gameParam.setPlayers(Arrays.asList(PTWO, PONE, PTHREE));
    gameParam.getFeatures().add(GameFeature.TurnBased);
    gameParam.getFeatureData().put(GameFeature.TurnBased, PONE.getId());
    gameParam.setWordPhraseSetter(PTHREE.getId());
    handledGame.getFeatureData().clear();
    handledGame.getFeatureData().putAll(gameParam.getFeatureData());
    handledGame.getFeatures().clear();
    handledGame.getFeatures().addAll(gameParam.getFeatures());
    handledGame.getPlayers().clear();
    handledGame.getPlayers().addAll(gameParam.getPlayers());
    handledGame.setGamePhase(GamePhase.Playing);
    gameParam.setGamePhase(GamePhase.Playing);

    handledGame = makeSimpleGame();
    THGame saved = makeSimpleGame();
    THGame transitioned = makeSimpleGame();
    THGame published = makeSimpleGame();
    Mockito.when(gameRepository.save(transitioned)).thenReturn(saved);
    Mockito.when(transitionEngine.evaluateGame(handledGame)).thenReturn(transitioned);
    Mockito.when(gamePublisher.publish(saved, PONE)).thenReturn(published);
    THMaskedGame maskedGame = new THMaskedGame();
    Mockito.when(gameMasker.maskGameForPlayer(published, PONE)).thenReturn(maskedGame);

    assertSame(maskedGame, handler.handleAction(PONE.getId(), gameId, testParam));
  }

  @Test
  public void testAbstractHandlerBaseDoesNotRotateTurnWhenNotPlaying() {
    gameParam.setPlayers(Arrays.asList(PTWO, PONE));
    gameParam.getFeatures().add(GameFeature.TurnBased);
    gameParam.getFeatureData().put(GameFeature.TurnBased, PONE.getId());
    handledGame.getFeatureData().clear();
    handledGame.getFeatureData().putAll(gameParam.getFeatureData());
    handledGame.getFeatures().clear();
    handledGame.getFeatures().addAll(gameParam.getFeatures());
    handledGame.getPlayers().clear();
    handledGame.getPlayers().addAll(gameParam.getPlayers());
    handledGame.setGamePhase(GamePhase.Setup);
    gameParam.setGamePhase(GamePhase.Setup);

    THGame saved = makeSimpleGame();
    THGame transitioned = makeSimpleGame();
    THGame published = makeSimpleGame();
    Mockito.when(gameRepository.save(transitioned)).thenReturn(saved);
    Mockito.when(transitionEngine.evaluateGame(handledGame)).thenReturn(transitioned);
    Mockito.when(gamePublisher.publish(saved, PONE)).thenReturn(published);
    THMaskedGame maskedGame = new THMaskedGame();
    Mockito.when(gameMasker.maskGameForPlayer(published, PONE)).thenReturn(maskedGame);

    assertSame(maskedGame, handler.handleAction(PONE.getId(), gameId, testParam));
    assertEquals(PONE.getId(), handledGame.getFeatureData().get(GameFeature.TurnBased));
  }

  @Test
  public void testAbstractHandlerBaseDoesNotRotateTurnWhenPlayingNonTurnedBasedGame() {
    gameParam.setPlayers(Arrays.asList(PTWO, PONE));
    gameParam.getFeatures().remove(GameFeature.TurnBased);
    Map<GameFeature, Object> map = new HashMap<>();
    map.put(GameFeature.TurnBased, PONE.getId());
    gameParam.setFeatureData(map);
    handledGame.getFeatureData().clear();
    handledGame.getFeatureData().putAll(gameParam.getFeatureData());
    handledGame.getFeatures().clear();
    handledGame.getFeatures().addAll(gameParam.getFeatures());
    handledGame.getPlayers().clear();
    handledGame.getPlayers().addAll(gameParam.getPlayers());
    handledGame.setGamePhase(GamePhase.Playing);
    gameParam.setGamePhase(GamePhase.Playing);

    THGame saved = makeSimpleGame();
    THGame transitioned = makeSimpleGame();
    THGame published = makeSimpleGame();
    Mockito.when(gameRepository.save(transitioned)).thenReturn(saved);
    Mockito.when(transitionEngine.evaluateGame(handledGame)).thenReturn(transitioned);
    Mockito.when(gamePublisher.publish(saved, PONE)).thenReturn(published);
    THMaskedGame maskedGame = new THMaskedGame();
    Mockito.when(gameMasker.maskGameForPlayer(published, PONE)).thenReturn(maskedGame);

    assertSame(maskedGame, handler.handleAction(PONE.getId(), gameId, testParam));
    assertEquals(PONE.getId(), handledGame.getFeatureData().get(GameFeature.TurnBased));
  }

  private class TestHandler extends AbstractPlayerRotatingGameActionHandler<String> {

    private boolean checkEligibility = false;
    private boolean internalException = false;

    public TestHandler(
        AbstractPlayerRepository<ObjectId, MongoPlayer> playerRepository,
        AbstractGameRepository<ObjectId, GameFeature, THGame> gameRepository,
        GameTransitionEngine<THGame> transitionEngine,
        GamePublisher<THGame, MongoPlayer> gamePublisher,
        GameEligibilityTracker gameTracker,
        com.jtbdevelopment.games.state.masking.GameMasker<ObjectId, THGame, THMaskedGame> gameMasker) {
      super(playerRepository, gameRepository, transitionEngine, gamePublisher, gameTracker,
          gameMasker);
    }

    @Override
    protected boolean requiresEligibilityCheck(final String param) {
      return checkEligibility;
    }

    @Override
    protected THGame handleActionInternal(MongoPlayer player, THGame game, String param) {
      assertEquals(testParam, param);
      assertSame(game, gameParam);
      if (internalException) {
        throw new IllegalStateException();
      }

      return handledGame;
    }
  }
}


text:
<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">

  <title>Everything</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />

Everything

All Classes

    pln_inco.temantex.AnotAtrib.Anotacion
    pln_inco.temantex.AnotAtrib.Atributo
    pln_inco.util.Tokenizador.TokenTexto

All Functions

    pln_inco.Freeling.obtenerInfoEtiquetadoFreeling
    pln_inco.Freeling.obtenerOracionesEtiquetadasFreeling
    pln_inco.Freeling.obtenerSalidaFreeling

    pln_inco.Freeling.sacarTildes

    pln_inco.Freeling.salidaProceso

    pln_inco.temantex.AnotAtrib.obtenerAnotaciones
    pln_inco.temantex.Oraciones.cargarOraciones
    pln_inco.temantex.Oraciones.printOraciones
    pln_inco.temantex.Oraciones.printOracionesSalidaClasificacion

    pln_inco.temantex.VinculacionFreelingEventos.cargarAnotacionesEventos

    pln_inco.temantex.VinculacionFreelingEventos.getValorAtributo

    pln_inco.temantex.VinculacionFreelingEventos.mergeFreelingConAnotaciones

    pln_inco.temantex.VinculacionFreelingEventos.obtenerOracionesTokensEtiquetados

    pln_inco.temantex.VinculacionFreelingEventos.quedarseConUnaAnotacion

    pln_inco.util.Tokenizador.obtenerTokens

All Variables

    pln_inco.Freeling.__package__

    pln_inco.Freeling.base_cmd_freeling

    pln_inco.temantex.AnotAtrib.__package__
    pln_inco.temantex.Oraciones.__package__

    pln_inco.temantex.VinculacionFreelingEventos.__package__

    pln_inco.util.Tokenizador.__package__

[hide private]


text:
//
//  CouponRuleVC.h
//  MGLoveFreshBeen
//
//  Created by ming on 16/7/16.
//  Copyright © 2016年 ming. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface CouponRuleVC : UIViewController
/** 跳转的url */
@property (nonatomic,copy) NSString *urlStr;
@end


text:
require 'spec_helper'

describe "authors/show" do
  before(:each) do
    @author = assign(:author, stub_model(Author,
      :first_name => "First Name",
      :last_name => "Last Name",
      :bibliography => "Bibliography"
    ))
  end

  it "renders attributes in <p>" do
    render
    expect(rendered).to match(/First Name/)
    expect(rendered).to match(/Last Name/)
    expect(rendered).to match(/Bibliography/)
  end
end


text:
/**
 *     This code was auto-generated by a Codezu.
 *
 *     Changes to this file may cause incorrect behavior and will be lost if
 *     the code is regenerated.
 */
package com.mozu.api.clients.event.push.subscriptions;

import java.util.List;
import java.util.ArrayList;
import com.mozu.api.MozuClient;
import com.mozu.api.MozuClientFactory;
import com.mozu.api.MozuUrl;
import com.mozu.api.Headers;
import com.mozu.api.security.AuthTicket;
import org.apache.commons.lang.StringUtils;
/**
 * Provides details for each attempted delivery of the event to the endpoint.
 *
 */
public class EventDeliverySummaryClient {

	/**
	 * This operation method is the external/public event entity used specifically in pull/poll event scenarios.
	 *

	 * MozuClient<com.mozu.api.contracts.event.EventDeliverySummary> mozuClient=GetDeliveryAttemptSummaryClient( subscriptionId);
	 * client.setBaseAddress(url);
	 * client.executeRequest();
	 * EventDeliverySummary eventDeliverySummary = client.Result();
	 *

	 * @param subscriptionId Unique identifier for a subscription, such as subscribing tenants for an event or to receive a notification.
	 * @return Mozu.Api.MozuClient <com.mozu.api.contracts.event.EventDeliverySummary>
	 * @see com.mozu.api.contracts.event.EventDeliverySummary
	 */
	public static MozuClient<com.mozu.api.contracts.event.EventDeliverySummary> getDeliveryAttemptSummaryClient(String subscriptionId) throws Exception
	{
		return getDeliveryAttemptSummaryClient( subscriptionId,  null,  null);
	}

	/**
	 * This operation method is the external/public event entity used specifically in pull/poll event scenarios.
	 *

	 * MozuClient<com.mozu.api.contracts.event.EventDeliverySummary> mozuClient=GetDeliveryAttemptSummaryClient( subscriptionId,  id,  responseFields);
	 * client.setBaseAddress(url);
	 * client.executeRequest();
	 * EventDeliverySummary eventDeliverySummary = client.Result();
	 *

	 * @param id Unique identifier of the customer segment to retrieve.
	 * @param responseFields Use this field to include those fields which are not included by default.
	 * @param subscriptionId Unique identifier for a subscription, such as subscribing tenants for an event or to receive a notification.
	 * @return Mozu.Api.MozuClient <com.mozu.api.contracts.event.EventDeliverySummary>
	 * @see com.mozu.api.contracts.event.EventDeliverySummary
	 */
	public static MozuClient<com.mozu.api.contracts.event.EventDeliverySummary> getDeliveryAttemptSummaryClient(String subscriptionId, Integer id, String responseFields) throws Exception
	{
		MozuUrl url = com.mozu.api.urls.event.push.subscriptions.EventDeliverySummaryUrl.getDeliveryAttemptSummaryUrl(id, responseFields, subscriptionId);
		String verb = "GET";
		Class<?> clz = com.mozu.api.contracts.event.EventDeliverySummary.class;
		MozuClient<com.mozu.api.contracts.event.EventDeliverySummary> mozuClient = (MozuClient<com.mozu.api.contracts.event.EventDeliverySummary>) MozuClientFactory.getInstance(clz);
		mozuClient.setVerb(verb);
		mozuClient.setResourceUrl(url);
		return mozuClient;

	}

	/**
	 * Retrieves a collection of data for delivery attempts of events and notifications. These are notifications sent to subscribing sites and tenants. A paged list is returned sorted and filtered per the entered parameters.
	 *

	 * MozuClient<com.mozu.api.contracts.event.EventDeliverySummaryCollection> mozuClient=GetDeliveryAttemptSummariesClient( subscriptionId);
	 * client.setBaseAddress(url);
	 * client.executeRequest();
	 * EventDeliverySummaryCollection eventDeliverySummaryCollection = client.Result();
	 *

	 * @param subscriptionId Unique identifier for a subscription, such as subscribing tenants for an event or to receive a notification.
	 * @return Mozu.Api.MozuClient <com.mozu.api.contracts.event.EventDeliverySummaryCollection>
	 * @see com.mozu.api.contracts.event.EventDeliverySummaryCollection
	 */
	public static MozuClient<com.mozu.api.contracts.event.EventDeliverySummaryCollection> getDeliveryAttemptSummariesClient(String subscriptionId) throws Exception
	{
		return getDeliveryAttemptSummariesClient( subscriptionId,  null,  null,  null,  null,  null);
	}

	/**
	 * Retrieves a collection of data for delivery attempts of events and notifications. These are notifications sent to subscribing sites and tenants. A paged list is returned sorted and filtered per the entered parameters.
	 *

	 * MozuClient<com.mozu.api.contracts.event.EventDeliverySummaryCollection> mozuClient=GetDeliveryAttemptSummariesClient( subscriptionId,  startIndex,  pageSize,  sortBy,  filter,  responseFields);
	 * client.setBaseAddress(url);
	 * client.executeRequest();
	 * EventDeliverySummaryCollection eventDeliverySummaryCollection = client.Result();
	 *

	 * @param filter A set of expressions that consist of a field, operator, and value and represent search parameter syntax when filtering results of a query. Valid operators include equals (eq), does not equal (ne), greater than (gt), less than (lt), greater than or equal to (ge), less than or equal to (le), starts with (sw), or contains (cont). For example - "filter=IsDisplayed+eq+true"
	 * @param pageSize The number of results to display on each page when creating paged results from a query. The amount is divided and displayed on the `pageCount `amount of pages. The default is 20 and maximum value is 200 per page.
	 * @param responseFields Use this field to include those fields which are not included by default.
	 * @param sortBy The element to sort the results by and the channel in which the results appear. Either ascending (a-z) or descending (z-a) channel. Optional.
	 * @param startIndex When creating paged results from a query, this value indicates the zero-based offset in the complete result set where the returned entities begin. For example, with a `pageSize `of 25, to get the 51st through the 75th items, use `startIndex=3`.
	 * @param subscriptionId Unique identifier for a subscription, such as subscribing tenants for an event or to receive a notification.
	 * @return Mozu.Api.MozuClient <com.mozu.api.contracts.event.EventDeliverySummaryCollection>
	 * @see com.mozu.api.contracts.event.EventDeliverySummaryCollection
	 */
	public static MozuClient<com.mozu.api.contracts.event.EventDeliverySummaryCollection> getDeliveryAttemptSummariesClient(String subscriptionId, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields) throws Exception
	{
		MozuUrl url = com.mozu.api.urls.event.push.subscriptions.EventDeliverySummaryUrl.getDeliveryAttemptSummariesUrl(filter, pageSize, responseFields, sortBy, startIndex, subscriptionId);
		String verb = "GET";
		Class<?> clz = com.mozu.api.contracts.event.EventDeliverySummaryCollection.class;
		MozuClient<com.mozu.api.contracts.event.EventDeliverySummaryCollection> mozuClient = (MozuClient<com.mozu.api.contracts.event.EventDeliverySummaryCollection>) MozuClientFactory.getInstance(clz);
		mozuClient.setVerb(verb);
		mozuClient.setResourceUrl(url);
		return mozuClient;

	}

}


text:
// Copyright 2009-2012 Matvei Stefarov <me@matvei.org>
using System;
using System.ComponentModel;
using System.Linq;
using System.Xml.Linq;
using JetBrains.Annotations;

namespace fCraft
{

    /// <summary> Map generator themes. A theme defines what type of blocks are used to fill the map. </summary>
    public enum MapGenTheme
    {
        Arctic,
        Desert,
        Forest,
        Hell,
        Swamp
    }

    /// <summary> Map generator template. Templates define landscape shapes and features. </summary>
    public enum MapGenTemplate
    {
        Archipelago,
        Atoll,
        Bay,
        Dunes,
        Flat,
        Hills,
        Ice,
        Island,
        Lake,
        Mountains,
        Peninsula,
        Random,
        River,
        Streams
    }

    public sealed class MapGenerator
    {
        readonly MapGeneratorArgs args;
        readonly Random rand;
        readonly Noise noise;
        float[,] heightmap, blendmap, slopemap;

        const float CliffsideBlockThreshold = 0.01f;

        // theme-dependent vars
        Block bWaterSurface, bGroundSurface, bWater, bGround, bSeaFloor, bBedrock, bDeepWaterSurface, bCliff;

        int groundThickness = 5;
        const int SeaFloorThickness = 3;

        public MapGenerator([NotNull] MapGeneratorArgs generatorArgs)
        {
            if (generatorArgs == null) throw new ArgumentNullException("generatorArgs");
            args = generatorArgs;
            args.Validate();

            if (!args.CustomWaterLevel)
            {
                args.WaterLevel = (args.MapHeight - 1) / 2;
            }

            rand = new Random(args.Seed);
            noise = new Noise(args.Seed, NoiseInterpolationMode.Bicubic);
            ApplyTheme(args.Theme);
            EstimateComplexity();
        }

        public Map Generate()
        {
            GenerateHeightmap();
            return GenerateMap();
        }

        const int FlatgrassDirtLevel = 5;
        [NotNull]
        public static Map GenerateFlatgrass(int width, int length, int height)
        {
            Map map = new Map(null, width, length, height, true);
            map.Blocks.MemSet((byte)Block.Stone, 0, width * length * (height / 2 - FlatgrassDirtLevel));
            map.Blocks.MemSet((byte)Block.Dirt, width * length * (height / 2 - FlatgrassDirtLevel), width * length * (FlatgrassDirtLevel - 1));
            map.Blocks.MemSet((byte)Block.Grass, width * length * (height / 2 - 1), width * length);
            return map;
        }

        [NotNull]
        public static Map GenerateEmpty(int width, int length, int height)
        {
            return new Map(null, width, length, height, true);
        }

        [NotNull]
        public static Map GenerateOcean(int width, int length, int height)
        {
            Map map = new Map(null, width, length, height, true);
            map.Blocks.MemSet((byte)Block.Sand, 0, width * length);
            map.Blocks.MemSet((byte)Block.Water, width * length, width * length * (height / 2 - 1));
            return map;
        }

        #region Progress Reporting

        public event ProgressChangedEventHandler ProgressChanged;

        int progressTotalEstimate, progressRunningTotal;

        void EstimateComplexity()
        {
            // heightmap creation
            progressTotalEstimate = 10;
            if (args.UseBias) progressTotalEstimate += 2;
            if (args.LayeredHeightmap) progressTotalEstimate += 10;
            if (args.MarbledHeightmap) progressTotalEstimate++;
            if (args.InvertHeightmap) progressTotalEstimate++;

            // heightmap processing
            if (args.MatchWaterCoverage) progressTotalEstimate += 2;
            if (args.BelowFuncExponent != 1 || args.AboveFuncExponent != 1) progressTotalEstimate += 5;
            if (args.CliffSmoothing) progressTotalEstimate += 2;
            progressTotalEstimate += 2; // slope
            if (args.MaxHeightVariation > 0 || args.MaxDepthVariation > 0) progressTotalEstimate += 5;

            // filling
            progressTotalEstimate += 15;

            // post processing
            if (args.AddCaves) progressTotalEstimate += 5;
            if (args.AddOre) progressTotalEstimate += 3;
            if (args.AddBeaches) progressTotalEstimate += 5;
            if (args.AddTrees) progressTotalEstimate += 5;
        }

        void ReportProgress(int relativeIncrease, [NotNull] string message)
        {
            if (message == null) throw new ArgumentNullException("message");
            var h = ProgressChanged;
            if (h != null)
            {
                h(this, new ProgressChangedEventArgs((100 * progressRunningTotal / progressTotalEstimate), message));
            }
            progressRunningTotal += relativeIncrease;
        }

        #endregion

        #region Heightmap Processing

        void GenerateHeightmap()
        {
            ReportProgress(10, "Heightmap: Priming");
            heightmap = new float[args.MapWidth, args.MapLength];

            noise.PerlinNoise(heightmap, args.FeatureScale, args.DetailScale, args.Roughness, 0, 0);

            if (args.UseBias && !args.DelayBias)
            {
                ReportProgress(2, "Heightmap: Biasing");
                Noise.Normalize(heightmap);
                ApplyBias();
            }

            Noise.Normalize(heightmap);

            if (args.LayeredHeightmap)
            {
                ReportProgress(10, "Heightmap: Layering");

                // needs a new Noise object to randomize second map
                float[,] heightmap2 = new float[args.MapWidth, args.MapLength];
                new Noise(rand.Next(), NoiseInterpolationMode.Bicubic).PerlinNoise(heightmap2, 0, args.DetailScale, args.Roughness, 0, 0);
                Noise.Normalize(heightmap2);

                // make a blendmap
                blendmap = new float[args.MapWidth, args.MapLength];
                int blendmapDetailSize = (int)Math.Log(Math.Max(args.MapWidth, args.MapLength), 2) - 2;
                new Noise(rand.Next(), NoiseInterpolationMode.Cosine).PerlinNoise(blendmap, 3, blendmapDetailSize, 0.5f, 0, 0);
                Noise.Normalize(blendmap);
                float cliffSteepness = Math.Max(args.MapWidth, args.MapLength) / 6f;
                Noise.ScaleAndClip(blendmap, cliffSteepness);

                Noise.Blend(heightmap, heightmap2, blendmap);
            }

            if (args.MarbledHeightmap)
            {
                ReportProgress(1, "Heightmap: Marbling");
                Noise.Marble(heightmap);
            }

            if (args.InvertHeightmap)
            {
                ReportProgress(1, "Heightmap: Inverting");
                Noise.Invert(heightmap);
            }

            if (args.UseBias && args.DelayBias)
            {
                ReportProgress(2, "Heightmap: Biasing");
                Noise.Normalize(heightmap);
                ApplyBias();
            }
            Noise.Normalize(heightmap);
        }

        void ApplyBias()
        {
            // set corners and midpoint
            float[] corners = new float[4];
            int c = 0;
            for (int i = 0; i < args.RaisedCorners; i++)
            {
                corners[c++] = args.Bias;
            }
            for (int i = 0; i < args.LoweredCorners; i++)
            {
                corners[c++] = -args.Bias;
            }
            float midpoint = (args.MidPoint * args.Bias);

            // shuffle corners
            corners = corners.OrderBy(r => rand.Next()).ToArray();

            // overlay the bias
            Noise.ApplyBias(heightmap, corners[0], corners[1], corners[2], corners[3], midpoint);
        }

        #endregion

        #region Map Processing

        public Map GenerateMap()
        {
            Map map = new Map(null, args.MapWidth, args.MapLength, args.MapHeight, true);

            // Match water coverage
            float desiredWaterLevel = .5f;
            if (args.MatchWaterCoverage)
            {
                ReportProgress(2, "Heightmap Processing: Matching water coverage");
                desiredWaterLevel = Noise.FindThreshold(heightmap, args.WaterCoverage);
            }

            // Calculate above/below water multipliers
            float aboveWaterMultiplier = 0;
            if (desiredWaterLevel != 1)
            {
                aboveWaterMultiplier = (args.MaxHeight / (1 - desiredWaterLevel));
            }

            // Apply power functions to above/below water parts of the heightmap
            if (args.BelowFuncExponent != 1 || args.AboveFuncExponent != 1)
            {
                ReportProgress(5, "Heightmap Processing: Adjusting slope");
                for (int x = heightmap.GetLength(0) - 1; x >= 0; x--)
                {
                    for (int y = heightmap.GetLength(1) - 1; y >= 0; y--)
                    {
                        if (heightmap[x, y] < desiredWaterLevel)
                        {
                            float normalizedDepth = 1 - heightmap[x, y] / desiredWaterLevel;
                            heightmap[x, y] = desiredWaterLevel - (float)Math.Pow(normalizedDepth, args.BelowFuncExponent) * desiredWaterLevel;
                        }
                        else
                        {
                            float normalizedHeight = (heightmap[x, y] - desiredWaterLevel) / (1 - desiredWaterLevel);
                            heightmap[x, y] = desiredWaterLevel + (float)Math.Pow(normalizedHeight, args.AboveFuncExponent) * (1 - desiredWaterLevel);
                        }
                    }
                }
            }

            // Calculate the slope
            if (args.CliffSmoothing)
            {
                ReportProgress(2, "Heightmap Processing: Smoothing");
                slopemap = Noise.CalculateSlope(Noise.GaussianBlur5X5(heightmap));
            }
            else
            {
                slopemap = Noise.CalculateSlope(heightmap);
            }

            float[,] altmap = null;
            if (args.MaxHeightVariation != 0 || args.MaxDepthVariation != 0)
            {
                ReportProgress(5, "Heightmap Processing: Randomizing");
                altmap = new float[map.Width, map.Length];
                int blendmapDetailSize = (int)Math.Log(Math.Max(args.MapWidth, args.MapLength), 2) - 2;
                new Noise(rand.Next(), NoiseInterpolationMode.Cosine).PerlinNoise(altmap, 3, blendmapDetailSize, 0.5f, 0, 0);
                Noise.Normalize(altmap, -1, 1);
            }

            int snowStartThreshold = args.SnowAltitude - args.SnowTransition;
            int snowThreshold = args.SnowAltitude;

            ReportProgress(10, "Filling");
            for (int x = heightmap.GetLength(0) - 1; x >= 0; x--)
            {
                for (int y = heightmap.GetLength(1) - 1; y >= 0; y--)
                {
                    int level;
                    float slope;
                    if (heightmap[x, y] < desiredWaterLevel)
                    {
                        float depth = args.MaxDepth;
                        if (altmap != null)
                        {
                            depth += altmap[x, y] * args.MaxDepthVariation;
                        }
                        slope = slopemap[x, y] * depth;
                        level = args.WaterLevel - (int)Math.Round(Math.Pow(1 - heightmap[x, y] / desiredWaterLevel, args.BelowFuncExponent) * depth);

                        if (args.AddWater)
                        {
                            if (args.WaterLevel - level > 3)
                            {
                                map.SetBlock(x, y, args.WaterLevel, bDeepWaterSurface);
                            }
                            else
                            {
                                map.SetBlock(x, y, args.WaterLevel, bWaterSurface);
                            }
                            for (int i = args.WaterLevel; i > level; i--)
                            {
                                map.SetBlock(x, y, i, bWater);
                            }
                            for (int i = level; i >= 0; i--)
                            {
                                if (level - i < SeaFloorThickness)
                                {
                                    map.SetBlock(x, y, i, bSeaFloor);
                                }
                                else
                                {
                                    map.SetBlock(x, y, i, bBedrock);
                                }
                            }
                        }
                        else
                        {
                            if (blendmap != null && blendmap[x, y] > .25 && blendmap[x, y] < .75)
                            {
                                map.SetBlock(x, y, level, bCliff);
                            }
                            else
                            {
                                if (slope < args.CliffThreshold)
                                {
                                    map.SetBlock(x, y, level, bGroundSurface);
                                }
                                else
                                {
                                    map.SetBlock(x, y, level, bCliff);
                                }
                            }

                            for (int i = level - 1; i >= 0; i--)
                            {
                                if (level - i < groundThickness)
                                {
                                    if (blendmap != null && blendmap[x, y] > CliffsideBlockThreshold && blendmap[x, y] < (1 - CliffsideBlockThreshold))
                                    {
                                        map.SetBlock(x, y, i, bCliff);
                                    }
                                    else
                                    {
                                        if (slope < args.CliffThreshold)
                                        {
                                            map.SetBlock(x, y, i, bGround);
                                        }
                                        else
                                        {
                                            map.SetBlock(x, y, i, bCliff);
                                        }
                                    }
                                }
                                else
                                {
                                    map.SetBlock(x, y, i, bBedrock);
                                }
                            }
                        }

                    }
                    else
                    {
                        float height;
                        if (altmap != null)
                        {
                            height = args.MaxHeight + altmap[x, y] * args.MaxHeightVariation;
                        }
                        else
                        {
                            height = args.MaxHeight;
                        }
                        slope = slopemap[x, y] * height;
                        if (height != 0)
                        {
                            level = args.WaterLevel + (int)Math.Round(Math.Pow(heightmap[x, y] - desiredWaterLevel, args.AboveFuncExponent) * aboveWaterMultiplier / args.MaxHeight * height);
                        }
                        else
                        {
                            level = args.WaterLevel;
                        }

                        bool snow = args.AddSnow &&
                                    (level > snowThreshold ||
                                    (level > snowStartThreshold && rand.NextDouble() < (level - snowStartThreshold) / (double)(snowThreshold - snowStartThreshold)));

                        if (blendmap != null && blendmap[x, y] > .25 && blendmap[x, y] < .75)
                        {
                            map.SetBlock(x, y, level, bCliff);
                        }
                        else
                        {
                            if (slope < args.CliffThreshold)
                            {
                                map.SetBlock(x, y, level, (snow ? Block.White : bGroundSurface));
                            }
                            else
                            {
                                map.SetBlock(x, y, level, bCliff);
                            }
                        }

                        for (int i = level - 1; i >= 0; i--)
                        {
                            if (level - i < groundThickness)
                            {
                                if (blendmap != null && blendmap[x, y] > CliffsideBlockThreshold && blendmap[x, y] < (1 - CliffsideBlockThreshold))
                                {
                                    map.SetBlock(x, y, i, bCliff);
                                }
                                else
                                {
                                    if (slope < args.CliffThreshold)
                                    {
                                        if (snow)
                                        {
                                            map.SetBlock(x, y, i, Block.White);
                                        }
                                        else
                                        {
                                            map.SetBlock(x, y, i, bGround);
                                        }
                                    }
                                    else
                                    {
                                        map.SetBlock(x, y, i, bCliff);
                                    }
                                }
                            }
                            else
                            {
                                map.SetBlock(x, y, i, bBedrock);
                            }
                        }
                    }
                }
            }

            if (args.AddCaves || args.AddOre)
            {
                AddCaves(map);
            }

            if (args.AddBeaches)
            {
                ReportProgress(5, "Processing: Adding beaches");
                AddBeaches(map);
            }

            if (args.AddTrees)
            {
                ReportProgress(5, "Processing: Planting trees");
                if (args.AddGiantTrees)
                {
                    Map outMap = new Map(null, map.Width, map.Length, map.Height, false) { Blocks = (byte[])map.Blocks.Clone() };
                    var foresterArgs = new ForesterArgs
                    {
                        Map = map,
                        Rand = rand,
                        TreeCount = (int)(map.Width * map.Length * 4 / (1024f * (args.TreeSpacingMax + args.TreeSpacingMin) / 2)),
                        Operation = Forester.ForesterOperation.Add,
                        PlantOn = bGroundSurface
                    };
                    foresterArgs.BlockPlacing += (sender, e) => outMap.SetBlock(e.Coordinate, e.Block);
                    Forester.Generate(foresterArgs);
                    map = outMap;
                }
                GenerateTrees(map);
            }

            ReportProgress(0, "Generation complete");

            map.Metadata["_Origin", "GeneratorName"] = "fCraft";
            map.Metadata["_Origin", "GeneratorVersion"] = Updater.LatestStable;
            map.Metadata["_Origin", "GeneratorParams"] = args.Serialize().ToString(SaveOptions.DisableFormatting);
            return map;
        }

        #region Caves

        // Cave generation method from Omen 0.70, used with osici's permission
        static void AddSingleCave(Random rand, Map map, byte bedrockType, byte fillingType, int length, double maxDiameter)
        {

            int startX = rand.Next(0, map.Width);
            int startY = rand.Next(0, map.Length);
            int startZ = rand.Next(0, map.Height);

            int k1;
            for (k1 = 0; map.Blocks[startX + map.Width * map.Length * (map.Height - 1 - startZ) + map.Width * startY] != bedrockType && k1 < 10000; k1++)
            {
                startX = rand.Next(0, map.Width);
                startY = rand.Next(0, map.Length);
                startZ = rand.Next(0, map.Height);
            }

            if (k1 >= 10000)
                return;

            int x = startX;
            int y = startY;
            int z = startZ;

            for (int k2 = 0; k2 < length; k2++)
            {
                int diameter = (int)(maxDiameter * rand.NextDouble() * map.Width);
                if (diameter < 1) diameter = 2;
                int radius = diameter / 2;
                if (radius == 0) radius = 1;
                x += (int)(0.7 * (rand.NextDouble() - 0.5D) * diameter);
                y += (int)(0.7 * (rand.NextDouble() - 0.5D) * diameter);
                z += (int)(0.7 * (rand.NextDouble() - 0.5D) * diameter);

                for (int j3 = 0; j3 < diameter; j3++)
                {
                    for (int k3 = 0; k3 < diameter; k3++)
                    {
                        for (int l3 = 0; l3 < diameter; l3++)
                        {
                            if ((j3 - radius) * (j3 - radius) + (k3 - radius) * (k3 - radius) + (l3 - radius) * (l3 - radius) >= radius * radius ||
                                x + j3 >= map.Width || z + k3 >= map.Height || y + l3 >= map.Length ||
                                x + j3 < 0 || z + k3 < 0 || y + l3 < 0)
                            {
                                continue;
                            }

                            int index = x + j3 + map.Width * map.Length * (map.Height - 1 - (z + k3)) + map.Width * (y + l3);

                            if (map.Blocks[index] == bedrockType)
                            {
                                map.Blocks[index] = fillingType;
                            }
                            if ((fillingType == 10 || fillingType == 11 || fillingType == 8 || fillingType == 9) &&
                                z + k3 < startZ)
                            {
                                map.Blocks[index] = 0;
                            }
                        }
                    }
                }
            }
        }

        static void AddSingleVein(Random rand, Map map, byte bedrockType, byte fillingType, int k, double maxDiameter, int l)
        {
            AddSingleVein(rand, map, bedrockType, fillingType, k, maxDiameter, l, 10);
        }

        static void AddSingleVein(Random rand, Map map, byte bedrockType, byte fillingType, int k, double maxDiameter, int l, int i1)
        {

            int j1 = rand.Next(0, map.Width);
            int k1 = rand.Next(0, map.Height);
            int l1 = rand.Next(0, map.Length);

            double thirteenOverK = 1 / (double)k;

            for (int i2 = 0; i2 < i1; i2++)
            {
                int j2 = j1 + (int)(.5 * (rand.NextDouble() - .5) * map.Width);
                int k2 = k1 + (int)(.5 * (rand.NextDouble() - .5) * map.Height);
                int l2 = l1 + (int)(.5 * (rand.NextDouble() - .5) * map.Length);
                for (int l3 = 0; l3 < k; l3++)
                {
                    int diameter = (int)(maxDiameter * rand.NextDouble() * map.Width);
                    if (diameter < 1) diameter = 2;
                    int radius = diameter / 2;
                    if (radius == 0) radius = 1;
                    int i3 = (int)((1 - thirteenOverK) * j1 + thirteenOverK * j2 + (l * radius) * (rand.NextDouble() - .5));
                    int j3 = (int)((1 - thirteenOverK) * k1 + thirteenOverK * k2 + (l * radius) * (rand.NextDouble() - .5));
                    int k3 = (int)((1 - thirteenOverK) * l1 + thirteenOverK * l2 + (l * radius) * (rand.NextDouble() - .5));
                    for (int k4 = 0; k4 < diameter; k4++)
                    {
                        for (int l4 = 0; l4 < diameter; l4++)
                        {
                            for (int i5 = 0; i5 < diameter; i5++)
                            {
                                if ((k4 - radius) * (k4 - radius) + (l4 - radius) * (l4 - radius) + (i5 - radius) * (i5 - radius) < radius * radius &&
                                    i3 + k4 < map.Width && j3 + l4 < map.Height && k3 + i5 < map.Length &&
                                    i3 + k4 >= 0 && j3 + l4 >= 0 && k3 + i5 >= 0)
                                {

                                    int index = i3 + k4 + map.Width * map.Length * (map.Height - 1 - (j3 + l4)) + map.Width * (k3 + i5);

                                    if (map.Blocks[index] == bedrockType)
                                    {
                                        map.Blocks[index] = fillingType;
                                    }
                                }
                            }
                        }
                    }
                }
                j1 = j2;
                k1 = k2;
                l1 = l2;
            }
        }

        static void SealLiquids(Map map, byte sealantType)
        {
            for (int x = 1; x < map.Width - 1; x++)
            {
                for (int z = 1; z < map.Height; z++)
                {
                    for (int y = 1; y < map.Length - 1; y++)
                    {
                        int index = map.Index(x, y, z);
                        if ((map.Blocks[index] == 10 || map.Blocks[index] == 11 || map.Blocks[index] == 8 || map.Blocks[index] == 9) &&
                            (map.GetBlock(x - 1, y, z) == Block.Air || map.GetBlock(x + 1, y, z) == Block.Air ||
                            map.GetBlock(x, y - 1, z) == Block.Air || map.GetBlock(x, y + 1, z) == Block.Air ||
                            map.GetBlock(x, y, z - 1) == Block.Air))
                        {
                            map.Blocks[index] = sealantType;
                        }
                    }
                }
            }
        }

        public void AddCaves(Map map)
        {
            if (args.AddCaves)
            {
                ReportProgress(5, "Processing: Adding caves");
                for (int i1 = 0; i1 < 36 * args.CaveDensity; i1++)
                    AddSingleCave(rand, map, (byte)bBedrock, (byte)Block.Air, 30, 0.05 * args.CaveSize);

                for (int j1 = 0; j1 < 9 * args.CaveDensity; j1++)
                    AddSingleVein(rand, map, (byte)bBedrock, (byte)Block.Air, 500, 0.015 * args.CaveSize, 1);

                for (int k1 = 0; k1 < 30 * args.CaveDensity; k1++)
                    AddSingleVein(rand, map, (byte)bBedrock, (byte)Block.Air, 300, 0.03 * args.CaveSize, 1, 20);

                if (args.AddCaveLava)
                {
                    for (int i = 0; i < 8 * args.CaveDensity; i++)
                    {
                        AddSingleCave(rand, map, (byte)bBedrock, (byte)Block.Lava, 30, 0.05 * args.CaveSize);
                    }
                    for (int j = 0; j < 3 * args.CaveDensity; j++)
                    {
                        AddSingleVein(rand, map, (byte)bBedrock, (byte)Block.Lava, 1000, 0.015 * args.CaveSize, 1);
                    }
                }

                if (args.AddCaveWater)
                {
                    for (int k = 0; k < 8 * args.CaveDensity; k++)
                    {
                        AddSingleCave(rand, map, (byte)bBedrock, (byte)Block.Water, 30, 0.05 * args.CaveSize);
                    }
                    for (int l = 0; l < 3 * args.CaveDensity; l++)
                    {
                        AddSingleVein(rand, map, (byte)bBedrock, (byte)Block.Water, 1000, 0.015 * args.CaveSize, 1);
                    }
                }

                SealLiquids(map, (byte)bBedrock);
            }

            if (args.AddOre)
            {
                ReportProgress(3, "Processing: Adding ore");
                for (int l1 = 0; l1 < 12 * args.CaveDensity; l1++)
                {
                    AddSingleCave(rand, map, (byte)bBedrock, (byte)Block.Coal, 500, 0.03);
                }

                for (int i2 = 0; i2 < 32 * args.CaveDensity; i2++)
                {
                    AddSingleVein(rand, map, (byte)bBedrock, (byte)Block.Coal, 200, 0.015, 1);
                    AddSingleCave(rand, map, (byte)bBedrock, (byte)Block.IronOre, 500, 0.02);
                }

                for (int k2 = 0; k2 < 8 * args.CaveDensity; k2++)
                {
                    AddSingleVein(rand, map, (byte)bBedrock, (byte)Block.IronOre, 200, 0.015, 1);
                    AddSingleVein(rand, map, (byte)bBedrock, (byte)Block.GoldOre, 200, 0.0145, 1);
                }

                for (int l2 = 0; l2 < 20 * args.CaveDensity; l2++)
                {
                    AddSingleCave(rand, map, (byte)bBedrock, (byte)Block.GoldOre, 400, 0.0175);
                }
            }
        }

        #endregion

        void AddBeaches([NotNull] Map map)
        {
            if (map == null) throw new ArgumentNullException("map");
            int beachExtentSqr = (args.BeachExtent + 1) * (args.BeachExtent + 1);
            for (int x = 0; x < map.Width; x++)
            {
                for (int y = 0; y < map.Length; y++)
                {
                    for (int z = args.WaterLevel; z <= args.WaterLevel + args.BeachHeight; z++)
                    {
                        if (map.GetBlock(x, y, z) != bGroundSurface) continue;
                        bool found = false;
                        for (int dx = -args.BeachExtent; !found && dx <= args.BeachExtent; dx++)
                        {
                            for (int dy = -args.BeachExtent; !found && dy <= args.BeachExtent; dy++)
                            {
                                for (int dz = -args.BeachHeight; dz <= 0; dz++)
                                {
                                    if (dx * dx + dy * dy + dz * dz > beachExtentSqr) continue;
                                    int xx = x + dx;
                                    int yy = y + dy;
                                    int zz = z + dz;
                                    if (xx < 0 || xx >= map.Width || yy < 0 || yy >= map.Length || zz < 0 ||
                                        zz >= map.Height) continue;
                                    Block block = map.GetBlock(xx, yy, zz);
                                    if (block == bWater || block == bWaterSurface)
                                    {
                                        found = true;
                                        break;
                                    }
                                }
                            }
                        }
                        if (found)
                        {
                            map.SetBlock(x, y, z, bSeaFloor);
                            if (z > 0 && map.GetBlock(x, y, z - 1) == bGround)
                            {
                                map.SetBlock(x, y, z - 1, bSeaFloor);
                            }
                        }
                    }
                }
            }
        }

        void GenerateTrees([NotNull] Map map)
        {
            if (map == null) throw new ArgumentNullException("map");
            int minHeight = args.TreeHeightMin;
            int maxHeight = args.TreeHeightMax;
            int minTrunkPadding = args.TreeSpacingMin;
            int maxTrunkPadding = args.TreeSpacingMax;
            const int topLayers = 2;
            const double odds = 0.618;

            Random rn = new Random();

            map.CalculateShadows();

            for (int x = 0; x < map.Width; x += rn.Next(minTrunkPadding, maxTrunkPadding + 1))
            {
                for (int y = 0; y < map.Length; y += rn.Next(minTrunkPadding, maxTrunkPadding + 1))
                {
                    int nx = x + rn.Next(-(minTrunkPadding / 2), (maxTrunkPadding / 2) + 1);
                    int ny = y + rn.Next(-(minTrunkPadding / 2), (maxTrunkPadding / 2) + 1);
                    if (nx < 0 || nx >= map.Width || ny < 0 || ny >= map.Length) continue;
                    int nz = map.Shadows[nx, ny];

                    if ((map.GetBlock(nx, ny, nz) == bGroundSurface) && slopemap[nx, ny] < .5)
                    {
                        // Pick a random height for the tree between Min and Max,
                        // discarding this tree if it would breach the top of the map
                        int nh;
                        if ((nh = rn.Next(minHeight, maxHeight + 1)) + nz + nh / 2 > map.Height)
                            continue;

                        // Generate the trunk of the tree
                        for (int z = 1; z <= nh; z++)
                            map.SetBlock(nx, ny, nz + z, Block.Log);

                        for (int i = -1; i < nh / 2; i++)
                        {
                            // Should we draw thin (2x2) or thicker (4x4) foliage
                            int radius = (i >= (nh / 2) - topLayers) ? 1 : 2;
                            // Draw the foliage
                            for (int xoff = -radius; xoff < radius + 1; xoff++)
                            {
                                for (int yoff = -radius; yoff < radius + 1; yoff++)
                                {
                                    // Drop random leaves from the edges
                                    if (rn.NextDouble() > odds && Math.Abs(xoff) == Math.Abs(yoff) && Math.Abs(xoff) == radius)
                                        continue;
                                    // By default only replace an existing block if its air
                                    if (map.GetBlock(nx + xoff, ny + yoff, nz + nh + i) == Block.Air)
                                        map.SetBlock(nx + xoff, ny + yoff, nz + nh + i, Block.Leaves);
                                }
                            }
                        }
                    }
                }
            }
        }

        #endregion

        #region Themes / Templates

        void ApplyTheme(MapGenTheme theme)
        {
            args.Theme = theme;
            switch (theme)
            {
                case MapGenTheme.Arctic:
                    bWaterSurface = Block.Glass;
                    bDeepWaterSurface = Block.Water;
                    bGroundSurface = Block.White;
                    bWater = Block.Water;
                    bGround = Block.White;
                    bSeaFloor = Block.White;
                    bBedrock = Block.Stone;
                    bCliff = Block.Stone;
                    groundThickness = 1;
                    break;
                case MapGenTheme.Desert:
                    bWaterSurface = Block.Water;
                    bDeepWaterSurface = Block.Water;
                    bGroundSurface = Block.Sand;
                    bWater = Block.Water;
                    bGround = Block.Sand;
                    bSeaFloor = Block.Sand;
                    bBedrock = Block.Stone;
                    bCliff = Block.Gravel;
                    break;
                case MapGenTheme.Hell:
                    bWaterSurface = Block.Lava;
                    bDeepWaterSurface = Block.Lava;
                    bGroundSurface = Block.Obsidian;
                    bWater = Block.Lava;
                    bGround = Block.Stone;
                    bSeaFloor = Block.Obsidian;
                    bBedrock = Block.Stone;
                    bCliff = Block.Stone;
                    break;
                case MapGenTheme.Forest:
                    bWaterSurface = Block.Water;
                    bDeepWaterSurface = Block.Water;
                    bGroundSurface = Block.Grass;
                    bWater = Block.Water;
                    bGround = Block.Dirt;
                    bSeaFloor = Block.Sand;
                    bBedrock = Block.Stone;
                    bCliff = Block.Stone;
                    break;
                case MapGenTheme.Swamp:
                    bWaterSurface = Block.Water;
                    bDeepWaterSurface = Block.Water;
                    bGroundSurface = Block.Dirt;
                    bWater = Block.Water;
                    bGround = Block.Dirt;
                    bSeaFloor = Block.Leaves;
                    bBedrock = Block.Stone;
                    bCliff = Block.Stone;
                    break;
            }
        }

        public static MapGeneratorArgs MakeTemplate(MapGenTemplate template)
        {
            switch (template)
            {
                case MapGenTemplate.Archipelago:
                    return new MapGeneratorArgs
                    {
                        MaxHeight = 8,
                        MaxDepth = 20,
                        FeatureScale = 3,
                        Roughness = .46f,
                        MatchWaterCoverage = true,
                        WaterCoverage = .85f
                    };

                case MapGenTemplate.Atoll:
                    return new MapGeneratorArgs
                    {
                        Theme = MapGenTheme.Desert,
                        MaxHeight = 2,
                        MaxDepth = 39,
                        UseBias = true,
                        Bias = .9f,
                        MidPoint = 1,
                        LoweredCorners = 4,
                        FeatureScale = 2,
                        DetailScale = 5,
                        MarbledHeightmap = true,
                        InvertHeightmap = true,
                        MatchWaterCoverage = true,
                        WaterCoverage = .95f
                    };

                case MapGenTemplate.Bay:
                    return new MapGeneratorArgs
                    {
                        MaxHeight = 22,
                        MaxDepth = 12,
                        UseBias = true,
                        Bias = 1,
                        MidPoint = -1,
                        RaisedCorners = 3,
                        LoweredCorners = 1,
                        TreeSpacingMax = 12,
                        TreeSpacingMin = 6,
                        MarbledHeightmap = true,
                        DelayBias = true
                    };

                case MapGenTemplate.Dunes:
                    return new MapGeneratorArgs
                    {
                        AddTrees = false,
                        AddWater = false,
                        Theme = MapGenTheme.Desert,
                        MaxHeight = 12,
                        MaxDepth = 7,
                        FeatureScale = 2,
                        DetailScale = 3,
                        Roughness = .44f,
                        MarbledHeightmap = true,
                        InvertHeightmap = true
                    };

                case MapGenTemplate.Hills:
                    return new MapGeneratorArgs
                    {
                        AddWater = false,
                        MaxHeight = 8,
                        MaxDepth = 8,
                        FeatureScale = 2,
                        TreeSpacingMin = 7,
                        TreeSpacingMax = 13
                    };

                case MapGenTemplate.Ice:
                    return new MapGeneratorArgs
                    {
                        AddTrees = false,
                        Theme = MapGenTheme.Arctic,
                        MaxHeight = 2,
                        MaxDepth = 2032,
                        FeatureScale = 2,
                        DetailScale = 7,
                        Roughness = .64f,
                        MarbledHeightmap = true,
                        MatchWaterCoverage = true,
                        WaterCoverage = .3f,
                        MaxHeightVariation = 0
                    };

                case MapGenTemplate.Island:
                    return new MapGeneratorArgs
                    {
                        MaxHeight = 16,
                        MaxDepth = 39,
                        UseBias = true,
                        Bias = .7f,
                        MidPoint = 1,
                        LoweredCorners = 4,
                        FeatureScale = 3,
                        DetailScale = 7,
                        MarbledHeightmap = true,
                        DelayBias = true,
                        AddBeaches = true,
                        Roughness = 0.45f
                    };

                case MapGenTemplate.Lake:
                    return new MapGeneratorArgs
                    {
                        MaxHeight = 14,
                        MaxDepth = 20,
                        UseBias = true,
                        Bias = .65f,
                        MidPoint = -1,
                        RaisedCorners = 4,
                        FeatureScale = 2,
                        Roughness = .56f,
                        MatchWaterCoverage = true,
                        WaterCoverage = .3f
                    };

                case MapGenTemplate.Mountains:
                    return new MapGeneratorArgs
                    {
                        AddWater = false,
                        MaxHeight = 40,
                        MaxDepth = 10,
                        FeatureScale = 1,
                        DetailScale = 7,
                        MarbledHeightmap = true,
                        AddSnow = true,
                        MatchWaterCoverage = true,
                        WaterCoverage = .5f,
                        Roughness = .55f,
                        CliffThreshold = .9f
                    };

                case MapGenTemplate.Random:
                    return new MapGeneratorArgs();

                case MapGenTemplate.River:
                    return new MapGeneratorArgs
                    {
                        MaxHeight = 22,
                        MaxDepth = 8,
                        FeatureScale = 0,
                        DetailScale = 6,
                        MarbledHeightmap = true,
                        MatchWaterCoverage = true,
                        WaterCoverage = .31f
                    };

                case MapGenTemplate.Streams:
                    return new MapGeneratorArgs
                    {
                        MaxHeight = 5,
                        MaxDepth = 4,
                        FeatureScale = 2,
                        DetailScale = 7,
                        Roughness = .55f,
                        MarbledHeightmap = true,
                        MatchWaterCoverage = true,
                        WaterCoverage = .25f,
                        TreeSpacingMin = 8,
                        TreeSpacingMax = 14
                    };

                case MapGenTemplate.Peninsula:
                    return new MapGeneratorArgs
                    {
                        MaxHeight = 22,
                        MaxDepth = 12,
                        UseBias = true,
                        Bias = .5f,
                        MidPoint = -1,
                        RaisedCorners = 3,
                        LoweredCorners = 1,
                        TreeSpacingMax = 12,
                        TreeSpacingMin = 6,
                        InvertHeightmap = true,
                        WaterCoverage = .5f
                    };

                case MapGenTemplate.Flat:
                    return new MapGeneratorArgs
                    {
                        MaxHeight = 0,
                        MaxDepth = 0,
                        MaxHeightVariation = 0,
                        AddWater = false,
                        DetailScale = 0,
                        FeatureScale = 0,
                        AddCliffs = false
                    };

                default:
                    throw new ArgumentOutOfRangeException("template");
            }
        }

        #endregion
    }
}


text:
package com.github.dtkavin.learn.spring.beans;

/**
 * Created by john on 11/13/16.
 */
public class PoliceMan implements Person {
    public void drive() {
        System.out.println("a police man is driving now");
    }
}


text:
struct poi::poifs::storage::HeaderBlockConstants
    : public virtual ::java::lang::Object
{
    static constexpr int64_t _signature { int64_t(-2226271756974174256LL) };
    static constexpr int32_t _bat_array_offset { int32_t(76) };
    static constexpr int32_t _max_bats_in_header { int32_t(109) };
    static constexpr int32_t _signature_offset { int32_t(0) };
    static constexpr int32_t _bat_count_offset { int32_t(44) };
    static constexpr int32_t _property_start_offset { int32_t(48) };
    static constexpr int32_t _sbat_start_offset { int32_t(60) };
    static constexpr int32_t _sbat_block_count_offset { int32_t(64) };
    static constexpr int32_t _xbat_start_offset { int32_t(68) };
    static constexpr int32_t _xbat_count_offset { int32_t(72) };

    // Generated
    static ::java::lang::Class *class_();
};