text:
import {
  Component,
  OnInit,
  ViewEncapsulation
} from '@angular/core';

import { Action } from '../../action/action';
import { ActionConfig } from '../../action/action-config';
import { Filter } from '../../filter/filter';
import { FilterConfig } from '../../filter/filter-config';
import { FilterField } from '../../filter/filter-field';
import { FilterEvent } from '../../filter/filter-event';
import { SortConfig } from '../../sort/sort-config';
import { SortField } from '../../sort/sort-field';
import { SortEvent } from '../../sort/sort-event';
import { ToolbarConfig } from '../toolbar-config';
import { ToolbarView } from '../toolbar-view';

@Component({
  encapsulation: ViewEncapsulation.None,
  selector: 'toolbar-example',
  templateUrl: './toolbar-example.component.html'
})
export class ToolbarExampleComponent implements OnInit {
  actionConfig: ActionConfig;
  actionsText: string = '';
  allItems: any[];
  filterConfig: FilterConfig;
  filtersText: string = '';
  items: any[];
  isAscendingSort: boolean = true;
  separator: Object;
  sortConfig: SortConfig;
  currentSortField: SortField;
  toolbarConfig: ToolbarConfig;
  weekDayQueries: any[];

  monthVals: any = {
    'January': 1,
    'February': 2,
    'March': 3,
    'April': 4,
    'May': 5,
    'June': 6,
    'July': 7,
    'August': 8,
    'September': 9,
    'October': 10,
    'November': 11,
    'December': 12
  };

  weekDayVals: any = {
    'Sunday': 1,
    'Monday': 2,
    'Tuesday': 3,
    'Wednesday': 4,
    'Thursday': 5,
    'Friday': 6,
    'Saturday': 7
  };

  constructor() {
  }

  ngOnInit(): void {
    this.allItems = [{
      name: 'Fred Flintstone',
      address: '20 Dinosaur Way, Bedrock, Washingstone',
      birthMonth: 'February',
      birthMonthId: 'month2',
      weekDay: 'Sunday',
      weekdayId: 'day1'
    }, {
      name: 'John Smith', address: '415 East Main Street, Norfolk, Virginia',
      birthMonth: 'October',
      birthMonthId: '10',
      weekDay: 'Monday',
      weekdayId: 'day2'
    }, {
      name: 'Frank Livingston',
      address: '234 Elm Street, Pittsburgh, Pennsylvania',
      birthMonth: 'March',
      birthMonthId: 'month3',
      weekDay: 'Tuesday',
      weekdayId: 'day3'
    }, {
      name: 'Judy Green',
      address: '2 Apple Boulevard, Cincinatti, Ohio',
      birthMonth: 'December',
      birthMonthId: 'month12',
      weekDay: 'Wednesday',
      weekdayId: 'day4'
    }, {
      name: 'Pat Thomas',
      address: '50 Second Street, New York, New York',
      birthMonth: 'February',
      birthMonthId: 'month2',
      weekDay: 'Thursday',
      weekdayId: 'day5'
    }];
    this.items = this.allItems;

    this.weekDayQueries = [{
      id: 'day1',
      value: 'Sunday'
    }, {
      id: 'day2',
      value: 'Monday'
    }, {
      id: 'day3',
      value: 'Tuesday'
    }, {
      id: 'day4',
      value: 'Wednesday'
    }, {
      id: 'day5',
      value: 'Thursday'
    }, {
      id: 'day6',
      value: 'Friday'
    }, {
      id: 'day7',
      value: 'Saturday'
    }];

    this.filterConfig = {
      fields: [{
        id: 'name',
        title:  'Name',
        placeholder: 'Filter by Name...',
        type: 'text'
      }, {
        id: 'address',
        title:  'Address',
        placeholder: 'Filter by Address...',
        type: 'text'
      }, {
        id: 'birthMonth',
        title:  'Birth Month',
        placeholder: 'Filter by Birth Month...',
        type: 'select',
        queries: [{
          id: 'month1',
          value: 'January'
        }, {
          id: 'month2',
          value: 'February'
        }, {
          id: 'month3',
          value: 'March'
        }, {
          id: 'month4',
          value: 'April'
        }, {
          id: 'month5',
          value: 'May'
        }, {
          id: 'month6',
          value: 'June'
        }, {
          id: 'month7',
          value: 'July'
        }, {
          id: 'month8',
          value: 'August'
        }, {
          id: 'month9',
          value: 'September'
        }, {
          id: 'month10',
          value: 'October'
        }, {
          id: 'month11',
          value: 'November'
        }, {
          id: 'month12',
          value: 'December'
        }]
      }, {
        id: 'weekDay',
        title: 'Week Day',
        placeholder: 'Filter by Week Day...',
        type: 'typeahead',
        queries: [
          ...this.weekDayQueries
        ]
      }] as FilterField[],
      resultsCount: this.items.length,
      appliedFilters: []
    } as FilterConfig;

    this.sortConfig = {
      fields: [{
        id: 'name',
        title:  'Name',
        sortType: 'alpha'
      }, {
        id: 'address',
        title:  'Address',
        sortType: 'alpha'
      }, {
        id: 'birthMonth',
        title:  'Birth Month',
        sortType: 'alpha'
      }, {
        id: 'weekDay',
        title:  'Week Day',
        sortType: 'alpha'
      }],
      isAscending: this.isAscendingSort
    } as SortConfig;

    this.actionConfig = {
      primaryActions: [{
        id: 'action1',
        title: 'Action 1',
        tooltip: 'Do the first thing'
      }, {
        id: 'action2',
        title: 'Action 2',
        tooltip: 'Do something else'
      }],
      moreActions: [{
        id: 'moreActions1',
        title: 'Action',
        tooltip: 'Perform an action'
      }, {
        id: 'moreActions2',
        title: 'Another Action',
        tooltip: 'Do something else'
      }, {
        disabled: true,
        id: 'moreActions3',
        title: 'Disabled Action',
        tooltip: 'Unavailable action',
      }, {
        id: 'moreActions4',
        title: 'Something Else',
        tooltip: 'Do something special'
      }, {
        id: 'moreActions5',
        title: '',
        separator: true
      }, {
        id: 'moreActions6',
        title: 'Grouped Action 1',
        tooltip: 'Do something'
      }, {
        id: 'moreActions7',
        title: 'Grouped Action 2',
        tooltip: 'Do something similar'
      }]
    } as ActionConfig;

    this.toolbarConfig = {
      actionConfig: this.actionConfig,
      filterConfig: this.filterConfig,
      sortConfig: this.sortConfig,
      views: [{
        id: 'listView',
        iconStyleClass: 'fa fa-th-list',
        tooltip: 'List View'
      }, {
        id: 'tableView',
        iconStyleClass: 'fa fa-table',
        tooltip: 'Table View'
      }]
    } as ToolbarConfig;
  }

  // Actions

  doAdd(): void {
    this.actionsText = 'Add Action\n' + this.actionsText;
  }

  handleAction(action: Action): void {
    this.actionsText = action.title + '\n' + this.actionsText;
    let test = '';
  }

  optionSelected(option: number): void {
    this.actionsText = 'Option ' + option + ' selected\n' + this.actionsText;
  }

  // Filter

  applyFilters(filters: Filter[]): void {
    this.items = [];
    if (filters && filters.length > 0) {
      this.allItems.forEach((item) => {
        if (this.matchesFilters(item, filters)) {
          this.items.push(item);
        }
      });
    } else {
      this.items = this.allItems;
    }
    this.toolbarConfig.filterConfig.resultsCount = this.items.length;
  }

  // Handle filter changes
  filterChanged($event: FilterEvent): void {
    this.filtersText = '';
    $event.appliedFilters.forEach((filter) => {
      this.filtersText += filter.field.title + ' : ' + filter.value + '\n';
    });
    this.applyFilters($event.appliedFilters);
    this.filterFieldSelected($event);
  }

  // Reset filtered queries
  filterFieldSelected($event: FilterEvent): void {
    this.filterConfig.fields.forEach((field) => {
      if (field.id === 'weekDay') {
        field.queries = [
          ...this.weekDayQueries
        ];
      }
    });
  }

  matchesFilter(item: any, filter: Filter): boolean {
    let match = true;
    if (filter.field.id === 'name') {
      match = item.name.match(filter.value) !== null;
    } else if (filter.field.id === 'address') {
      match = item.address.match(filter.value) !== null;
    } else if (filter.field.id === 'birthMonth') {
      match = item.birthMonth === filter.value;
    } else if (filter.field.id === 'weekDay') {
      match = item.weekDay === filter.value;
    }
    return match;
  }

  matchesFilters(item: any, filters: Filter[]): boolean {
    let matches = true;
    filters.forEach((filter) => {
      if (!this.matchesFilter(item, filter)) {
        matches = false;
        return matches;
      }
    });
    return matches;
  }

  // Filter queries for type ahead
  filterQueries($event: FilterEvent) {
    const index = (this.filterConfig.fields as any).findIndex((i: any) => i.id === $event.field.id);
    let val = $event.value.trim();

    if (this.filterConfig.fields[index].id === 'weekDay') {
      this.filterConfig.fields[index].queries = [
        ...this.weekDayQueries.filter((item: any) => {
          if (item.value) {
            return (item.value.toLowerCase().indexOf(val.toLowerCase()) > -1);
          } else {
            return true;
          }
        })
      ];
    }
  }

  // Sort

  compare(item1: any, item2: any): number {
    let compValue = 0;
    if (this.currentSortField.id === 'name') {
      compValue = item1.name.localeCompare(item2.name);
    } else if (this.currentSortField.id === 'address') {
      compValue = item1.address.localeCompare(item2.address);
    } else if (this.currentSortField.id === 'birthMonth') {
      compValue = this.monthVals[item1.birthMonth] - this.monthVals[item2.birthMonth];
    } else if (this.currentSortField.id === 'weekDay') {
      compValue = this.weekDayVals[item1.weekDay] - this.weekDayVals[item2.weekDay];
    }

    if (!this.isAscendingSort) {
      compValue = compValue * -1;
    }
    return compValue;
  }

  // Handle sort changes
  sortChanged($event: SortEvent): void {
    this.currentSortField = $event.field;
    this.isAscendingSort = $event.isAscending;
    this.items.sort((item1: any, item2: any) => this.compare(item1, item2));
  }

  // View

  viewSelected(currentView: ToolbarView): void {
    this.sortConfig.visible = (currentView.id === 'tableView' ? false : true);
  }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ProjectCodeStyleSettingsManager">
    <option name="PER_PROJECT_SETTINGS">
      <value>
        <option name="FIELD_NAME_PREFIX" value="m" />
        <option name="STATIC_FIELD_NAME_PREFIX" value="s" />
        <option name="PARAMETER_NAME_PREFIX" value="_" />
        <option name="RIGHT_MARGIN" value="100" />
        <JavaCodeStyleSettings>
          <option name="ANNOTATION_PARAMETER_WRAP" value="5" />
          <option name="ALIGN_MULTILINE_ANNOTATION_PARAMETERS" value="true" />
        </JavaCodeStyleSettings>
        <XML>
          <option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
        </XML>
        <codeStyleSettings language="JAVA">
          <option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false" />
          <option name="CALL_PARAMETERS_WRAP" value="1" />
          <option name="METHOD_PARAMETERS_WRAP" value="1" />
          <option name="RESOURCE_LIST_WRAP" value="1" />
          <option name="EXTENDS_LIST_WRAP" value="1" />
          <option name="THROWS_LIST_WRAP" value="1" />
          <option name="EXTENDS_KEYWORD_WRAP" value="1" />
          <option name="THROWS_KEYWORD_WRAP" value="1" />
          <option name="METHOD_CALL_CHAIN_WRAP" value="1" />
          <option name="BINARY_OPERATION_WRAP" value="1" />
          <option name="ARRAY_INITIALIZER_WRAP" value="1" />
          <option name="ASSIGNMENT_WRAP" value="1" />
          <option name="PARAMETER_ANNOTATION_WRAP" value="1" />
          <option name="VARIABLE_ANNOTATION_WRAP" value="1" />
        </codeStyleSettings>
      </value>
    </option>
    <option name="USE_PER_PROJECT_SETTINGS" value="true" />
  </component>
</project>

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.iwc.shop.modules.shop.dao.ShopProductDao">

	<sql id="columns">
		a.id AS "id",
		a.name AS "name",
		a.image AS "image",
		a.image_small AS "imageSmall",
		a.image_medium AS "imageMedium",
		a.image_large AS "imageLarge",
		a.featured AS "featured",
		a.featured_image AS "featuredImage",
		a.short_description AS "shortDescription",
		a.description AS "description",
		a.meta_keywords AS "metaKeywords",
		a.meta_description AS "metaDescription",
		a.sort AS "sort",
		a.is_audit AS "isAudit",
		a.price AS "price",
		a.featured_price AS "featuredPrice",
		a.featured_position AS "featuredPosition",
		a.featured_position_sort AS "featuredPositionSort",
		a.status,
		a.create_by AS "createBy.id",
		a.create_date AS "createDate",
		a.update_by AS "updateBy.id",
		a.update_date AS "updateDate",
		a.remarks AS "remarks",
		a.del_flag AS "delFlag",
		a.category_id AS "category.id",
		a.app_featured_home AS "appFeaturedHome",
		a.app_featured_home_sort AS "appFeaturedHomeSort",
		a.app_featured_topic AS "appFeaturedTopic",
		a.app_featured_topic_sort AS "appFeaturedTopicSort",
		a.app_featured_image AS "appFeaturedImage",
		a.app_long_image1 AS "appLongImage1",
		a.app_long_image2 AS "appLongImage2",
		a.app_long_image3 AS "appLongImage3",
		a.app_long_image4 AS "appLongImage4",
		a.app_long_image5 AS "appLongImage5",
		a.type
	</sql>

	<sql id="joinColumns">
		c.name AS "category.name"
	</sql>

	<sql id="joins">
		INNER JOIN shop_category c ON c.id = a.category_id
	</sql>

	<insert id="insert">
		INSERT INTO shop_product(
			id,
			category_id,
			name,
			image,
			image_small,
			image_medium,
			image_large,
			featured,
			featured_image,
			short_description,
			description,
			meta_keywords,
			meta_description,
			sort,
			price,
			featured_price,
			featured_position,
			featured_position_sort,
			is_audit,
			app_featured_home,
			app_featured_home_sort,
			app_featured_image,
			app_featured_topic,
			app_featured_topic_sort,
			app_long_image1,
			app_long_image2,
			app_long_image3,
			app_long_image4,
			app_long_image5,
			type,
			status,
			create_by,
			create_date,
			update_by,
			update_date,
			remarks,
			del_flag)
		VALUES (
			#{id},
			#{category.id},
			#{name},
			#{image},
			#{imageSmall},
			#{imageMedium},
			#{imageLarge},
			#{featured},
			#{featuredImage},
			#{shortDescription},
			#{description},
			#{metaKeywords},
			#{metaDescription},
			#{sort},
			#{price},
			#{featuredPrice},
			#{featuredPosition},
			#{featuredPositionSort},
			#{isAudit},
			#{appFeaturedHome},
			#{appFeaturedHomeSort},
			#{appFeaturedImage},
			#{appFeaturedTopic},
			#{appFeaturedTopicSort},
			#{appLongImage1},
			#{appLongImage2},
			#{appLongImage3},
			#{appLongImage4},
			#{appLongImage5},
			#{type},
			#{status},
			#{createBy.id},
			#{createDate},
			#{updateBy.id},
			#{updateDate},
			#{remarks},
			#{delFlag})
	</insert>

	<update id="update">
		UPDATE shop_product SET
			category_id = #{category.id},
			name = #{name},
			image = #{image},
			image_small = #{imageSmall},
			image_medium = #{imageMedium},
			image_large = #{imageLarge},
			featured = #{featured},
			featured_image = #{featuredImage},
			short_description = #{shortDescription},
			description = #{description},
			meta_keywords = #{metaKeywords},
			meta_description = #{metaDescription},
			sort = #{sort},
			price = #{price},
			featured_price = #{featuredPrice},
			featured_position = #{featuredPosition},
			featured_position_sort = #{featuredPositionSort},
			is_audit = #{isAudit},
			app_featured_home = #{appFeaturedHome},
			app_featured_home_sort = #{appFeaturedHomeSort},
			app_featured_topic = #{appFeaturedTopic},
			app_featured_topic_sort = #{appFeaturedTopicSort},
			app_featured_image = #{appFeaturedImage},
			app_long_image1 = #{appLongImage1},
			app_long_image2 = #{appLongImage2},
			app_long_image3 = #{appLongImage3},
			app_long_image4 = #{appLongImage4},
			app_long_image5 = #{appLongImage5},
			type = #{type},
			status = #{status},
			update_by = #{updateBy.id},
			update_date = #{updateDate},
			remarks = #{remarks},
			del_flag = #{delFlag}
		WHERE id = #{id}
	</update>

	<select id="get" resultType="ShopProduct">
		SELECT
			<include refid="columns"/>
		FROM shop_product a
		WHERE a.id = #{id}
	</select>

	<update id="delete">
		UPDATE shop_product SET
			del_flag = #{DEL_FLAG_DELETE}
		WHERE id = #{id}
	</update>

	<select id="findList" resultType="ShopProduct">
		SELECT
			<include refid="columns"/>
			<if test="sqlMap.withJoins == 'true'">
				,<include refid="joinColumns"/>
			</if>
		FROM shop_product a
			<if test="sqlMap.withJoins == 'true'">
				<include refid="joins"/>
			</if>
		<where>
			1 = 1
			<if test="category != null and category.id != null and category.id != ''">
				AND a.category_id = #{category.id}
			</if>
			<if test="featuredPosition != null and featuredPosition != ''">
				AND a.featured_position LIKE
					<if test="dbName == 'oracle'">'%'||#{featuredPosition}||'%'</if>
					<if test="dbName == 'mysql'">CONCAT('%', #{featuredPosition}, '%')</if>
			</if>
			<if test="appFeaturedHome != null and appFeaturedHome != ''">
				AND a.app_featured_home = #{appFeaturedHome}
			</if>
			<if test="appFeaturedTopic != null and appFeaturedTopic != ''">
				AND a.app_featured_topic = #{appFeaturedTopic}
			</if>
			<if test="status != null and status != ''">
				AND a.status = #{status}
			</if>
			<if test="delFlag != null and delFlag != ''">
				AND a.del_flag = #{delFlag}
			</if>
		</where>
		<choose>
			<when test="page != null and page.orderBy != null and page.orderBy != ''">
				ORDER BY ${page.orderBy}
			</when>
			<otherwise>
				ORDER BY a.sort ASC, a.update_date DESC
			</otherwise>
		</choose>
	</select>

	<select id="findFeaturedPrice" resultType="ShopProduct">
		SELECT
		<include refid="columns"/>
		FROM shop_product a
		<where>
			a.del_flag = #{delFlag} AND
			a.featured_price > 0
		</where>
        ORDER BY a.featured_price DESC
	</select>

</mapper>


text:
import compTpl from './compTpl';
import indexTpl from './indexTpl';
import demoTpl from './demoTpl';
import interfaceTpl from './interfaceTpl';

export default {
  compTpl,
  indexTpl,
  demoTpl,
  interfaceTpl,
};


text:
package javax.mail;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Vector;
import javax.mail.event.TransportEvent;
import javax.mail.event.TransportListener;

/**
 * Abstract class modeling a message transport.
 *
 * @version $Rev: 582780 $ $Date: 2007-10-08 13:17:15 +0200 (Mo, 08. Okt 2007) $
 */
public abstract class Transport extends Service {
    /**
     * Send a message to all recipient addresses the message contains (as returned by {@link Message#getAllRecipients()})
     * using message transports appropriate for each address. Message addresses are checked during submission,
     * but there is no guarantee that the ultimate address is valid or that the message will ever be delivered.
     *

     * {@link Message#saveChanges()} will be called before the message is actually sent.
     *
     * @param message the message to send
     * @throws MessagingException if there was a problem sending the message
     */
    public static void send(Message message) throws MessagingException {
        send(message, message.getAllRecipients());
    }

    /**
     * Send a message to all addresses provided irrespective of any recipients contained in the message,
     * using message transports appropriate for each address. Message addresses are checked during submission,
     * but there is no guarantee that the ultimate address is valid or that the message will ever be delivered.
     *

     * {@link Message#saveChanges()} will be called before the message is actually sent.
     *
     * @param message   the message to send
     * @param addresses the addesses to send to
     * @throws MessagingException if there was a problem sending the message
     */
    public static void send(Message message, Address[] addresses) throws MessagingException {
        Session session = message.session;
        Map msgsByTransport = new HashMap();
        for (int i = 0; i < addresses.length; i++) {
            Address address = addresses[i];
            Transport transport = session.getTransport(address);
            List addrs = (List) msgsByTransport.get(transport);
            if (addrs == null) {
                addrs = new ArrayList();
                msgsByTransport.put(transport, addrs);
            }
            addrs.add(address);
        }

        message.saveChanges();

        // Since we might be sending to multiple protocols, we need to catch and process each exception
        // when we send and then throw a new SendFailedException when everything is done.  Unfortunately, this
        // also means unwrapping the information in any SendFailedExceptions we receive and building
        // composite failed list.
        MessagingException chainedException = null;
        ArrayList sentAddresses = new ArrayList();
        ArrayList unsentAddresses = new ArrayList();
        ArrayList invalidAddresses = new ArrayList();

        for (Iterator i = msgsByTransport.entrySet().iterator(); i.hasNext();) {
            Map.Entry entry = (Map.Entry) i.next();
            Transport transport = (Transport) entry.getKey();
            List addrs = (List) entry.getValue();
            try {
                // we MUST connect to the transport before attempting to send.
                transport.connect();
                transport.sendMessage(message, (Address[]) addrs.toArray(new Address[addrs.size()]));
                // if we have to throw an exception because of another failure, these addresses need to
                // be in the valid list.  Since we succeeded here, we can add these now.
                sentAddresses.addAll(addrs);
            } catch (SendFailedException e) {
                // a true send failure.  The exception contains a wealth of information about
                // the failures, including a potential chain of exceptions explaining what went wrong.  We're
                // going to send a new one of these, so we need to merge the information.

                // add this to our exception chain
                if (chainedException == null) {
                    chainedException = e;
                }
                else {
                    chainedException.setNextException(e);
                }

                // now extract each of the address categories from
                Address[] exAddrs = e.getValidSentAddresses();
                if (exAddrs != null) {
                    for (int j = 0; j < exAddrs.length; j++) {
                        sentAddresses.add(exAddrs[j]);
                    }
                }

                exAddrs = e.getValidUnsentAddresses();
                if (exAddrs != null) {
                    for (int j = 0; j < exAddrs.length; j++) {
                        unsentAddresses.add(exAddrs[j]);
                    }
                }

                exAddrs = e.getInvalidAddresses();
                if (exAddrs != null) {
                    for (int j = 0; j < exAddrs.length; j++) {
                        invalidAddresses.add(exAddrs[j]);
                    }
                }

            } catch (MessagingException e) {
                // add this to our exception chain
                if (chainedException == null) {
                    chainedException = e;
                }
                else {
                    chainedException.setNextException(e);
                }
            }
            finally {
                transport.close();
            }
        }

        // if we have an exception chain then we need to throw a new exception giving the failure
        // information.
        if (chainedException != null) {
            // if we're only sending to a single transport (common), and we received a SendFailedException
            // as a result, then we have a fully formed exception already.  Rather than wrap this in another
            // exception, we can just rethrow the one we have.
            if (msgsByTransport.size() == 1 && chainedException instanceof SendFailedException) {
                throw chainedException;
            }

            // create our lists for notification and exception reporting from this point on.
            Address[] sent = (Address[])sentAddresses.toArray(new Address[0]);
            Address[] unsent = (Address[])unsentAddresses.toArray(new Address[0]);
            Address[] invalid = (Address[])invalidAddresses.toArray(new Address[0]);

            throw new SendFailedException("Send failure", chainedException, sent, unsent, invalid);
        }
    }

    /**
     * Constructor taking Session and URLName parameters required for {@link Service#Service(Session, URLName)}.
     *
     * @param session the Session this transport is for
     * @param name    the location this transport is for
     */
    public Transport(Session session, URLName name) {
        super(session, name);
    }

    /**
     * Send a message to the supplied addresses using this transport; if any of the addresses are
     * invalid then a {@link SendFailedException} is thrown. Whether the message is actually sent
     * to any of the addresses is undefined.
     *

     * Unlike the static {@link #send(Message, Address[])} method, {@link Message#saveChanges()} is
     * not called. A {@link TransportEvent} will be sent to registered listeners once the delivery
     * attempt has been made.
     *
     * @param message   the message to send
     * @param addresses list of addresses to send it to
     * @throws SendFailedException if the send failed
     * @throws MessagingException  if there was a problem sending the message
     */
    public abstract void sendMessage(Message message, Address[] addresses) throws MessagingException;

    private Vector transportListeners = new Vector();

    public void addTransportListener(TransportListener listener) {
        transportListeners.add(listener);
    }

    public void removeTransportListener(TransportListener listener) {
        transportListeners.remove(listener);
    }

    protected void notifyTransportListeners(int type, Address[] validSent, Address[] validUnsent, Address[] invalid, Message message) {
        queueEvent(new TransportEvent(this, type, validSent, validUnsent, invalid, message), transportListeners);
    }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>JSDoc: Source: trade.js</title>

    <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
    <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">

Source: trade.js

/**
 * A Trade class
 * @constructor
 * @param {Player} proposingPlayer - The player starting the trade
 * @param {Player} answeringPlayer - The player responding to the trade
 * @param {Dictionary} proposingPlayerItems - The proposing player's items in the trade
 * @param {Dictionary} answeringPlayerItems - The answering player's items in the trade
*/
function Trade(proposingPlayer, answeringPlayer, proposingPlayerItems, answeringPlayerItems) {
  this.proposingPlayer = proposingPlayer;
  this.answeringPlayer = answeringPlayer;
  this.proposingPlayerItems = proposingPlayerItems;
  this.answeringPlayerItems = answeringPlayerItems;
};

/**
 * Execute the trade and swap the players' items
 * @returns {void}
*/
Trade.prototype.completeTrade = function() {
  this.proposingPlayer.addItems(this.answeringPlayerItems);
  this.answeringPlayer.addItems(this.proposingPlayerItems);
};

/**
 * Add the objects back to their respective players
 * @returns {void}
*/
Trade.prototype.cancelTrade = function() {
  this.proposingPlayer.addItems(this.proposingPlayerItems);
  this.answeringPlayer.addItems(this.answeringPlayerItems);
};

module.exports = Trade

Home

Classes

ArrayBoard

Board

Card

Component

Deck

EdgeTile

Game

GridBoard

Player

Tile

Token

Trade

VertexTile

View

    Documentation generated by JSDoc 3.3.3 on Thu Jan 21 2016 20:55:21 GMT-0500 (EST)


text:
package org.mozartoz.bootcompiler
package bytecode

import util._

class RegCounter[A <: Register](index2reg: Int => A) {
  private val underlying = new Counter(start = 0)

  def next() = index2reg(underlying.next())
}


text:
<?php

if (!defined('BASEPATH')) exit('No direct script access allowed');

/*
|--------------------------------------------------------------------------
| Website details
|
| These details are used in emails sent by authentication library.
|--------------------------------------------------------------------------
*/

$ci = & get_instance();

$config['website_name'] = $ci->cimconfig->website_name;
$config['webmaster_email'] = $ci->cimconfig->webmaster_email;

/*
|--------------------------------------------------------------------------
| Security settings
|
| The library uses PasswordHash library for operating with hashed passwords.
| 'phpass_hash_portable' = Can passwords be dumped and exported to another server. If set to FALSE then you won't be able to use this database on another server.
| 'phpass_hash_strength' = Password hash strength.
|--------------------------------------------------------------------------
*/

$config['phpass_hash_portable'] = FALSE;
$config['phpass_hash_strength'] = 8;

/*
|--------------------------------------------------------------------------
| Registration settings
|
| 'allow_registration' = Registration is enabled or not
| 'captcha_registration' = Registration uses CAPTCHA
| 'email_activation' = Requires user to activate their account using email after registration.
| 'email_activation_expire' = Time before users who don't activate their account getting deleted from database. Default is 48 hours (60*60*24*2).
| 'email_account_details' = Email with account details is sent after registration (only when 'email_activation' is FALSE).
| 'use_username' = Username is required or not.
|
| 'username_min_length' = Min length of user's username.
| 'username_max_length' = Max length of user's username.
| 'password_min_length' = Min length of user's password.
| 'password_max_length' = Max length of user's password.
|--------------------------------------------------------------------------

*/

$config['allow_registration'] = TRUE;
$config['email_activation'] = TRUE;
$config['email_activation_expire'] = 60*60*24*2;
$config['email_account_details'] = TRUE;
$config['use_username'] = TRUE;
$config['username_min_length'] = 4;
$config['username_max_length'] = 20;
$config['password_min_length'] = 4;
$config['password_max_length'] = 20;
$config['new_user_group'] = 5;

$config['captcha_registration'] =  $ci->cimconfig->captcha_registration;
$config['captcha_forgetpassword'] =  $ci->cimconfig->captcha_forgetpassword;
$config['captcha_retrieveusername'] =  $ci->cimconfig->captcha_retrieveusername;

/*
|--------------------------------------------------------------------------
| Login settings
|
| 'login_by_username' = Username can be used to login.
| 'login_by_email' = Email can be used to login.
| You have to set at least one of 2 settings above to TRUE.
| 'login_by_username' makes sense only when 'use_username' is TRUE.
|
| 'login_record_ip' = Save in database user IP address on user login.
| 'login_record_time' = Save in database current time on user login.
|
| 'login_count_attempts' = Count failed login attempts.
| 'login_max_attempts' = Number of failed login attempts before CAPTCHA will be shown.
| 'login_attempt_expire' = Time to live for every attempt to login. Default is 24 hours (60*60*24).
|--------------------------------------------------------------------------
*/

$config['login_by_username'] = TRUE;
$config['login_by_email'] = TRUE;
$config['login_record_ip'] = TRUE;
$config['login_record_time'] = TRUE;
$config['login_count_attempts'] = TRUE;
$config['login_max_attempts'] = 5;
$config['login_attempt_expire'] = 60*60*24;

/*
|--------------------------------------------------------------------------
| Auto login settings
|
| 'autologin_cookie_name' = Auto login cookie name.
| 'autologin_cookie_life' = Auto login cookie life before expired. Default is 2 months (60*60*24*31*2).
|--------------------------------------------------------------------------
*/

$config['autologin_cookie_name'] = 'autologin';
$config['autologin_cookie_life'] = 60*60*24*31*2;

/*
|--------------------------------------------------------------------------
| Forgot password settings
|
| 'forgot_password_expire' = Time before forgot password key become invalid. Default is 15 minutes (60*15).
|--------------------------------------------------------------------------
*/

$config['forgot_password_expire'] = 60*15;

/*
|--------------------------------------------------------------------------
| Captcha
|
| You can set captcha that created by Auth library in here.
| 'captcha_path' = Directory where the catpcha will be created.
| 'captcha_fonts_path' = Font in this directory will be used when creating captcha.
| 'captcha_font_size' = Font size when writing text to captcha. Leave blank for random font size.
| 'captcha_grid' = Show grid in created captcha.
| 'captcha_expire' = Life time of created captcha before expired, default is 3 minutes (180 seconds).
| 'captcha_case_sensitive' = Captcha case sensitive or not.
|--------------------------------------------------------------------------

*/

$config['captcha_path'] = 'assets/captcha/';
$config['captcha_fonts_path'] = 'assets/captcha/fonts/3.ttf';
$config['captcha_width'] = 170;
$config['captcha_height'] = 40;
$config['captcha_font_size'] = 15;
$config['captcha_grid'] = FALSE;
$config['captcha_expire'] = 180;
$config['captcha_case_sensitive'] = FALSE;

/*
|--------------------------------------------------------------------------
| reCAPTCHA
|
| 'use_recaptcha' = Use reCAPTCHA instead of common captcha
| You can get reCAPTCHA keys by registering at http://recaptcha.net
|--------------------------------------------------------------------------
*/

$config['use_recaptcha'] =  $ci->cimconfig->use_recaptcha;
$config['recaptcha_sitekey'] = $ci->cimconfig->recaptcha_sitekey;
$config['recaptcha_secretkey'] = $ci->cimconfig->recaptcha_secretkey;

/*
| -------------------------------------------------------------------------
| Email
| -------------------------------------------------------------------------
| This file lets you define parameters for sending emails.
| Please see the user guide for info:
|
|	http://codeigniter.com/user_guide/libraries/email.html
|
*/

$config['mailtype'] = 'html';
$config['charset'] = 'utf-8';
$config['newline'] = "\r\n";

/*
 * Countries List
 *
 */

 $config['country_list'] = array(
	"AF"=>"Afghanistan",
	"AL"=>"Albania",
	"DZ"=>"Algeria",
	"AD"=>"Andorra",
	"AO"=>"Angola",
	"AI"=>"Anguilla",
	"AQ"=>"Antarctica",
	"AG"=>"Antigua and Barbuda",
	"AR"=>"Argentina",
	"AM"=>"Armenia",
	"AW"=>"Aruba",
	"AU"=>"Australia",
	"AT"=>"Austria",
	"AZ"=>"Azerbaijan",
	"BS"=>"Bahamas",
	"BH"=>"Bahrain",
	"BD"=>"Bangladesh",
	"BB"=>"Barbados",
	"BY"=>"Belarus",
	"BE"=>"Belgium",
	"BZ"=>"Belize",
	"BJ"=>"Benin",
	"BM"=>"Bermuda",
	"BT"=>"Bhutan",
	"BO"=>"Bolivia",
	"BA"=>"Bosnia and Herzegovina",
	"BW"=>"Botswana",
	"BR"=>"Brazil",
	"IO"=>"British Indian Ocean",
	"BN"=>"Brunei",
	"BG"=>"Bulgaria",
	"BF"=>"Burkina Faso",
	"BI"=>"Burundi",
	"KH"=>"Cambodia",
	"CM"=>"Cameroon",
	"CA"=>"Canada",
	"CV"=>"Cape Verde",
	"KY"=>"Cayman Islands",
	"CF"=>"Central African Republic",
	"TD"=>"Chad",
	"CL"=>"Chile",
	"CN"=>"China",
	"CX"=>"Christmas Island",
	"CC"=>"Cocos (Keeling) Islands",
	"CO"=>"Colombia",
	"KM"=>"Comoros",
	"CD"=>"Congo, Democratic Republic of the",
	"CG"=>"Congo, Republic of the",
	"CK"=>"Cook Islands",
	"CR"=>"Costa Rica",
	"HR"=>"Croatia",
	"CY"=>"Cyprus",
	"CZ"=>"Czech Republic",
	"DK"=>"Denmark",
	"DJ"=>"Djibouti",
	"DM"=>"Dominica",
	"DO"=>"Dominican Republic",
	"TL"=>"East Timor",
	"EC"=>"Ecuador",
	"EG"=>"Egypt",
	"SV"=>"El Salvador",
	"GQ"=>"Equatorial Guinea",
	"ER"=>"Eritrea",
	"EE"=>"Estonia",
	"ET"=>"Ethiopia",
	"FK"=>"Falkland Islands (Malvinas)",
	"FO"=>"Faroe Islands",
	"FJ"=>"Fiji",
	"FI"=>"Finland",
	"FR"=>"France",
	"GF"=>"French Guiana",
	"PF"=>"French Polynesia",
	"GA"=>"Gabon",
	"GM"=>"Gambia",
	"GE"=>"Georgia",
	"DE"=>"Germany",
	"GH"=>"Ghana",
	"GI"=>"Gibraltar",
	"GR"=>"Greece",
	"GL"=>"Greenland",
	"GD"=>"Grenada",
	"GP"=>"Guadeloupe",
	"GT"=>"Guatemala",
	"GN"=>"Guinea",
	"GW"=>"Guinea-Bissau",
	"GY"=>"Guyana",
	"HT"=>"Haiti",
	"HN"=>"Honduras",
	"HK"=>"Hong Kong",
	"HU"=>"Hungary",
	"IS"=>"Iceland",
	"IN"=>"India",
	"ID"=>"Indonesia",
	"IE"=>"Ireland",
	"IL"=>"Israel",
	"IT"=>"Italy",
	"CI"=>"Ivory Coast (Côte d\'Ivoire)",
	"JM"=>"Jamaica",
	"JP"=>"Japan",
	"JO"=>"Jordan",
	"KZ"=>"Kazakhstan",
	"KE"=>"Kenya",
	"KI"=>"Kiribati",
	"KR"=>"Korea, South",
	"KW"=>"Kuwait",
	"KG"=>"Kyrgyzstan",
	"LA"=>"Laos",
	"LV"=>"Latvia",
	"LB"=>"Lebanon",
	"LS"=>"Lesotho",
	"LI"=>"Liechtenstein",
	"LT"=>"Lithuania",
	"LU"=>"Luxembourg",
	"MO"=>"Macau",
	"MK"=>"Macedonia, Republic of",
	"MG"=>"Madagascar",
	"MW"=>"Malawi",
	"MY"=>"Malaysia",
	"MV"=>"Maldives",
	"ML"=>"Mali",
	"MT"=>"Malta",
	"MH"=>"Marshall Islands",
	"MQ"=>"Martinique",
	"MR"=>"Mauritania",
	"MU"=>"Mauritius",
	"YT"=>"Mayotte",
	"MX"=>"Mexico",
	"FM"=>"Micronesia",
	"MD"=>"Moldova",
	"MC"=>"Monaco",
	"MN"=>"Mongolia",
	"ME"=>"Montenegro",
	"MS"=>"Montserrat",
	"MA"=>"Morocco",
	"MZ"=>"Mozambique",
	"NA"=>"Namibia",
	"NR"=>"Nauru",
	"NP"=>"Nepal",
	"NL"=>"Netherlands",
	"AN"=>"Netherlands Antilles",
	"NC"=>"New Caledonia",
	"NZ"=>"New Zealand",
	"NI"=>"Nicaragua",
	"NE"=>"Niger",
	"NG"=>"Nigeria",
	"NU"=>"Niue",
	"NF"=>"Norfolk Island",
	"NO"=>"Norway",
	"OM"=>"Oman",
	"PK"=>"Pakistan",
	"PS"=>"Palestinian Territory",
	"PA"=>"Panama",
	"PG"=>"Papua New Guinea",
	"PY"=>"Paraguay",
	"PE"=>"Peru",
	"PH"=>"Philippines",
	"PN"=>"Pitcairn Island",
	"PL"=>"Poland",
	"PT"=>"Portugal",
	"QA"=>"Qatar",
	"RE"=>"Réunion",
	"RO"=>"Romania",
	"RU"=>"Russia",
	"RW"=>"Rwanda",
	"SH"=>"Saint Helena",
	"KN"=>"Saint Kitts and Nevis",
	"LC"=>"Saint Lucia",
	"PM"=>"Saint Pierre and Miquelon",
	"VC"=>"Saint Vincent and the Grenadines",
	"WS"=>"Samoa",
	"SM"=>"San Marino",
	"ST"=>"São Tome and Principe",
	"SA"=>"Saudi Arabia",
	"SN"=>"Senegal",
	"RS"=>"Serbia",
	"CS"=>"Serbia and Montenegro",
	"SC"=>"Seychelles",
	"SL"=>"Sierra Leon",
	"SG"=>"Singapore",
	"SK"=>"Slovakia",
	"SI"=>"Slovenia",
	"SB"=>"Solomon Islands",
	"SO"=>"Somalia",
	"ZA"=>"South Africa",
	"GS"=>"South Georgia and the South Sandwich Islands",
	"ES"=>"Spain",
	"LK"=>"Sri Lanka",
	"SR"=>"Suriname",
	"SJ"=>"Svalbard and Jan Mayen",
	"SZ"=>"Swaziland",
	"SE"=>"Sweden",
	"CH"=>"Switzerland",
	"TW"=>"Taiwan",
	"TJ"=>"Tajikistan",
	"TZ"=>"Tanzania",
	"TH"=>"Thailand",
	"TG"=>"Togo",
	"TK"=>"Tokelau",
	"TO"=>"Tonga",
	"TT"=>"Trinidad and Tobago",
	"TN"=>"Tunisia",
	"TR"=>"Turkey",
	"TM"=>"Turkmenistan",
	"TC"=>"Turks and Caicos Islands",
	"TV"=>"Tuvalu",
	"UG"=>"Uganda",
	"UA"=>"Ukraine",
	"AE"=>"United Arab Emirates",
	"GB"=>"United Kingdom",
	"US"=>"United States",
	"UM"=>"United States Minor Outlying Islands",
	"UY"=>"Uruguay",
	"UZ"=>"Uzbekistan",
	"VU"=>"Vanuatu",
	"VA"=>"Vatican City",
	"VE"=>"Venezuela",
	"VN"=>"Vietnam",
	"VG"=>"Virgin Islands, British",
	"WF"=>"Wallis and Futuna",
	"EH"=>"Western Sahara",
	"YE"=>"Yemen",
	"ZM"=>"Zambia",
	"ZW"=>"Zimbabwe");

/* enable/disable solcial logins */
$config['enable_facebook'] = $ci->cimconfig->enable_facebook;
$config['enable_twitter'] = $ci->cimconfig->enable_twitter;
$config['enable_gplus'] = $ci->cimconfig->enable_gplus;
$config['enable_linkedin'] = $ci->cimconfig->enable_linkedin;
$config['enable_github'] = $ci->cimconfig->enable_github;
$config['enable_instagram'] = $ci->cimconfig->enable_instagram;
$config['enable_microsoft'] = $ci->cimconfig->enable_microsoft;
$config['enable_envato'] = $ci->cimconfig->enable_envato;
$config['enable_paypal'] = $ci->cimconfig->enable_paypal;
$config['enable_yandex'] = $ci->cimconfig->enable_yandex;
//$config['enable_bitbucket'] = $ci->cimconfig->enable_bitbucket;

/* Facebook Oauth Configuration */
$config['facebook_app_id'] = $ci->cimconfig->facebook_app_id;
$config['facebook_app_secret'] = $ci->cimconfig->facebook_app_secret;

/* Twitter Oauth Configuration */
$config['tw_consumer_key'] = $ci->cimconfig->tw_consumer_key;
$config['tw_consumer_secret'] = $ci->cimconfig->tw_consumer_secret;

/* Google Oauth Configuration */
$config['google_app_id'] = $ci->cimconfig->google_app_id;
$config['google_app_secret'] = $ci->cimconfig->google_app_secret;

/* Linkedin Configuration */
$config['linkedin_client_id'] = $ci->cimconfig->linkedin_client_id;
$config['linkedin_client_secret'] = $ci->cimconfig->linkedin_client_secret;

/* Github Configuration */
$config['github_client_id'] = $ci->cimconfig->github_client_id;
$config['github_client_secret'] = $ci->cimconfig->github_client_secret;

/* Instagram Configuration */
$config['instagram_client_id'] = $ci->cimconfig->instagram_client_id;
$config['instagram_client_secret'] = $ci->cimconfig->instagram_client_secret;

/* Microsoft Configuration */
$config['microsoft_client_id'] = $ci->cimconfig->microsoft_client_id;
$config['microsoft_client_secret'] = $ci->cimconfig->microsoft_client_secret;

/* Envato Configuration */
$config['envato_client_id'] = $ci->cimconfig->envato_client_id;
$config['envato_client_secret'] = $ci->cimconfig->envato_client_secret;

/* Paypal Configuration */
$config['paypal_client_id'] = $ci->cimconfig->paypal_client_id;
$config['paypal_client_secret'] = $ci->cimconfig->paypal_client_secret;

/* Yandex configuration */
$config['yandex_client_id'] = $ci->cimconfig->yandex_client_id;
$config['yandex_client_secret'] = $ci->cimconfig->yandex_client_secret;

/* Bitbucket configuration */
//$config['bitbucket_key'] = $ci->cimconfig->bitbucket_key;
//$config['bitbucket_secret'] = $ci->cimconfig->bitbucket_secret;

/* End of file cimembership.php */
/* Location: ./application/config/cimembership.php */


text:
const dal = require('./dal');
const status = require('http-status-codes');
const urls = require('georap-urls-server');

exports.count = (req, res, next) => {

  dal.count((err, numLocs) => {
    if (err) {
      return next(err);
    }

    return res.json(numLocs);
  });
};

exports.create = (req, res, next) => {
  // Create a location with an optional name.

  // Validate required arguments
  const valid = (typeof req.body === 'object' &&
                 typeof req.body.lat === 'number' &&
                 typeof req.body.lng === 'number');
  if (!valid) {
    return res.status(status.BAD_REQUEST).send('Invalid loc name');
  }

  const lat = req.body.lat;
  const lng = req.body.lng;

  const username = req.user.name;

  // Create with name
  if (typeof req.body.name === 'string') {
    const name = req.body.name.trim();

    const minLen = 2;
    const maxLen = 120;
    if (name.length < minLen || name.length > maxLen) {
      return res.status(status.BAD_REQUEST).send('Too short or too long name');
    }

    dal.createLocation({
      name: name,
      latitude: lat,
      longitude: lng,
      username: username,
    }, (err, rawLoc) => {
      if (err) {
        if (err.message === 'TOO_CLOSE') {
          return res.json('TOO_CLOSE');
        }
        return next(err);
      }
      return res.json(rawLoc);
    });
  } else {
    // Create without name
    dal.create(lat, lng, username, (err, rawLoc) => {
      if (err) {
        if (err.message === 'TOO_CLOSE') {
          return res.json('TOO_CLOSE');
        }
        return next(err);
      }
      return res.json(rawLoc);
    });
  }
};

exports.latest = (req, res, next) => {
  // Latest created locations. For this, we use locations collection
  // instead of events because we get the name and thumbnail from the location.
  //

  // NOTE Skip and limit are validated by middleware.

  dal.latestComplete({
    skip: req.query.skip,
    limit: req.query.limit,
  }, (err, locs) => {
    if (err) {
      return next(err);
    }

    // Complete attachment URLs
    const urledLocs = locs.map((loc) => {
      if (loc.thumbnail) {
        loc.thumbnail = urls.completeAttachment(loc.thumbnail);
      }
      return loc;
    });

    // Provide location count
    dal.count((errn, n) => {
      if (errn) {
        return next(err);
      }

      return res.json({
        locations: urledLocs,
        locationCount: n,
      });
    });
  });
};

exports.search = (req, res, next) => {
  // Validate phrase. Skip and limit are validated by middleware.
  const phrase = req.query.phrase;
  if (phrase.length < 1) {
    return res.json({
      locations: [],
    });
  }

  dal.search({
    phrase: phrase,
    skip: req.query.skip,
    limit: req.query.limit,
  }, (err, locs) => {
    if (err) {
      return next(err);
    }
    return res.json({
      locations: locs,
    });
  });
};


text:
/**
 * JavaScript TickTrader Web API client
 * Created by ivan.shynkarenka on 11.06.2015
 */

/**
 * Sign request with HMAC-SHA256
 * @param request Request
 */
var _signRequest = function(context, request, web_api_id, web_api_key, web_api_secret) {
    if (!web_api_id)
        throw "TickTrader Web API Id should be valid!";
    if (!web_api_key)
        throw "TickTrader Web API Key should be valid!";
    if (!web_api_secret)
        throw "TickTrader Web API Secret should be valid!";

    var timestamp = Date.now();
    var signature = timestamp + web_api_id + web_api_key + context.type + context.url + (context.data ? context.data : "")
    var hash = CryptoJS.HmacSHA256(signature, web_api_secret);

    request.setRequestHeader('Authorization', 'HMAC ' + web_api_id + ':' + web_api_key + ':' + timestamp + ':' + CryptoJS.enc.Base64.stringify(hash));
};

var TickTraderWebClient = function(web_api_address, web_api_id, web_api_key, web_api_secret) {
    if (!web_api_address)
        throw "TickTrader Web API address should be valid!";

    this.web_api_address = web_api_address;
    this.web_api_id = web_api_id;
    this.web_api_key = web_api_key;
    this.web_api_secret = web_api_secret;
}

/**
 * Get public trade session information
 * @returns Public trade session information
 */
TickTraderWebClient.prototype.getPublicTradeSession = function() {
    return $.ajax({
        url: this.web_api_address + "/api/v1/public/tradesession",
        type: "GET"
    });
};

/**
 * Get list of all available public currencies
 * @returns List of all available public currencies
 */
TickTraderWebClient.prototype.getPublicAllCurrencies = function() {
    return $.ajax({
        url: this.web_api_address + "/api/v1/public/currency",
        type: "GET"
    });
};

/**
 * Get public currency by name
 * @param currency Currency name
 * @returns Public currency with the given name
 */
TickTraderWebClient.prototype.getPublicCurrency = function(currency) {
    return $.ajax({
        url: this.web_api_address + "/api/v1/public/currency/" + encodeURIComponent(encodeURIComponent(currency)),
        type: "GET"
    });
};

/**
 * Get list of all available public symbols
 * @returns List of all available public symbols
 */
TickTraderWebClient.prototype.getPublicAllSymbols = function() {
    return $.ajax({
        url: this.web_api_address + "/api/v1/public/symbol",
        type: "GET"
    });
};

/**
 * Get public symbol by name
 * @param symbol Symbol name
 * @returns Public symbol with the given name
 */
TickTraderWebClient.prototype.getPublicSymbol = function(symbol) {
    return $.ajax({
        url: this.web_api_address + "/api/v1/public/symbol/" + encodeURIComponent(encodeURIComponent(symbol)),
        type: "GET"
    });
};

/**
 * Get list of all available public feed ticks
 * @returns List of all available public feed ticks
 */
TickTraderWebClient.prototype.getPublicAllTicks = function() {
    return $.ajax({
        url: this.web_api_address + "/api/v1/public/tick",
        type: "GET"
    });
};

/**
 * Get public feed tick by symbol name
 * @param symbol Symbol name
 * @returns Public feed tick with the given symbol name
 */
TickTraderWebClient.prototype.getPublicTick = function(symbol) {
    return $.ajax({
        url: this.web_api_address + "/api/v1/public/tick/" + encodeURIComponent(encodeURIComponent(symbol)),
        type: "GET"
    });
};

/**
 * Get list of all available public feed level2 ticks
 * @returns List of all available public feed level2 ticks
 */
TickTraderWebClient.prototype.getPublicAllTicksLevel2 = function() {
    return $.ajax({
        url: this.web_api_address + "/api/v1/public/level2",
        type: "GET"
    });
};

/**
 * Get public feed level2 tick by symbol name
 * @param symbol Symbol name
 * @returns Public feed level2 tick with the given symbol name
 */
TickTraderWebClient.prototype.getPublicTickLevel2 = function(symbol) {
    return $.ajax({
        url: this.web_api_address + "/api/v1/public/level2/" + encodeURIComponent(encodeURIComponent(symbol)),
        type: "GET"
    });
};

/**
 * Get account information
 * @returns Account information
 */
TickTraderWebClient.prototype.getAccount = function() {
    var instance = this;
    return $.ajax({
        url: this.web_api_address + "/api/v1/account",
        type: "GET",
        beforeSend: function (request) {
            _signRequest(this, request, instance.web_api_id, instance.web_api_key, instance.web_api_secret);
        }
    });
};

/**
 * Get trade session information
 * @returns Trade session information
 */
TickTraderWebClient.prototype.getTradeSession = function() {
    var instance = this;
    return $.ajax({
        url: this.web_api_address + "/api/v1/tradesession",
        type: "GET",
        beforeSend: function (request) {
            _signRequest(this, request, instance.web_api_id, instance.web_api_key, instance.web_api_secret);
        }
    });
};

/**
 * Get list of all available currencies
 * @returns List of all available currencies
 */
TickTraderWebClient.prototype.getAllCurrencies = function() {
    var instance = this;
    return $.ajax({
        url: this.web_api_address + "/api/v1/currency",
        type: "GET",
        beforeSend: function (request) {
            _signRequest(this, request, instance.web_api_id, instance.web_api_key, instance.web_api_secret);
        }
    });
};

/**
 * Get currency by name
 * @param currency Currency name
 * @returns Currency with the given name
 */
TickTraderWebClient.prototype.getCurrency = function(currency) {
    var instance = this;
    return $.ajax({
        url: this.web_api_address + "/api/v1/currency/" + encodeURIComponent(encodeURIComponent(currency)),
        type: "GET",
        beforeSend: function (request) {
            _signRequest(this, request, instance.web_api_id, instance.web_api_key, instance.web_api_secret);
        }
    });
};

/**
 * Get list of all available symbols
 * @returns List of all available symbols
 */
TickTraderWebClient.prototype.getAllSymbols = function() {
    var instance = this;
    return $.ajax({
        url: this.web_api_address + "/api/v1/symbol",
        type: "GET",
        beforeSend: function (request) {
            _signRequest(this, request, instance.web_api_id, instance.web_api_key, instance.web_api_secret);
        }
    });
};

/**
 * Get symbol by name
 * @param symbol Symbol name
 * @returns Symbol with the given name
 */
TickTraderWebClient.prototype.getSymbol = function(symbol) {
    var instance = this;
    return $.ajax({
        url: this.web_api_address + "/api/v1/symbol/" + encodeURIComponent(encodeURIComponent(symbol)),
        type: "GET",
        beforeSend: function (request) {
            _signRequest(this, request, instance.web_api_id, instance.web_api_key, instance.web_api_secret);
        }
    });
};

/**
 * Get list of all available feed ticks
 * @returns List of all available feed ticks
 */
TickTraderWebClient.prototype.getAllTicks = function() {
    var instance = this;
    return $.ajax({
        url: this.web_api_address + "/api/v1/tick",
        type: "GET",
        beforeSend: function (request) {
            _signRequest(this, request, instance.web_api_id, instance.web_api_key, instance.web_api_secret);
        }
    });
};

/**
 * Get feed tick by symbol name
 * @param symbol Symbol name
 * @returns Feed tick with the given symbol
 */
TickTraderWebClient.prototype.getTick = function(symbol) {
    var instance = this;
    return $.ajax({
        url: this.web_api_address + "/api/v1/tick/" + encodeURIComponent(encodeURIComponent(symbol)),
        type: "GET",
        beforeSend: function (request) {
            _signRequest(this, request, instance.web_api_id, instance.web_api_key, instance.web_api_secret);
        }
    });
};

/**
 * Get list of all available feed level2 ticks
 * @returns List of all available feed level2 ticks
 */
TickTraderWebClient.prototype.getAllTicksLevel2 = function() {
    var instance = this;
    return $.ajax({
        url: this.web_api_address + "/api/v1/level2",
        type: "GET",
        beforeSend: function (request) {
            _signRequest(this, request, instance.web_api_id, instance.web_api_key, instance.web_api_secret);
        }
    });
};

/**
 * Get feed level2 tick by symbol name
 * @param symbol Symbol name
 * @returns Feed level2 tick with the given symbol
 */
TickTraderWebClient.prototype.getTickLevel2 = function(symbol) {
    var instance = this;
    return $.ajax({
        url: this.web_api_address + "/api/v1/level2/" + encodeURIComponent(encodeURIComponent(symbol)),
        type: "GET",
        beforeSend: function (request) {
            _signRequest(this, request, instance.web_api_id, instance.web_api_key, instance.web_api_secret);
        }
    });
};

/**
 * Get list of all cash account assets (currency with amount)
 * **Works only for cash accounts!**
 * @returns List of all cash account assets
 */
TickTraderWebClient.prototype.getAllAssets = function() {
    var instance = this;
    return $.ajax({
        url: this.web_api_address + "/api/v1/asset",
        type: "GET",
        beforeSend: function (request) {
            _signRequest(this, request, instance.web_api_id, instance.web_api_key, instance.web_api_secret);
        }
    });
};

/**
 * Get cash account asset (currency with amount) by the given currency name
 * **Works only for cash accounts!**
 * @param currency Currency name
 * @returns Cash account asset for the given currency
 */
TickTraderWebClient.prototype.getAsset = function(currency) {
    var instance = this;
    return $.ajax({
        url: this.web_api_address + "/api/v1/asset/" + encodeURIComponent(encodeURIComponent(currency)),
        type: "GET",
        beforeSend: function (request) {
            _signRequest(this, request, instance.web_api_id, instance.web_api_key, instance.web_api_secret);
        }
    });
};

/**
 * Get list of all available positions
 * **Works only for net accounts!**
 * @returns List of all available positions
 */
TickTraderWebClient.prototype.getAllPositions = function() {
    var instance = this;
    return $.ajax({
        url: this.web_api_address + "/api/v1/position",
        type: "GET",
        beforeSend: function (request) {
            _signRequest(this, request, instance.web_api_id, instance.web_api_key, instance.web_api_secret);
        }
    });
};

/**
 * Get position by symbol
 * **Works only for net accounts!**
 * @param symbol Symbol name
 * @returns Position
 */
TickTraderWebClient.prototype.getPosition = function(symbol) {
    var instance = this;
    return $.ajax({
        url: this.web_api_address + "/api/v1/position/" + encodeURIComponent(encodeURIComponent(symbol)),
        type: "GET",
        beforeSend: function (request) {
            _signRequest(this, request, instance.web_api_id, instance.web_api_key, instance.web_api_secret);
        }
    });
};

/**
 * Get list of all available trades
 * @returns List of all available trades
 */
TickTraderWebClient.prototype.getAllTrades = function() {
    var instance = this;
    return $.ajax({
        url: this.web_api_address + "/api/v1/trade",
        type: "GET",
        beforeSend: function (request) {
            _signRequest(this, request, instance.web_api_id, instance.web_api_key, instance.web_api_secret);
        }
    });
};

/**
 * Get trade by symbol
 * @param symbol Symbol name
 * @returns Trade
 */
TickTraderWebClient.prototype.getTrade = function(tradeId) {
    var instance = this;
    return $.ajax({
        url: this.web_api_address + "/api/v1/trade/" + tradeId,
        type: "GET",
        beforeSend: function (request) {
            _signRequest(this, request, instance.web_api_id, instance.web_api_key, instance.web_api_secret);
        }
    });
};

/**
 * Create new trade
 * New trade request is described by the filling following fields:
 * - **ClientId** (optional) - Client trade Id
 * - **Type** (required) - Type of trade. Possible values: `"Market"`, `"Limit"`, `"Stop"`
 * - **Side** (required) - Side of trade. Possible values: `"Buy"`, `"Sell"`
 * - **Symbol** (required) - Trade symbol (e.g. `"EURUSD"`)
 * - **Price** (optional) - Price of the `"Limit"` / `"Stop"` trades (for `Market` trades price field is ignored)
 * - **Amount** (required) - Trade amount
 * - **StopLoss** (optional) - Stop loss price
 * - **TakeProfit** (optional) - Take profit price
 * - **ExpiredTimestamp** (optional) - Expiration date and time for pending trades (`"Limit"`, `"Stop"`)
 * - **ImmediateOrCancel** (optional) - "Immediate or cancel" flag (works only for `"Limit"` trades)
 * - **Comment** (optional) - Client comment
 * @param request Create trade request
 * @returns Created trade
 */
TickTraderWebClient.prototype.createTrade= function(request) {
    var instance = this;
    return $.ajax({
        url: this.web_api_address + "/api/v1/trade",
        type: "POST",
        data: request,
        data: JSON.stringify(request),
        contentType: "application/json; charset=UTF-8",
        beforeSend: function (request) {
            _signRequest(this, request, instance.web_api_id, instance.web_api_key, instance.web_api_secret);
        }
    });
};

/**
 * Modify existing trade
 * Modify trade request is described by the filling following fields:
 * - **Id** (required) - Trade Id
 * - **Price** (optional) - New price of the `Limit` / `Stop` trades (price of `Market` trades cannot be changed)
 * - **StopLoss** (optional) - Stop loss price
 * - **TakeProfit** (optional) - Take profit price
 * - **ExpiredTimestamp** (optional) - Expiration date and time for pending trades (`Limit`, `Stop`)
 * - **Comment** (optional) - Client comment
 * @param request Modify trade request
 * @returns Modified trade
 */
TickTraderWebClient.prototype.modifyTrade= function(request) {
    var instance = this;
    return $.ajax({
        url: this.web_api_address + "/api/v1/trade",
        type: "PUT",
        data: request,
        data: JSON.stringify(request),
        contentType: "application/json; charset=UTF-8",
        beforeSend: function (request) {
            _signRequest(this, request, instance.web_api_id, instance.web_api_key, instance.web_api_secret);
        }
    });
};

/**
 * Cancel existing pending trade
 * @param tradeId Trade Id to cancel
 */
TickTraderWebClient.prototype.cancelTrade= function(tradeId) {
    var instance = this;
    return $.ajax({
        url: this.web_api_address + "/api/v1/trade?type=Cancel&id=" + tradeId,
        type: "DELETE",
        beforeSend: function (request) {
            _signRequest(this, request, instance.web_api_id, instance.web_api_key, instance.web_api_secret);
        }
    });
};

/**
 * Close existing market trade
 * @param tradeId Trade Id to cancel
 * @param amount Amount to close (optional)
 */
TickTraderWebClient.prototype.closeTrade= function(tradeId, amount) {
    var instance = this;
    return $.ajax({
        url: ((amount) ? this.web_api_address + "/api/v1/trade?type=Close&id=" + tradeId + "&amount=" + amount : this.web_api_address + "/api/v1/trade?type=Close&id=" + tradeId),
        type: "DELETE",
        beforeSend: function (request) {
            _signRequest(this, request, instance.web_api_id, instance.web_api_key, instance.web_api_secret);
        }
    });
};

/**
 * Close existing market trade by another one
 * @param tradeId Trade Id to cancel
 * @param byTradeId By trade Id
 */
TickTraderWebClient.prototype.closeByTrade= function(tradeId, byTradeId) {
    var instance = this;
    return $.ajax({
        url: this.web_api_address + "/api/v1/trade?type=CloseBy&id=" + tradeId + "&byid=" + byTradeId,
        type: "DELETE",
        beforeSend: function (request) {
            _signRequest(this, request, instance.web_api_id, instance.web_api_key, instance.web_api_secret);
        }
    });
};

/**
 * Get account trade history
 * New trade history request is described by the filling following fields:
 * - **TimestampFrom** (optional) - Lower timestamp bound of the trade history request
 * - **TimestampTo** (optional) - Upper timestamp bound of the trade history request
 * - **RequestDirection** (optional) - Request paging direction ("Forward" or "Backward"). Default is "Forward".
 * - **RequestFromId** (optional) - Request paging from Id
 *
 * If timestamps fields are not set trade history will be requests from the begin or from the current timestamp
 * depending on **RequestDirection** value.
 *
 * Trade history is returned by chunks by paging size (default is 100). You can provide timestamp bounds (from, to)
 * and direction of access (forward or backward). After the first request you'll get a list of trade history
 * records with Ids. The next request should contain **RequestFromId** with the Id of the last processed trade
 * history record. As the result you'll get the next chunk of trade history records. If the last page was reached
 * response flag **IsLastReport** will be set.
 * @param request Trade history request
 * @returns Trade history report
 */
TickTraderWebClient.prototype.getTradeHistory = function(request) {
    var instance = this;
    return $.ajax({
        url: this.web_api_address + "/api/v1/tradehistory",
        type: "POST",
        data: request,
        data: JSON.stringify(request),
        contentType: "application/json; charset=UTF-8",
        beforeSend: function (request) {
            _signRequest(this, request, instance.web_api_id, instance.web_api_key, instance.web_api_secret);
        }
    });
};

/**
 * Get account trade history for the given trade Id
 * New trade history request is described by the filling following fields:
 * - **TimestampFrom** (optional) - Lower timestamp bound of the trade history request
 * - **TimestampTo** (optional) - Upper timestamp bound of the trade history request
 * - **RequestDirection** (optional) - Request paging direction ("Forward" or "Backward"). Default is "Forward".
 * - **RequestFromId** (optional) - Request paging from Id
 *
 * If timestamps fields are not set trade history will be requests from the begin or from the current timestamp
 * depending on **RequestDirection** value.
 *
 * Trade history is returned by chunks by paging size (default is 100). You can provide timestamp bounds (from, to)
 * and direction of access (forward or backward). After the first request you'll get a list of trade history
 * records with Ids. The next request should contain **RequestFromId** with the Id of the last processed trade
 * history record. As the result you'll get the next chunk of trade history records. If the last page was reached
 * response flag **IsLastReport** will be set.
 * @param tradeId Trade Id
 * @param request Trade history request
 * @returns Trade history report
 */
TickTraderWebClient.prototype.getTradeHistoryByTradeId = function(tradeId, request) {
    var instance = this;
    return $.ajax({
        url: this.web_api_address + "/api/v1/tradehistory/" + tradeId,
        type: "POST",
        data: JSON.stringify(request),
        contentType: "application/json; charset=UTF-8",
        beforeSend: function (request) {
            _signRequest(this, request, instance.web_api_id, instance.web_api_key, instance.web_api_secret);
        }
    });
};


text:
import { assert } from 'chai';
//import { describe, it } from 'mocha';

import * as Uuid from 'node-uuid'

import StringListHandler from '../src/string_list_handler'
import * as config from '../src/certor_config'

// import EtcdDaemon from 'promise-etcd_daemon'

function param(arr: string[], uuid: string) : string[] {
  return arr.concat(['--etcd-cluster-id', uuid, '--etcd-url', "http://localhost:2379"])
}

// function mochaAsync(fn : () => void ) : (done:any) => void {
//     return async (done: () => void) : Promise<any> => {
//         try {
//             await fn();
//             done();
//         } catch (err) {
//             done();
//         }
//         return Promise.resolve()
//     };
// };

describe("StringListHandler", () => {
  // let etcd : EtcdDaemon
  before(() => {
    // etcd = EtcdDaemon.start()
  })
  after(() => {
    // await etcd.kill()
  })
  it("get", async () => {
    let uuid = Uuid.v4().toString();
    let df = new StringListHandler("slh");
    let wc = config.Certor.create(param([], uuid))
    let etcd = await wc.etcd();
    // console.log(uuid)
    assert.deepEqual([], (await df.start(param(['get'], uuid), etcd)).ok.asJson(), "get empty")
    assert.deepEqual(['meno'], (await df.start(param(['add', 'meno'], uuid), etcd)).ok.asJson(), "add Error")
    assert.deepEqual(['meno'], (await df.start(param(['get'], uuid), etcd)).ok.asJson(), "get Error")
  })
  it("add", async () => {
    let uuid = Uuid.v4().toString();
    let df = new StringListHandler("slh");
    let wc = config.Certor.create(param([], uuid))
    let etcd = await wc.etcd();
    assert.deepEqual(['meno'], (await df.start(param(['add', 'meno'], uuid), etcd)).ok.asJson(), "first add Error")
    assert.deepEqual(['meno'], (await df.start(param(['add', 'meno'], uuid), etcd)).ok.asJson(), "second add Error")
    assert.deepEqual(['meno', 'murk'], (await df.start(param(['add', 'murk'], uuid), etcd)).ok.asJson(), "murk add Error")
    assert.deepEqual(['meno', 'murk'], (await df.start(param(['get'], uuid), etcd)).ok.asJson(), "get-x Error")
  })

   it("del", async () => {
    let uuid = Uuid.v4().toString();
    let df = new StringListHandler("slh");
    let wc = config.Certor.create(param([], uuid))
    let etcd = await wc.etcd();
    assert.deepEqual(['meno'], (await df.start(param(['add', 'meno'], uuid), etcd)).ok.asJson(), "first add Error")
    assert.deepEqual(['meno', 'murk'], (await df.start(param(['add', 'murk'], uuid), etcd)).ok.asJson().sort(), "murk add Error")
    assert.deepEqual(['murk'], (await df.start(param(['del', 'meno'], uuid), etcd)).ok.asJson(), "get Error")
    assert.deepEqual([], (await df.start(param(['del', 'murk'], uuid), etcd)).ok.asJson().sort(), "get Error")
    assert.deepEqual([], (await df.start(param(['get'], uuid), etcd)).ok.asJson())
  })
})

//node dist/server.js  domain-filter --etcd-url "https://etcd-1.adviser.com:2381"
//--client-ca cafile --client-cert ../../certs/cetcd.adviser.com/cert.pem
//--client-key ../../certs/cetcd.adviser.com/privkey.pem  --etcd-url
//"https://etcd-2.adviser.com:2381" --etcd-url "https://etcd-3.adviser.com:2381"
//add meno


text:
class ConsumerGenerator < RubiGen::Base

  DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'],
                              Config::CONFIG['ruby_install_name'])

  default_options :author => nil

  attr_reader :name

  def initialize(runtime_args, runtime_options = {})
    super
    usage if args.empty?
    @destination_root = File.expand_path(args.shift)
    @name = base_name
    extract_options
  end

  def manifest
    record do |m|
      # Ensure appropriate folder(s) exists
      m.directory ''
      BASEDIRS.each { |path| m.directory path }

      # Create stubs
      # m.template "template.rb",  "some_file_after_erb.rb"
      # m.template_copy_each ["template.rb", "template2.rb"]
      # m.file     "file",         "some_file_copied"

      m.file_copy_each %w(
        LICENSE
      )

      m.template "config/config.yml", "config/#{@name}.yml"
      m.file "config/config.yml.sample", "config/#{@name}.yml.sample"

      m.template_copy_each %w(
        TODO
        rails/init.rb
        spec/spec_helper.rb
        README.rdoc
        Rakefile
      )

      m.template "lib/base.rb", "lib/#{@name}.rb"
      m.directory "lib/#{@name}"

      m.dependency "install_rubigen_scripts", [destination_root, 'consumer'],
        :shebang => options[:shebang], :collision => :force
    end
  end

  protected
    def banner
      <<-EOS
Creates a ...

USAGE: #{spec.name} name
EOS
    end

    def add_options!(opts)
      opts.separator ''
      opts.separator 'Options:'
      # For each option below, place the default
      # at the top of the file next to "default_options"
      # opts.on("-a", "--author=\"Your Name\"", String,
      #         "Some comment about this option",
      #         "Default: none") { |options[:author]| }
      opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
    end

    def extract_options
      # for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
      # Templates can access these value via the attr_reader-generated methods, but not the
      # raw instance variable value.
      # @author = options[:author]
    end

    # Installation skeleton.  Intermediate directories are automatically
    # created so don't sweat their absence here.
    BASEDIRS = %w(
      lib
      script
      spec
      rails
      spec/xml
      config
    )
end


text:
package org.apache.sling.launchpad.app;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

import org.apache.sling.launchpad.base.shared.SharedConstants;

import junit.framework.TestCase;

public class MainTest extends TestCase {

    @Override
    protected void setUp() throws Exception {
        super.setUp();
        System.setProperty("___sling_dont_exit___", "true");
    }

    public void test_parseCommandLine_null_args() {
        String[] args = null;
        Map<String, String> commandline = Main.parseCommandLine(args);
        assertNotNull("commandline map must not be null", commandline);
        assertTrue("commandline map must be empty", commandline.isEmpty());
    }

    public void test_parseCommandLine_empty_args() {
        String[] args = {};
        Map<String, String> commandline = Main.parseCommandLine(args);
        assertNotNull("commandline map must not be null", commandline);
        assertTrue("commandline map must be empty", commandline.isEmpty());
    }

    public void test_parseCommandLine_single_dash() {
        String[] args = { "-" };
        Map<String, String> commandline = Main.parseCommandLine(args);
        assertNotNull("commandline map must not be null", commandline);
        assertTrue("commandline map must be empty", commandline.isEmpty());
    }

    public void test_parseCommandLine_single_arg_no_par() {
        String[] args = { "-a" };
        Map<String, String> commandline = Main.parseCommandLine(args);
        assertNotNull("commandline map must not be null", commandline);
        assertEquals("commandline map must have one entry", 1,
            commandline.size());
        assertEquals("single argument must be " + args[0].charAt(1),
                String.valueOf(args[0].charAt(1)),
                commandline.keySet().iterator().next());
        assertEquals("single argument value must be " + args[0].charAt(1),
                String.valueOf(args[0].charAt(1)),
                commandline.values().iterator().next());
    }

    public void test_parseCommandLine_single_arg_with_par() {
        String[] args = { "-a", "value" };
        Map<String, String> commandline = Main.parseCommandLine(args);
        assertNotNull("commandline map must not be null", commandline);
        assertEquals("commandline map must have one entry", 1,
            commandline.size());
        assertEquals("single argument must be " + args[0].charAt(1),
            String.valueOf(args[0].charAt(1)),
            commandline.keySet().iterator().next());
        assertEquals("single argument value must be " + args[1], args[1],
            commandline.values().iterator().next());
    }

    public void test_parseCommandLine_two_args_no_par() {
        String[] args = { "-a", "-b" };
        Map<String, String> commandline = Main.parseCommandLine(args);
        assertNotNull("commandline map must not be null", commandline);
        assertEquals("commandline map must have two entries", 2,
            commandline.size());
        assertEquals("argument a must a", "a", commandline.get("a"));
        assertEquals("argument b must b", "b", commandline.get("b"));
    }

    public void test_parseCommandLine_two_args_first_par() {
        String[] args = { "-a", "apar", "-b" };
        Map<String, String> commandline = Main.parseCommandLine(args);
        assertNotNull("commandline map must not be null", commandline);
        assertEquals("commandline map must have two entries", 2,
            commandline.size());
        assertEquals("argument a must apar", "apar", commandline.get("a"));
        assertEquals("argument b must b", "b", commandline.get("b"));
    }

    public void test_parseCommandLine_two_args_second_par() {
        String[] args = { "-a", "-b", "bpar" };
        Map<String, String> commandline = Main.parseCommandLine(args);
        assertNotNull("commandline map must not be null", commandline);
        assertEquals("commandline map must have two entries", 2,
            commandline.size());
        assertEquals("argument a must a", "a", commandline.get("a"));
        assertEquals("argument b must bpar", "bpar", commandline.get("b"));
    }

    public void test_parseCommandLine_two_args_all_par() {
        String[] args = { "-a", "apar", "-b", "bpar" };
        Map<String, String> commandline = Main.parseCommandLine(args);
        assertNotNull("commandline map must not be null", commandline);
        assertEquals("commandline map must have two entries", 2,
            commandline.size());
        assertEquals("argument a must apar", "apar", commandline.get("a"));
        assertEquals("argument b must bpar", "bpar", commandline.get("b"));
    }

    public void test_parseCommandLine_three_args_with_dash() {
        String[] args = { "-a", "apar", "-", "-b", "bpar" };
        Map<String, String> commandline = Main.parseCommandLine(args);
        assertNotNull("commandline map must not be null", commandline);
        assertEquals("commandline map must have three entries", 3,
                commandline.size());
        assertEquals("argument a must apar", "apar", commandline.get("a"));
        assertEquals("argument -b must -b", "-b", commandline.get("-b"));
        assertEquals("argument bpar must bpar", "bpar", commandline.get("bpar"));
    }

    public void test_parseCommandLine_single_arg_with_dash_par() {
        String[] args = { "-a", "-" };
        Map<String, String> commandline = Main.parseCommandLine(args);
        assertNotNull("commandline map must not be null", commandline);
        assertEquals("commandline map must have three entries", 1,
            commandline.size());
        assertEquals("argument a must -", "-", commandline.get("a"));
    }

    public void test_convertCommandLineArgs_no_args() {
        Map<String, String> props = Main.convertCommandLineArgs(new HashMap<String, String>());
        assertNotNull(props);
        assertTrue(props.isEmpty());
    }

    public void test_converCommandLineArgs_unknown() {
        assertNull(Main.convertCommandLineArgs(Collections.singletonMap("u", "short")));
        assertNull(Main.convertCommandLineArgs(Collections.singletonMap("longer", "long")));
    }

    public void test_converCommandLineArgs_j_start_stop_status() {
        Map<String, String> props = Main.convertCommandLineArgs(Collections.singletonMap("j", "j"));
        assertNull(props);

        Map<String, String> props1 = Main.convertCommandLineArgs(Collections.singletonMap("j", "host:port"));
        assertNotNull(props1);
        assertEquals(1, props1.size());
        assertEquals("host:port", props1.get("sling.control.socket"));

        Map<String, String> propsStart = Main.convertCommandLineArgs(Collections.singletonMap("start", "start"));
        assertNotNull(propsStart);
        assertEquals(1, propsStart.size());
        assertEquals("start", propsStart.get("sling.control.action"));

        Map<String, String> propsStatus = Main.convertCommandLineArgs(Collections.singletonMap("status", "status"));
        assertNotNull(propsStatus);
        assertEquals(1, propsStatus.size());
        assertEquals("status", propsStatus.get("sling.control.action"));

        Map<String, String> propsStop = Main.convertCommandLineArgs(Collections.singletonMap("stop", "stop"));
        assertNotNull(propsStop);
        assertEquals(1, propsStop.size());
        assertEquals("stop", propsStop.get("sling.control.action"));
    }

    public void test_converCommandLineArgs_l() {
        Map<String, String> props = Main.convertCommandLineArgs(Collections.singletonMap("l", "INFO"));
        assertNotNull(props);
        assertEquals(1, props.size());
        assertEquals("INFO", props.get("org.apache.sling.commons.log.level"));

        Map<String, String> props2 = Main.convertCommandLineArgs(Collections.singletonMap("l", "l"));
        assertNull(props2);
    }

    public void test_converCommandLineArgs_f() {
        Map<String, String> props = Main.convertCommandLineArgs(Collections.singletonMap("f", "sling.changed"));
        assertNotNull(props);
        assertEquals(1, props.size());
        assertEquals("sling.changed", props.get("org.apache.sling.commons.log.file"));

        Map<String, String> props1 = Main.convertCommandLineArgs(Collections.singletonMap("f", "-"));
        assertNotNull(props1);
        assertEquals(1, props1.size());
        assertEquals("", props1.get("org.apache.sling.commons.log.file"));

        Map<String, String> props2 = Main.convertCommandLineArgs(Collections.singletonMap("f", "f"));
        assertNull(props2);
    }

    public void test_converCommandLineArgs_c() {
        Map<String, String> props = Main.convertCommandLineArgs(Collections.singletonMap("c", "sling.changed"));
        assertNotNull(props);
        assertEquals(1, props.size());
        assertEquals("sling.changed", props.get(SharedConstants.SLING_HOME));

        Map<String, String> props2 = Main.convertCommandLineArgs(Collections.singletonMap("c", "c"));
        assertNull(props2);
    }

    public void test_converCommandLineArgs_i() {
        Map<String, String> props = Main.convertCommandLineArgs(Collections.singletonMap("i", "launchpad"));
        assertNotNull(props);
        assertEquals(1, props.size());
        assertEquals("launchpad", props.get(SharedConstants.SLING_LAUNCHPAD));

        Map<String, String> props2 = Main.convertCommandLineArgs(Collections.singletonMap("i", "i"));
        assertNull(props2);
    }

    public void test_converCommandLineArgs_a() {
        Map<String, String> props = Main.convertCommandLineArgs(Collections.singletonMap("a", "0.0.0.0"));
        assertNotNull(props);
        assertEquals(1, props.size());
        assertEquals("0.0.0.0", props.get("org.apache.felix.http.host"));
    }

    public void test_converCommandLineArgs_r() {
        Map<String, String> props = Main.convertCommandLineArgs(Collections.singletonMap("r", "/mycontext"));
        assertNotNull(props);
        assertEquals(1, props.size());
        assertEquals("/mycontext", props.get("org.apache.felix.http.context_path"));
    }

    public void test_converCommandLineArgs_p() {
        Map<String, String> props = Main.convertCommandLineArgs(Collections.singletonMap("p", "1234"));
        assertNotNull(props);
        assertEquals(1, props.size());
        assertEquals("1234", props.get("org.osgi.service.http.port"));

        Map<String, String> props1 = Main.convertCommandLineArgs(Collections.singletonMap("p", "abc"));
        assertNull(props1);

        Map<String, String> props2 = Main.convertCommandLineArgs(Collections.singletonMap("p", "p"));
        assertNull(props2);
    }

    public void test_converCommandLineArgs_n() {
        Map<String, String> props = Main.convertCommandLineArgs(Collections.singletonMap("n", "n"));
        assertNotNull(props);
        assertEquals(1, props.size());
        assertEquals(Boolean.FALSE.toString(), props.get("sling.shutdown.hook"));

        Map<String, String> props1 = Main.convertCommandLineArgs(Collections.singletonMap("D", "sling.shutdown.hook=" + Boolean.TRUE.toString()));
        assertNotNull(props1);
        assertEquals(1, props1.size());
        assertEquals(Boolean.TRUE.toString(), props1.get("sling.shutdown.hook"));
    }

    public void test_converCommandLineArgs_multi_D() {
        String[] args = {"-Da1=b1", "-Da2=b2"};
        Map<String, String> commandline = Main.parseCommandLine(args);
        Map<String, String> props = Main.convertCommandLineArgs(commandline);
        assertEquals(2, props.size());
        assertEquals("b1", props.get("a1"));
        assertEquals("b2", props.get("a2"));
    }

    public void test_converCommandLineArgs_multi_D_with_space() {
        String[] args = {"-D", "a1=b1", "-D", "a2=b2"};
        Map<String, String> commandline = Main.parseCommandLine(args);
        Map<String, String> props = Main.convertCommandLineArgs(commandline);
        assertEquals(2, props.size());
        assertEquals("b1", props.get("a1"));
        assertEquals("b2", props.get("a2"));
    }

    public void test_converCommandLineArgs_D() {
        Map<String, String> props = Main.convertCommandLineArgs(Collections.singletonMap("D", "name=value"));
        assertNotNull(props);
        assertEquals(1, props.size());
        assertEquals("value", props.get("name"));

        Map<String, String> props2 = Main.convertCommandLineArgs(Collections.singletonMap("D", "flag"));
        assertNotNull(props2);
        assertEquals(1, props2.size());
        assertEquals("flag", props2.get("flag"));

        Map<String, String> props1 = Main.convertCommandLineArgs(Collections.singletonMap("D", "D"));
        assertNull(props1);
    }

    public void test_installShutdownHook() throws SecurityException, NoSuchMethodException, IllegalArgumentException,
            IllegalAccessException, InvocationTargetException {
        final Method m = Main.class.getDeclaredMethod("installShutdownHook", Map.class);
        m.setAccessible(true);

        final String key = "sling.shutdown.hook";
        System.getProperties().remove(key);

        TestCase.assertEquals(Boolean.TRUE, m.invoke(null, new HashMap<String, String>()));
        TestCase.assertEquals(Boolean.TRUE, m.invoke(null, new HashMap<String, String>(Collections.singletonMap(key, "true"))));
        TestCase.assertEquals(Boolean.TRUE, m.invoke(null, new HashMap<String, String>(Collections.singletonMap(key, "TRUE"))));
        TestCase.assertEquals(Boolean.FALSE, m.invoke(null, new HashMap<String, String>(Collections.singletonMap(key, "false"))));
        TestCase.assertEquals(Boolean.FALSE, m.invoke(null, new HashMap<String, String>(Collections.singletonMap(key, "not true"))));

        System.setProperty(key, "true");
        TestCase.assertEquals(Boolean.TRUE, m.invoke(null, new HashMap<String, String>()));
        System.setProperty(key, "TRUE");
        TestCase.assertEquals(Boolean.TRUE, m.invoke(null, new HashMap<String, String>()));
        System.setProperty(key, "false");
        TestCase.assertEquals(Boolean.FALSE, m.invoke(null, new HashMap<String, String>()));
        System.setProperty(key, "not true");
        TestCase.assertEquals(Boolean.FALSE, m.invoke(null, new HashMap<String, String>()));

        System.setProperty(key, "true");
        TestCase.assertEquals(Boolean.TRUE, m.invoke(null, new HashMap<String, String>(Collections.singletonMap(key, "true"))));
        TestCase.assertEquals(Boolean.TRUE, m.invoke(null, new HashMap<String, String>(Collections.singletonMap(key, "TRUE"))));
        TestCase.assertEquals(Boolean.FALSE, m.invoke(null, new HashMap<String, String>(Collections.singletonMap(key, "false"))));
        TestCase.assertEquals(Boolean.FALSE, m.invoke(null, new HashMap<String, String>(Collections.singletonMap(key, "not true"))));

        System.setProperty(key, "false");
        TestCase.assertEquals(Boolean.TRUE, m.invoke(null, new HashMap<String, String>(Collections.singletonMap(key, "true"))));
        TestCase.assertEquals(Boolean.TRUE, m.invoke(null, new HashMap<String, String>(Collections.singletonMap(key, "TRUE"))));
        TestCase.assertEquals(Boolean.FALSE, m.invoke(null, new HashMap<String, String>(Collections.singletonMap(key, "false"))));
        TestCase.assertEquals(Boolean.FALSE, m.invoke(null, new HashMap<String, String>(Collections.singletonMap(key, "not true"))));
    }
}


text:
<?php

class Info_SitemapController extends Pas_Controller_Action_Admin {

    /** Set up acl, display with no layout
     * @access public
     * @return void
    */
    public function init() {
        $this->_helper->_acl->allow(null);
        $this->_helper->layout->disableLayout();
        $this->getResponse()->setHeader('Content-type', 'application/xml');
        ini_set("memory_limit", "256M");
    }

    /** The default action - show the home page
     * @access public
     * @return void
     */
    public function indexAction() {
        $config = new Zend_Config_Xml('http://finds.org.uk/info/sitemap/configuration/','nav');
        $navigation = new Zend_Navigation($config);
        $this->view->navigation($navigation);
        $this->view->navigation()
                ->sitemap()
                ->setFormatOutput(true); // default is false
    }
    /** Show the locational XML
     * @access public
     * @return void
     */
    public function locationsAction() {
        $config = new Zend_Config_Xml('http://finds.org.uk/info/sitemap/databaseconfig','locations');
        $navigation = new Zend_Navigation($config);
        $this->view->navigation($navigation);
        $this->view->navigation()
                ->sitemap()
                ->setFormatOutput(true); // default is false
    }

    /** The image locations xml file
     * @access public
     * @return void
     */
    public function imagelocationsAction() {
        $config = new Zend_Config_Xml('http://finds.org.uk/info/sitemap/imageconfig','locations');
        $navigation = new Zend_Navigation($config);
        $this->view->navigation($navigation);
        $this->view->navigation()
                ->sitemap()
                ->setFormatOutput(true); // default is false
    }

    /** The book locations xml file
     * @access public
     * @return void
     */
    public function booklocationsAction() {
        $config = new Zend_Config_Xml('http://finds.org.uk/info/sitemap/bookconfig','locations');
        $navigation = new Zend_Navigation($config);
        $this->view->navigation($navigation);
        $this->view->navigation()
                ->sitemap()
                ->setFormatOutput(true); // default is false
    }

    /** The database config file
     * @access public
     * @return void
     */
    public function databaseconfigAction(){
        //Magic in view
    }

    /** The image config file
     * @access public
     * @return void
     */
    public function imageconfigAction(){
        //Magic in view
    }

    /** The book config file
     * @access public
     * @return void
     */
    public function bookconfigAction(){
        //Magic in view
    }

    /** The database records xml file
     * @access public
     * @return void
     */
    public function databaserecordsAction(){
        //Magic in view
    }

    /** The images config file
     * @access public
     * @return void
     */
    public function imagesAction(){
        //Magic in view
    }

    /** The books location
     * @access public
     * @return void
     */
    public function booksAction(){
        //Magic in view
    }

    /** The configuration
     * @access public
     * @return void
     */
    public function configurationAction() {
        $content = new Content();
        $this->view->conservation = $content->getConservationNotes();
        $this->view->treasure = $content->getTreasureContent();
        $denoms = new Denominations();
        $this->view->romanDenoms = $denoms->getDenominationsSitemap('21');
        $this->view->ironageDenoms = $denoms->getDenominationsSitemap('16');
        $this->view->earlymedDenoms = $denoms->getDenominationsSitemap('47');
        $this->view->medievalDenoms = $denoms->getDenominationsSitemap('29');
        $this->view->byzantineDenoms = $denoms->getDenominationsSitemap('67');
        $this->view->greekDenoms = $denoms->getDenominationsSitemap('66');
        $this->view->postMedDenoms = $denoms->getDenominationsSitemap('36');
        $emperors = new Emperors();
        $this->view->emperors = $emperors->getEmperorsSiteMap();
        $rulers = new Rulers();
        $this->view->medrulers = $rulers->getMedievalRulersList();
        $this->view->earlymedrulers = $rulers->getEarlyMedievalRulersList();
        $this->view->postmedrulers = $rulers->getPostMedievalRulersList();
        $this->view->ironagerulers = $rulers->getIARulersList();
        $this->view->byzantinerulers = $rulers->getByzRulersList();
        $this->view->greekrulers = $rulers->getGreekRulersList();
        $mints = new Mints();
        $this->view->romanMints = $mints->getMintsSiteMap(21);
        $this->view->ironageMints = $mints->getMintsSiteMap(16);
        $this->view->byzantineMints = $mints->getMintsSiteMap(67);
        $this->view->earlymedMints = $mints->getMintsSiteMap(47);
        $this->view->medMints = $mints->getMintsSiteMap(29);
        $this->view->postmedMints = $mints->getMintsSiteMap(36);
        $this->view->greekMints = $mints->getMintsSiteMap(66);
        $reeces = new Reeces();
        $this->view->reeces = $reeces->getSiteMap();
        $types = new MedievalTypes();
        $this->view->medtypes = $types->getTypesSiteMap(29);
        $this->view->postmedtypes = $types->getTypesSiteMap(36);
        $this->view->earlymedtypes = $types->getTypesSiteMap(47);
        $cats = new CategoriesCoins();
        $this->view->medcats = $cats->getCatsSiteMap(29);
        $this->view->earlymedcats = $cats->getCatsSiteMap(47);
        $this->view->postmedcats = $cats->getCatsSiteMap(36);
        $tribes = new Tribes();
        $this->view->tribes = $tribes->getSitemap();
        $news = new News();
        $this->view->news = $news->getSitemapNews();
    }
}


text:
class ScheduledReportingSummary
  def call
    Provider.all.each do |organisation|
      ReportingSummary.create!(
        organisation: organisation.name,
        two_week_availability: two_week_available?(organisation.id),
        four_week_availability: four_week_available?(organisation.id),
        first_available_slot_on: first_available_slot_on(organisation.id)
      )
    end
  end

  def two_week_available?(organisation_id)
    slot = first_available_slot_on(organisation_id)

    return false unless slot

    slot <= two_week_period
  end

  def four_week_available?(organisation_id)
    slot = first_available_slot_on(organisation_id)

    return false unless slot

    slot <= four_week_period
  end

  def first_available_slot_on(organisation_id)
    windowed_bookable_slots(organisation_id).first
  end

  private

  def two_week_period
    BusinessDays.from_now(10)
  end

  def four_week_period
    BusinessDays.from_now(20)
  end

  def windowed_bookable_slots(organisation_id)
    BookableSlot.grouped(organisation_id).map(&:first)
  end
end


text:
module Aptimizer
  module AtkGraph
    class Vertex
      attr_accessor :parents, :value, :children

      def initialize(value)
        @value    = value
        @parents  = []
        @children = []
      end

      def leaf?
        @parents.empty?
      end

      def dominated?
        !leaf? && @parents.all?(&:leaf?)
      end

      def ==(o)
        @value == o.value
      end

      def eql?(o)
        self == o
      end
    end
  end
end


text:
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>W29820_text</title>
        <link rel="stylesheet" type="text/css" href="style.css" />

                «

    <p class="styleSans9.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">FORMATION TOPS: CHARLES TO MIDDLE BAKKEN

    <p class="styleSans9.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">30' SAMPLES THROUGH VERTICAL AND CURVE. 100' SAMPLES THROUGH LATERAL.

    <p class="styleSans143.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">

-E7291 -5214 Charles Salt 8116 Shale

Middle Bakken 9219 93 95 Member

    <p class="styleSans4.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Boost.Geometry (aka GGL, Generic Geometry Library)</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">

Main Page

Related Pages

Modules

Namespaces

Classes

Files

Examples

Classes

iterators: iterators

Classes

struct  	boost::geometry::closing_iterator< Range >

 	Iterator which iterates through a range, but adds first element at end of the range.  More...

struct  	boost::geometry::ever_circling_iterator< Iterator >

 	Iterator which ever circles through a range.  More...

Detailed Description

April 2, 2011

Copyright © 2007-2011 Barend Gehrels, Amsterdam, the Netherlands

Copyright © 2008-2011 Bruno Lalande, Paris, France

Copyright © 2009-2010 Mateusz Loskot, London, UK

<address style="text-align: right;">
Documentation is generated by Doxygen
</address>


text:
package org.killbill.billing.overdue.api;

import java.math.BigDecimal;

import org.killbill.billing.catalog.api.Duration;
import org.killbill.billing.payment.api.PaymentResponse;
import org.killbill.billing.util.tag.ControlTagType;

public interface OverdueCondition {

    public Integer getNumberOfUnpaidInvoicesEqualsOrExceeds();

    public BigDecimal getTotalUnpaidInvoiceBalanceEqualsOrExceeds();

    public Duration getTimeSinceEarliestUnpaidInvoiceEqualsOrExceeds();

    public PaymentResponse [] getResponseForLastFailedPaymentIn();

    public ControlTagType getInclusionControlTagType();

    public ControlTagType getExclusionControlTagType();
}