text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>NavigableSet (Java Platform SE 8 )</title>
<meta name="date" content="2014-12-17">
<meta name="keywords" content="java.util.NavigableSet interface">
<meta name="keywords" content="lower()">
<meta name="keywords" content="floor()">
<meta name="keywords" content="ceiling()">
<meta name="keywords" content="higher()">
<meta name="keywords" content="pollFirst()">
<meta name="keywords" content="pollLast()">
<meta name="keywords" content="iterator()">
<meta name="keywords" content="descendingSet()">
<meta name="keywords" content="descendingIterator()">
<meta name="keywords" content="subSet()">
<meta name="keywords" content="headSet()">
<meta name="keywords" content="tailSet()">
<link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Java™ Platform
Standard Ed. 8

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

compact1, compact2, compact3

java.util

Interface NavigableSet<E>

Type Parameters:

E - the type of elements maintained by this set

All Superinterfaces:

Collection<E>, Iterable<E>, Set<E>, SortedSet<E>

All Known Implementing Classes:

ConcurrentSkipListSet, TreeSet

public interface NavigableSet<E>
extends SortedSet<E>

A SortedSet extended with navigation methods reporting
 closest matches for given search targets. Methods lower,
 floor, ceiling, and higher return elements
 respectively less than, less than or equal, greater than or equal,
 and greater than a given element, returning null if there
 is no such element.  A NavigableSet may be accessed and
 traversed in either ascending or descending order.  The descendingSet method returns a view of the set with the senses of
 all relational and directional methods inverted. The performance of
 ascending operations and views is likely to be faster than that of
 descending ones.  This interface additionally defines methods
 pollFirst and pollLast that return and remove the
 lowest and highest element, if one exists, else returning null.  Methods subSet, headSet,
 and tailSet differ from the like-named SortedSet methods in accepting additional arguments describing
 whether lower and upper bounds are inclusive versus exclusive.
 Subsets of any NavigableSet must implement the NavigableSet interface.

 The return values of navigation methods may be ambiguous in
 implementations that permit null elements. However, even
 in this case the result can be disambiguated by checking
 contains(null). To avoid such issues, implementations of
 this interface are encouraged to not permit insertion of
 null elements. (Note that sorted sets of Comparable elements intrinsically do not permit null.)

Methods
 subSet(E, E),
 headSet(E), and
 tailSet(E)
 are specified to return SortedSet to allow existing
 implementations of SortedSet to be compatibly retrofitted to
 implement NavigableSet, but extensions and implementations
 of this interface are encouraged to override these methods to return
 NavigableSet.

This interface is a member of the

 Java Collections Framework.

Since:

1.6

Method Summary

All Methods Instance Methods Abstract Methods

Modifier and Type
Method and Description

E
ceiling(E e)

Returns the least element in this set greater than or equal to
 the given element, or null if there is no such element.

Iterator<E>
descendingIterator()

Returns an iterator over the elements in this set, in descending order.

NavigableSet<E>
descendingSet()

Returns a reverse order view of the elements contained in this set.

E
floor(E e)

Returns the greatest element in this set less than or equal to
 the given element, or null if there is no such element.

SortedSet<E>
headSet(E toElement)

Returns a view of the portion of this set whose elements are
 strictly less than <tt>toElement</tt>.

NavigableSet<E>
headSet(E toElement,
       boolean inclusive)

Returns a view of the portion of this set whose elements are less than
 (or equal to, if inclusive is true) toElement.

E
higher(E e)

Returns the least element in this set strictly greater than the
 given element, or null if there is no such element.

Iterator<E>
iterator()

Returns an iterator over the elements in this set, in ascending order.

E
lower(E e)

Returns the greatest element in this set strictly less than the
 given element, or null if there is no such element.

E
pollFirst()

Retrieves and removes the first (lowest) element,
 or returns null if this set is empty.

E
pollLast()

Retrieves and removes the last (highest) element,
 or returns null if this set is empty.

NavigableSet<E>
subSet(E fromElement,
      boolean fromInclusive,
      E toElement,
      boolean toInclusive)

Returns a view of the portion of this set whose elements range from
 fromElement to toElement.

SortedSet<E>
subSet(E fromElement,
      E toElement)

Returns a view of the portion of this set whose elements range
 from <tt>fromElement</tt>, inclusive, to <tt>toElement</tt>,
 exclusive.

SortedSet<E>
tailSet(E fromElement)

Returns a view of the portion of this set whose elements are
 greater than or equal to <tt>fromElement</tt>.

NavigableSet<E>
tailSet(E fromElement,
       boolean inclusive)

Returns a view of the portion of this set whose elements are greater
 than (or equal to, if inclusive is true) fromElement.

Methods inherited from interface java.util.SortedSet

comparator, first, last, spliterator

Methods inherited from interface java.util.Set

add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, size, toArray, toArray

Methods inherited from interface java.util.Collection

parallelStream, removeIf, stream

Methods inherited from interface java.lang.Iterable

forEach

Method Detail

lower

E lower(E e)

Returns the greatest element in this set strictly less than the
 given element, or null if there is no such element.

Parameters:

e - the value to match

Returns:

the greatest element less than e,
         or null if there is no such element

Throws:

ClassCastException - if the specified element cannot be
         compared with the elements currently in the set

NullPointerException - if the specified element is null
         and this set does not permit null elements

floor

E floor(E e)

Returns the greatest element in this set less than or equal to
 the given element, or null if there is no such element.

Parameters:

e - the value to match

Returns:

the greatest element less than or equal to e,
         or null if there is no such element

Throws:

ClassCastException - if the specified element cannot be
         compared with the elements currently in the set

NullPointerException - if the specified element is null
         and this set does not permit null elements

ceiling

E ceiling(E e)

Returns the least element in this set greater than or equal to
 the given element, or null if there is no such element.

Parameters:

e - the value to match

Returns:

the least element greater than or equal to e,
         or null if there is no such element

Throws:

ClassCastException - if the specified element cannot be
         compared with the elements currently in the set

NullPointerException - if the specified element is null
         and this set does not permit null elements

higher

E higher(E e)

Returns the least element in this set strictly greater than the
 given element, or null if there is no such element.

Parameters:

e - the value to match

Returns:

the least element greater than e,
         or null if there is no such element

Throws:

ClassCastException - if the specified element cannot be
         compared with the elements currently in the set

NullPointerException - if the specified element is null
         and this set does not permit null elements

pollFirst

E pollFirst()

Retrieves and removes the first (lowest) element,
 or returns null if this set is empty.

Returns:

the first element, or null if this set is empty

pollLast

E pollLast()

Retrieves and removes the last (highest) element,
 or returns null if this set is empty.

Returns:

the last element, or null if this set is empty

iterator

Iterator<E> iterator()

Returns an iterator over the elements in this set, in ascending order.

Specified by:

iterator in interface Collection<E>

Specified by:

iterator in interface Iterable<E>

Specified by:

iterator in interface Set<E>

Returns:

an iterator over the elements in this set, in ascending order

descendingSet

NavigableSet<E> descendingSet()

Returns a reverse order view of the elements contained in this set.
 The descending set is backed by this set, so changes to the set are
 reflected in the descending set, and vice-versa.  If either set is
 modified while an iteration over either set is in progress (except
 through the iterator's own remove operation), the results of
 the iteration are undefined.

The returned set has an ordering equivalent to
 <tt>Collections.reverseOrder(comparator())</tt>.
 The expression s.descendingSet().descendingSet() returns a
 view of s essentially equivalent to s.

Returns:

a reverse order view of this set

descendingIterator

Iterator<E> descendingIterator()

Returns an iterator over the elements in this set, in descending order.
 Equivalent in effect to descendingSet().iterator().

Returns:

an iterator over the elements in this set, in descending order

subSet

NavigableSet<E> subSet(E fromElement,
                       boolean fromInclusive,
                       E toElement,
                       boolean toInclusive)

Returns a view of the portion of this set whose elements range from
 fromElement to toElement.  If fromElement and
 toElement are equal, the returned set is empty unless fromInclusive and toInclusive are both true.  The returned set
 is backed by this set, so changes in the returned set are reflected in
 this set, and vice-versa.  The returned set supports all optional set
 operations that this set supports.

The returned set will throw an IllegalArgumentException
 on an attempt to insert an element outside its range.

Parameters:

fromElement - low endpoint of the returned set

fromInclusive - true if the low endpoint
        is to be included in the returned view

toElement - high endpoint of the returned set

toInclusive - true if the high endpoint
        is to be included in the returned view

Returns:

a view of the portion of this set whose elements range from
         fromElement, inclusive, to toElement, exclusive

Throws:

ClassCastException - if fromElement and
         toElement cannot be compared to one another using this
         set's comparator (or, if the set has no comparator, using
         natural ordering).  Implementations may, but are not required
         to, throw this exception if fromElement or
         toElement cannot be compared to elements currently in
         the set.

NullPointerException - if fromElement or
         toElement is null and this set does
         not permit null elements

IllegalArgumentException - if fromElement is
         greater than toElement; or if this set itself
         has a restricted range, and fromElement or
         toElement lies outside the bounds of the range.

headSet

NavigableSet<E> headSet(E toElement,
                        boolean inclusive)

Returns a view of the portion of this set whose elements are less than
 (or equal to, if inclusive is true) toElement.  The
 returned set is backed by this set, so changes in the returned set are
 reflected in this set, and vice-versa.  The returned set supports all
 optional set operations that this set supports.

The returned set will throw an IllegalArgumentException
 on an attempt to insert an element outside its range.

Parameters:

toElement - high endpoint of the returned set

inclusive - true if the high endpoint
        is to be included in the returned view

Returns:

a view of the portion of this set whose elements are less than
         (or equal to, if inclusive is true) toElement

Throws:

ClassCastException - if toElement is not compatible
         with this set's comparator (or, if the set has no comparator,
         if toElement does not implement Comparable).
         Implementations may, but are not required to, throw this
         exception if toElement cannot be compared to elements
         currently in the set.

NullPointerException - if toElement is null and
         this set does not permit null elements

IllegalArgumentException - if this set itself has a
         restricted range, and toElement lies outside the
         bounds of the range

tailSet

NavigableSet<E> tailSet(E fromElement,
                        boolean inclusive)

Returns a view of the portion of this set whose elements are greater
 than (or equal to, if inclusive is true) fromElement.
 The returned set is backed by this set, so changes in the returned set
 are reflected in this set, and vice-versa.  The returned set supports
 all optional set operations that this set supports.

The returned set will throw an IllegalArgumentException
 on an attempt to insert an element outside its range.

Parameters:

fromElement - low endpoint of the returned set

inclusive - true if the low endpoint
        is to be included in the returned view

Returns:

a view of the portion of this set whose elements are greater
         than or equal to fromElement

Throws:

ClassCastException - if fromElement is not compatible
         with this set's comparator (or, if the set has no comparator,
         if fromElement does not implement Comparable).
         Implementations may, but are not required to, throw this
         exception if fromElement cannot be compared to elements
         currently in the set.

NullPointerException - if fromElement is null
         and this set does not permit null elements

IllegalArgumentException - if this set itself has a
         restricted range, and fromElement lies outside the
         bounds of the range

subSet

SortedSet<E> subSet(E fromElement,
                    E toElement)

Returns a view of the portion of this set whose elements range
 from <tt>fromElement</tt>, inclusive, to <tt>toElement</tt>,
 exclusive.  (If <tt>fromElement</tt> and <tt>toElement</tt> are
 equal, the returned set is empty.)  The returned set is backed
 by this set, so changes in the returned set are reflected in
 this set, and vice-versa.  The returned set supports all
 optional set operations that this set supports.

The returned set will throw an <tt>IllegalArgumentException</tt>
 on an attempt to insert an element outside its range.

Equivalent to subSet(fromElement, true, toElement, false).

Specified by:

subSet in interface SortedSet<E>

Parameters:

fromElement - low endpoint (inclusive) of the returned set

toElement - high endpoint (exclusive) of the returned set

Returns:

a view of the portion of this set whose elements range from
         <tt>fromElement</tt>, inclusive, to <tt>toElement</tt>, exclusive

Throws:

ClassCastException - if <tt>fromElement</tt> and
         <tt>toElement</tt> cannot be compared to one another using this
         set's comparator (or, if the set has no comparator, using
         natural ordering).  Implementations may, but are not required
         to, throw this exception if <tt>fromElement</tt> or
         <tt>toElement</tt> cannot be compared to elements currently in
         the set.

NullPointerException - if <tt>fromElement</tt> or
         <tt>toElement</tt> is null and this set does not permit null
         elements

IllegalArgumentException - if <tt>fromElement</tt> is
         greater than <tt>toElement</tt>; or if this set itself
         has a restricted range, and <tt>fromElement</tt> or
         <tt>toElement</tt> lies outside the bounds of the range

headSet

SortedSet<E> headSet(E toElement)

Returns a view of the portion of this set whose elements are
 strictly less than <tt>toElement</tt>.  The returned set is
 backed by this set, so changes in the returned set are
 reflected in this set, and vice-versa.  The returned set
 supports all optional set operations that this set supports.

The returned set will throw an <tt>IllegalArgumentException</tt>
 on an attempt to insert an element outside its range.

Equivalent to headSet(toElement, false).

Specified by:

headSet in interface SortedSet<E>

Parameters:

toElement - high endpoint (exclusive) of the returned set

Returns:

a view of the portion of this set whose elements are strictly
         less than <tt>toElement</tt>

Throws:

ClassCastException - if <tt>toElement</tt> is not compatible
         with this set's comparator (or, if the set has no comparator,
         if <tt>toElement</tt> does not implement Comparable).
         Implementations may, but are not required to, throw this
         exception if <tt>toElement</tt> cannot be compared to elements
         currently in the set.

NullPointerException - if <tt>toElement</tt> is null and
         this set does not permit null elements

IllegalArgumentException - if this set itself has a
         restricted range, and <tt>toElement</tt> lies outside the
         bounds of the range

tailSet

SortedSet<E> tailSet(E fromElement)

Returns a view of the portion of this set whose elements are
 greater than or equal to <tt>fromElement</tt>.  The returned
 set is backed by this set, so changes in the returned set are
 reflected in this set, and vice-versa.  The returned set
 supports all optional set operations that this set supports.

The returned set will throw an <tt>IllegalArgumentException</tt>
 on an attempt to insert an element outside its range.

Equivalent to tailSet(fromElement, true).

Specified by:

tailSet in interface SortedSet<E>

Parameters:

fromElement - low endpoint (inclusive) of the returned set

Returns:

a view of the portion of this set whose elements are greater
         than or equal to <tt>fromElement</tt>

Throws:

ClassCastException - if <tt>fromElement</tt> is not compatible
         with this set's comparator (or, if the set has no comparator,
         if <tt>fromElement</tt> does not implement Comparable).
         Implementations may, but are not required to, throw this
         exception if <tt>fromElement</tt> cannot be compared to elements
         currently in the set.

NullPointerException - if <tt>fromElement</tt> is null
         and this set does not permit null elements

IllegalArgumentException - if this set itself has a
         restricted range, and <tt>fromElement</tt> lies outside the
         bounds of the range

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Java™ Platform
Standard Ed. 8

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

 Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
 Copyright © 1993, 2015, Oracle and/or its affiliates.  All rights reserved.


text:
package com.netflix.spinnaker.kork.jedis;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.URI;
import java.net.URISyntaxException;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.util.Pool;
import redis.embedded.RedisServer;

public class EmbeddedRedis implements AutoCloseable {

  private final URI connection;
  private final RedisServer redisServer;

  private Pool<Jedis> jedis;

  private EmbeddedRedis(int port) throws IOException, URISyntaxException {
    this.connection = URI.create(String.format("redis://127.0.0.1:%d/0", port));
    this.redisServer =
        RedisServer.builder()
            .port(port)
            .setting("bind 127.0.0.1")
            .setting("appendonly no")
            .setting("save \"\"")
            .setting("databases 1")
            .build();
    this.redisServer.start();
  }

  @Override
  public void close() {
    destroy();
  }

  public void destroy() {
    try {
      this.redisServer.stop();
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }

  public int getPort() {
    return redisServer.ports().get(0);
  }

  public Pool<Jedis> getPool() {
    if (jedis == null) {
      jedis = new JedisPool(connection);
    }
    return jedis;
  }

  public Jedis getJedis() {
    return getPool().getResource();
  }

  public static EmbeddedRedis embed() {
    try {
      ServerSocket serverSocket = new ServerSocket(0);
      int port = serverSocket.getLocalPort();
      serverSocket.close();
      return new EmbeddedRedis(port);
    } catch (IOException | URISyntaxException e) {
      throw new RuntimeException("Failed to create embedded Redis", e);
    }
  }
}

redpajama_set_name: RedPajamaGithub


text:
package com.ms.meizinewsapplication.features.video.pojo.xm_tv;

/**
 * Created by 啟成 on 2016/5/12.
 */
public class Items {
    private String id;

    private String ver;

    private String createtime;

    private String updatetime;

    private String name;

    private String hostid;

    private String person_num;

    private String announcement;

    private Classification classification;

    private Pictures pictures;

    private String status;

    private String start_time;

    private String end_time;

    private String duration;

    private String schedule;

    private String remind_switch;

    private String remind_content;

    private String level;

    private String stream_status;

    private String classify_switch;

    private String reliable;

    private String banned_reason;

    private String unlock_time;

    private String speak_interval;

    private String person_num_thres;

    private String reduce_ratio;

    private String person_switch;

    private String watermark_switch;

    private String watermark_loc;

    private String account_status;

    private String person_src;

    private String room_key;

    private String fans;

    private Userinfo userinfo;

    private String instroduction;

    public void setId(String id) {
        this.id = id;
    }

    public String getId() {
        return this.id;
    }

    public void setVer(String ver) {
        this.ver = ver;
    }

    public String getVer() {
        return this.ver;
    }

    public void setCreatetime(String createtime) {
        this.createtime = createtime;
    }

    public String getCreatetime() {
        return this.createtime;
    }

    public void setUpdatetime(String updatetime) {
        this.updatetime = updatetime;
    }

    public String getUpdatetime() {
        return this.updatetime;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return this.name;
    }

    public void setHostid(String hostid) {
        this.hostid = hostid;
    }

    public String getHostid() {
        return this.hostid;
    }

    public void setPerson_num(String person_num) {
        this.person_num = person_num;
    }

    public String getPerson_num() {
        return this.person_num;
    }

    public void setAnnouncement(String announcement) {
        this.announcement = announcement;
    }

    public String getAnnouncement() {
        return this.announcement;
    }

    public void setClassification(Classification classification) {
        this.classification = classification;
    }

    public Classification getClassification() {
        return this.classification;
    }

    public void setPictures(Pictures pictures) {
        this.pictures = pictures;
    }

    public Pictures getPictures() {
        return this.pictures;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getStatus() {
        return this.status;
    }

    public void setStart_time(String start_time) {
        this.start_time = start_time;
    }

    public String getStart_time() {
        return this.start_time;
    }

    public void setEnd_time(String end_time) {
        this.end_time = end_time;
    }

    public String getEnd_time() {
        return this.end_time;
    }

    public void setDuration(String duration) {
        this.duration = duration;
    }

    public String getDuration() {
        return this.duration;
    }

    public void setSchedule(String schedule) {
        this.schedule = schedule;
    }

    public String getSchedule() {
        return this.schedule;
    }

    public void setRemind_switch(String remind_switch) {
        this.remind_switch = remind_switch;
    }

    public String getRemind_switch() {
        return this.remind_switch;
    }

    public void setRemind_content(String remind_content) {
        this.remind_content = remind_content;
    }

    public String getRemind_content() {
        return this.remind_content;
    }

    public void setLevel(String level) {
        this.level = level;
    }

    public String getLevel() {
        return this.level;
    }

    public void setStream_status(String stream_status) {
        this.stream_status = stream_status;
    }

    public String getStream_status() {
        return this.stream_status;
    }

    public void setClassify_switch(String classify_switch) {
        this.classify_switch = classify_switch;
    }

    public String getClassify_switch() {
        return this.classify_switch;
    }

    public void setReliable(String reliable) {
        this.reliable = reliable;
    }

    public String getReliable() {
        return this.reliable;
    }

    public void setBanned_reason(String banned_reason) {
        this.banned_reason = banned_reason;
    }

    public String getBanned_reason() {
        return this.banned_reason;
    }

    public void setUnlock_time(String unlock_time) {
        this.unlock_time = unlock_time;
    }

    public String getUnlock_time() {
        return this.unlock_time;
    }

    public void setSpeak_interval(String speak_interval) {
        this.speak_interval = speak_interval;
    }

    public String getSpeak_interval() {
        return this.speak_interval;
    }

    public void setPerson_num_thres(String person_num_thres) {
        this.person_num_thres = person_num_thres;
    }

    public String getPerson_num_thres() {
        return this.person_num_thres;
    }

    public void setReduce_ratio(String reduce_ratio) {
        this.reduce_ratio = reduce_ratio;
    }

    public String getReduce_ratio() {
        return this.reduce_ratio;
    }

    public void setPerson_switch(String person_switch) {
        this.person_switch = person_switch;
    }

    public String getPerson_switch() {
        return this.person_switch;
    }

    public void setWatermark_switch(String watermark_switch) {
        this.watermark_switch = watermark_switch;
    }

    public String getWatermark_switch() {
        return this.watermark_switch;
    }

    public void setWatermark_loc(String watermark_loc) {
        this.watermark_loc = watermark_loc;
    }

    public String getWatermark_loc() {
        return this.watermark_loc;
    }

    public void setAccount_status(String account_status) {
        this.account_status = account_status;
    }

    public String getAccount_status() {
        return this.account_status;
    }

    public void setPerson_src(String person_src) {
        this.person_src = person_src;
    }

    public String getPerson_src() {
        return this.person_src;
    }

    public void setRoom_key(String room_key) {
        this.room_key = room_key;
    }

    public String getRoom_key() {
        return this.room_key;
    }

    public void setFans(String fans) {
        this.fans = fans;
    }

    public String getFans() {
        return this.fans;
    }

    public void setUserinfo(Userinfo userinfo) {
        this.userinfo = userinfo;
    }

    public Userinfo getUserinfo() {
        return this.userinfo;
    }

    public void setInstroduction(String instroduction) {
        this.instroduction = instroduction;
    }

    public String getInstroduction() {
        return this.instroduction;
    }
}


text:
package com.crittertap.framework;

import com.crittertap.framework.Graphics.PixmapFormat;

public interface Pixmap {
    public int getWidth();

    public int getHeight();

    public PixmapFormat getFormat();

    public void dispose();
}


text:
package com.sundayliu.demo;

import java.util.HashMap;
import java.util.Set;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

public class Demo extends ListActivity
{
    private HashMap<String,String> mDatas = new HashMap<String,String>(){
        /**
         *
         */
        private static final long serialVersionUID = 1L;

        {
            put("ListView", "com.sundayliu.demo.ListViewActivity");
            put("Network", "com.sundayliu.demo.NetworkActivity");
        }

    };

    /** Called when the activity is first created. */

    @Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        String[] values = getValues();
        ArrayAdapter<String> adapter = new DemoArrayAdapter(this,
                values);
            setListAdapter(adapter);
      }

    private String[] getValues(){

        Set<String> keys = mDatas.keySet();
        String[] values = new String[keys.size()];
        keys.toArray(values);
        return values;
    }

    protected void onListItemClick(ListView l, View v, int position, long id){
        super.onListItemClick(l, v, position, id);
        l.getItemAtPosition(position);
        String key = ((TextView)v.findViewById(R.id.label)).getText().toString();
        String value = mDatas.get(key);
        try{
            Intent intent = new Intent(this, Class.forName(value));
            startActivity(intent);
        }
        catch(ClassNotFoundException e){
          Toast.makeText(this, e.toString(), Toast.LENGTH_LONG).show();
        }
        //Toast.makeText(this, key, Toast.LENGTH_LONG).show();
    }

    public void startActivityOnClickHandler(View v){
        String key = (String)v.getTag();
        String value = mDatas.get(key);
        try{
            Intent intent = new Intent(this, Class.forName(value));
            startActivity(intent);
        }
        catch(ClassNotFoundException e){
          Toast.makeText(this, e.toString(), Toast.LENGTH_LONG).show();
        }

    }
}


text:
<?php

namespace ZendTest\Form\Element;

use stdClass;
use ArrayObject;
use PHPUnit_Framework_TestCase as TestCase;
use Zend\Form\Element;
use Zend\Form\Element\Collection as Collection;
use Zend\Form\Fieldset;
use Zend\Form\Form;
use Zend\Stdlib\Hydrator\ArraySerializable;
use Zend\Stdlib\Hydrator\ClassMethods;
use Zend\Stdlib\Hydrator\ObjectProperty as ObjectPropertyHydrator;
use ZendTest\Form\TestAsset\ArrayModel;
use ZendTest\Form\TestAsset\CustomCollection;
use ZendTest\Form\TestAsset\Entity\Product;
use ZendTest\Form\TestAsset\ProductFieldset;
use ZendTest\Form\TestAsset\Entity\Address;
use ZendTest\Form\TestAsset\Entity\Phone;

class CollectionTest extends TestCase
{
    protected $form;
    protected $productFieldset;

    public function setUp()
    {
        $this->form = new \ZendTest\Form\TestAsset\FormCollection();
        $this->productFieldset = new \ZendTest\Form\TestAsset\ProductFieldset();

        parent::setUp();
    }

    public function testCanRetrieveDefaultPlaceholder()
    {
        $placeholder = $this->form->get('colors')->getTemplatePlaceholder();
        $this->assertEquals('__index__', $placeholder);
    }

    public function testCannotAllowNewElementsIfAllowAddIsFalse()
    {
        $collection = $this->form->get('colors');

        $this->assertTrue($collection->allowAdd());
        $collection->setAllowAdd(false);
        $this->assertFalse($collection->allowAdd());

        // By default, $collection contains 2 elements
        $data = array();
        $data[] = 'blue';
        $data[] = 'green';

        $collection->populateValues($data);
        $this->assertEquals(2, count($collection->getElements()));

        $this->setExpectedException('Zend\Form\Exception\DomainException');
        $data[] = 'orange';
        $collection->populateValues($data);
    }

    public function testCanAddNewElementsIfAllowAddIsTrue()
    {
        $collection = $this->form->get('colors');
        $collection->setAllowAdd(true);
        $this->assertTrue($collection->allowAdd());

        // By default, $collection contains 2 elements
        $data = array();
        $data[] = 'blue';
        $data[] = 'green';

        $collection->populateValues($data);
        $this->assertEquals(2, count($collection->getElements()));

        $data[] = 'orange';
        $collection->populateValues($data);
        $this->assertEquals(3, count($collection->getElements()));
    }

    public function testCanRemoveElementsIfAllowRemoveIsTrue()
    {
        $collection = $this->form->get('colors');
        $collection->setAllowRemove(true);
        $this->assertTrue($collection->allowRemove());

        $data = array();
        $data[] = 'blue';
        $data[] = 'green';

        $collection->populateValues($data);
        $this->assertEquals(2, count($collection->getElements()));

        unset($data[0]);

        $collection->populateValues($data);
        $this->assertEquals(1, count($collection->getElements()));
    }

    public function testCanReplaceElementsIfAllowAddAndAllowRemoveIsTrue()
    {
        $collection = $this->form->get('colors');
        $collection->setAllowAdd(true);
        $collection->setAllowRemove(true);

        $data = array();
        $data[] = 'blue';
        $data[] = 'green';

        $collection->populateValues($data);
        $this->assertEquals(2, count($collection->getElements()));

        unset($data[0]);
        $data[] = 'orange';

        $collection->populateValues($data);
        $this->assertEquals(2, count($collection->getElements()));
    }

    public function testCanValidateFormWithCollectionWithoutTemplate()
    {
        $this->form->setData(array(
            'colors' => array(
                '#ffffff',
                '#ffffff'
            ),
            'fieldsets' => array(
                array(
                    'field' => 'oneValue',
                    'nested_fieldset' => array(
                        'anotherField' => 'anotherValue'
                    )
                ),
                array(
                    'field' => 'twoValue',
                    'nested_fieldset' => array(
                        'anotherField' => 'anotherValue'
                    )
                )
            )
        ));

        $this->assertEquals(true, $this->form->isValid());
    }

    public function testCanValidateFormWithCollectionWithTemplate()
    {
        $collection = $this->form->get('colors');

        $this->assertFalse($collection->shouldCreateTemplate());
        $collection->setShouldCreateTemplate(true);
        $this->assertTrue($collection->shouldCreateTemplate());

        $collection->setTemplatePlaceholder('__template__');

        $this->form->setData(array(
            'colors' => array(
                '#ffffff',
                '#ffffff'
            ),
            'fieldsets' => array(
                array(
                    'field' => 'oneValue',
                    'nested_fieldset' => array(
                        'anotherField' => 'anotherValue'
                    )
                ),
                array(
                    'field' => 'twoValue',
                    'nested_fieldset' => array(
                        'anotherField' => 'anotherValue'
                    )
                )
            )
        ));

        $this->assertEquals(true, $this->form->isValid());
    }

    public function testThrowExceptionIfThereAreLessElementsAndAllowRemoveNotAllowed()
    {
        $this->setExpectedException('Zend\Form\Exception\DomainException');

        $collection = $this->form->get('colors');
        $collection->setAllowRemove(false);

        $this->form->setData(array(
            'colors' => array(
                '#ffffff'
            ),
            'fieldsets' => array(
                array(
                    'field' => 'oneValue',
                    'nested_fieldset' => array(
                        'anotherField' => 'anotherValue'
                    )
                ),
                array(
                    'field' => 'twoValue',
                    'nested_fieldset' => array(
                        'anotherField' => 'anotherValue'
                    )
                )
            )
        ));

        $this->form->isValid();
    }

    public function testCanValidateLessThanSpecifiedCount()
    {
        $collection = $this->form->get('colors');
        $collection->setAllowRemove(true);

        $this->form->setData(array(
            'colors' => array(
                '#ffffff'
            ),
            'fieldsets' => array(
                array(
                    'field' => 'oneValue',
                    'nested_fieldset' => array(
                        'anotherField' => 'anotherValue'
                    )
                ),
                array(
                    'field' => 'twoValue',
                    'nested_fieldset' => array(
                        'anotherField' => 'anotherValue'
                    )
                )
            )
        ));

        $this->assertEquals(true, $this->form->isValid());
    }

    public function testSetOptions()
    {
        $collection = $this->form->get('colors');
        $element = new Element('foo');
        $collection->setOptions(array(
                                  'target_element' => $element,
                                  'count' => 2,
                                  'allow_add' => true,
                                  'allow_remove' => false,
                                  'should_create_template' => true,
                                  'template_placeholder' => 'foo',
                             ));
        $this->assertInstanceOf('Zend\Form\Element', $collection->getOption('target_element'));
        $this->assertEquals(2, $collection->getOption('count'));
        $this->assertEquals(true, $collection->getOption('allow_add'));
        $this->assertEquals(false, $collection->getOption('allow_remove'));
        $this->assertEquals(true, $collection->getOption('should_create_template'));
        $this->assertEquals('foo', $collection->getOption('template_placeholder'));
    }

    public function testSetObjectNullRaisesException()
    {
        $collection = $this->form->get('colors');
        $this->setExpectedException('Zend\Form\Exception\InvalidArgumentException');
        $collection->setObject(null);
    }

    public function testPopulateValuesNullRaisesException()
    {
        $collection = $this->form->get('colors');
        $this->setExpectedException('Zend\Form\Exception\InvalidArgumentException');
        $collection->populateValues(null);
    }

    public function testSetTargetElementNullRaisesException()
    {
        $collection = $this->form->get('colors');
        $this->setExpectedException('Zend\Form\Exception\InvalidArgumentException');
        $collection->setTargetElement(null);
    }

    public function testGetTargetElement()
    {
        $collection = $this->form->get('colors');
        $element = new Element('foo');
        $collection->setTargetElement($element);

        $this->assertInstanceOf('Zend\Form\Element', $collection->getTargetElement());
    }

    public function testExtractFromObjectDoesntTouchOriginalObject()
    {
        $form = new \Zend\Form\Form();
        $form->setHydrator(new \Zend\Stdlib\Hydrator\ClassMethods());
        $this->productFieldset->setUseAsBaseFieldset(true);
        $form->add($this->productFieldset);

        $originalObjectHash = spl_object_hash($this->productFieldset->get("categories")->getTargetElement()->getObject());

        $product = new Product();
        $product->setName("foo");
        $product->setPrice(42);
        $cat1 = new \ZendTest\Form\TestAsset\Entity\Category();
        $cat1->setName("bar");
        $cat2 = new \ZendTest\Form\TestAsset\Entity\Category();
        $cat2->setName("bar2");

        $product->setCategories(array($cat1,$cat2));

        $form->bind($product);

        $form->setData(
            array("product"=>
                array(
                    "name" => "franz",
                    "price" => 13,
                    "categories" => array(
                        array("name" => "sepp"),
                        array("name" => "herbert")
                    )
                )
            )
        );

        $objectAfterExtractHash = spl_object_hash($this->productFieldset->get("categories")->getTargetElement()->getObject());

        $this->assertSame($originalObjectHash,$objectAfterExtractHash);
    }

    public function testDoesNotCreateNewObjects()
    {
        if (!extension_loaded('intl')) {
            // Required by \Zend\I18n\Validator\Float
            $this->markTestSkipped('ext/intl not enabled');
        }

        $form = new \Zend\Form\Form();
        $form->setHydrator(new \Zend\Stdlib\Hydrator\ClassMethods());
        $this->productFieldset->setUseAsBaseFieldset(true);
        $form->add($this->productFieldset);

        $product = new Product();
        $product->setName("foo");
        $product->setPrice(42);
        $cat1 = new \ZendTest\Form\TestAsset\Entity\Category();
        $cat1->setName("bar");
        $cat2 = new \ZendTest\Form\TestAsset\Entity\Category();
        $cat2->setName("bar2");

        $product->setCategories(array($cat1,$cat2));

        $form->bind($product);

        $form->setData(
            array("product"=>
                array(
                    "name" => "franz",
                    "price" => 13,
                    "categories" => array(
                        array("name" => "sepp"),
                        array("name" => "herbert")
                    )
                )
            )
        );
        $form->isValid();

        $categories = $product->getCategories();
        $this->assertSame($categories[0], $cat1);
        $this->assertSame($categories[1], $cat2);
    }

    public function testCreatesNewObjectsIfSpecified()
    {
        if (!extension_loaded('intl')) {
            // Required by \Zend\I18n\Validator\Float
            $this->markTestSkipped('ext/intl not enabled');
        }

        $this->productFieldset->setUseAsBaseFieldset(true);
        $categories = $this->productFieldset->get('categories');
        $categories->setOptions(array(
            'create_new_objects' => true,
        ));

        $form = new \Zend\Form\Form();
        $form->setHydrator(new \Zend\Stdlib\Hydrator\ClassMethods());
        $form->add($this->productFieldset);

        $product = new Product();
        $product->setName("foo");
        $product->setPrice(42);
        $cat1 = new \ZendTest\Form\TestAsset\Entity\Category();
        $cat1->setName("bar");
        $cat2 = new \ZendTest\Form\TestAsset\Entity\Category();
        $cat2->setName("bar2");

        $product->setCategories(array($cat1,$cat2));

        $form->bind($product);

        $form->setData(
            array("product"=>
                array(
                    "name" => "franz",
                    "price" => 13,
                    "categories" => array(
                        array("name" => "sepp"),
                        array("name" => "herbert")
                    )
                )
            )
        );
        $form->isValid();

        $categories = $product->getCategories();
        $this->assertNotSame($categories[0], $cat1);
        $this->assertNotSame($categories[1], $cat2);
    }

    public function testExtractDefaultIsEmptyArray()
    {
        $collection = $this->form->get('fieldsets');
        $this->assertEquals(array(), $collection->extract());
    }

    public function testExtractThroughTargetElementHydrator()
    {
        $collection = $this->form->get('fieldsets');
        $this->prepareForExtract($collection);

        $expected = array(
            'obj2' => array('field' => 'fieldOne'),
            'obj3' => array('field' => 'fieldTwo'),
        );

        $this->assertEquals($expected, $collection->extract());
    }

    public function testExtractMaintainsTargetElementObject()
    {
        $collection = $this->form->get('fieldsets');
        $this->prepareForExtract($collection);

        $expected = $collection->getTargetElement()->getObject();

        $collection->extract();

        $test = $collection->getTargetElement()->getObject();

        $this->assertSame($expected, $test);
    }

    public function testExtractThroughCustomHydrator()
    {
        $collection = $this->form->get('fieldsets');
        $this->prepareForExtract($collection);

        $mockHydrator = $this->getMock('Zend\Stdlib\Hydrator\HydratorInterface');
        $mockHydrator->expects($this->exactly(2))
                     ->method('extract')
                     ->will($this->returnCallback(function ($object) {
                         return $object->field . '_foo';
                     }));

        $collection->setHydrator($mockHydrator);

        $expected = array(
            'obj2' => 'fieldOne_foo',
            'obj3' => 'fieldTwo_foo',
        );

        $this->assertEquals($expected, $collection->extract());
    }

    public function testExtractFromTraversable()
    {
        $collection = $this->form->get('fieldsets');
        $this->prepareForExtract($collection);

        $traversable = new ArrayObject($collection->getObject());
        $collection->setObject($traversable);

        $expected = array(
            'obj2' => array('field' => 'fieldOne'),
            'obj3' => array('field' => 'fieldTwo'),
        );

        $this->assertEquals($expected, $collection->extract());
    }

    public function testValidateData()
    {
        $myFieldset = new Fieldset();
        $myFieldset->add(array(
            'name' => 'email',
            'type' => 'Email',
        ));

        $myForm = new Form();
        $myForm->add(array(
            'name' => 'collection',
            'type' => 'Collection',
            'options' => array(
                'target_element' => $myFieldset,
            ),
        ));

        $data = array(
            'collection' => array(
                array('email' => 'test1@test1.com'),
                array('email' => 'test2@test2.com'),
                array('email' => 'test3@test3.com'),
            )
        );

        $myForm->setData($data);

        $this->assertTrue($myForm->isValid());
        $this->assertEmpty($myForm->getMessages());
    }

    protected function prepareForExtract($collection)
    {
        $targetElement = $collection->getTargetElement();

        $obj1 = new stdClass();

        $targetElement->setHydrator(new ObjectPropertyHydrator())
                      ->setObject($obj1);

        $obj2 = new stdClass();
        $obj2->field = 'fieldOne';

        $obj3 = new stdClass();
        $obj3->field = 'fieldTwo';

        $collection->setObject(array(
            'obj2' => $obj2,
            'obj3' => $obj3,
        ));
    }

    public function testCanBindObjectAndPopulateAndExtractNestedFieldsets()
    {

        $productFieldset = new \ZendTest\Form\TestAsset\ProductFieldset();
        $productFieldset->setHydrator(new \Zend\Stdlib\Hydrator\ClassMethods());

        $mainFieldset = new Fieldset('shop');
        $mainFieldset->setObject(new stdClass);
        $mainFieldset->setHydrator(new ObjectPropertyHydrator());
        $mainFieldset->add($productFieldset);

        $form = new Form();
        $form->setHydrator(new ObjectPropertyHydrator());
        $form->add(array(
            'name' => 'collection',
            'type' => 'Collection',
            'options' => array(
                'target_element' => $mainFieldset,
                'count' => 2
            ),
        ));

        $market = new stdClass();

        $prices = array(100, 200);

        $shop1 = new stdClass();
        $shop1->product = new Product();
        $shop1->product->setPrice($prices[0]);

        $shop2 = new stdClass();
        $shop2->product = new Product();
        $shop2->product->setPrice($prices[1]);

        $market->collection = array($shop1, $shop2);
        $form->bind($market);

        //test for object binding
        foreach ($form->get('collection')->getFieldsets() as $_fieldset) {
            $this->assertInstanceOf('ZendTest\Form\TestAsset\Entity\Product', $_fieldset->get('product')->getObject());
        };

        //test for correct extract and populate
        foreach ($prices as $_k => $_price) {
            $this->assertEquals($_price, $form->get('collection')->get($_k)->get('product')->get('price')->getValue());
        }
    }

    public function testExtractFromTraversableImplementingToArrayThroughCollectionHydrator()
    {
        $collection = $this->form->get('fieldsets');

        // this test is using a hydrator set on the collection
        $collection->setHydrator(new ArraySerializable());

        $this->prepareForExtractWithCustomTraversable($collection);

        $expected = array(
            array('foo' => 'foo_value_1', 'bar' => 'bar_value_1', 'foobar' => 'foobar_value_1'),
            array('foo' => 'foo_value_2', 'bar' => 'bar_value_2', 'foobar' => 'foobar_value_2'),
        );

        $this->assertEquals($expected, $collection->extract());
    }

    public function testExtractFromTraversableImplementingToArrayThroughTargetElementHydrator()
    {
        $collection = $this->form->get('fieldsets');

        // this test is using a hydrator set on the target element of the collection
        $targetElement = $collection->getTargetElement();
        $targetElement->setHydrator(new ArraySerializable());
        $obj1 = new ArrayModel();
        $targetElement->setObject($obj1);

        $this->prepareForExtractWithCustomTraversable($collection);

        $expected = array(
            array('foo' => 'foo_value_1', 'bar' => 'bar_value_1', 'foobar' => 'foobar_value_1'),
            array('foo' => 'foo_value_2', 'bar' => 'bar_value_2', 'foobar' => 'foobar_value_2'),
        );

        $this->assertEquals($expected, $collection->extract());
    }

    protected function prepareForExtractWithCustomTraversable($collection)
    {
        $obj2 = new ArrayModel();
        $obj2->exchangeArray(array('foo' => 'foo_value_1', 'bar' => 'bar_value_1', 'foobar' => 'foobar_value_1'));
        $obj3 = new ArrayModel();
        $obj3->exchangeArray(array('foo' => 'foo_value_2', 'bar' => 'bar_value_2', 'foobar' => 'foobar_value_2'));

        $traversable = new CustomCollection();
        $traversable->append($obj2);
        $traversable->append($obj3);
        $collection->setObject($traversable);
    }

    public function testPopulateValuesWithFirstKeyGreaterThanZero()
    {
        $inputData = array(
            1 => array('name' => 'black'),
            5 => array('name' => 'white'),
        );

        // Standalone Collection element
        $collection = new Collection('fieldsets', array(
            'count' => 1,
            'target_element' => new \ZendTest\Form\TestAsset\CategoryFieldset(),
        ));

        $form = new Form();
        $form->add(array(
            'type'    => 'Zend\Form\Element\Collection',
            'name'    => 'collection',
            'options' => array(
                'count'          => 1,
                'target_element' => new \ZendTest\Form\TestAsset\CategoryFieldset(),
            )
        ));

        // Collection element attached to a form
        $formCollection = $form->get('collection');

        $collection->populateValues($inputData);
        $formCollection->populateValues($inputData);

        $this->assertEquals(count($collection->getFieldsets()), count($inputData));
        $this->assertEquals(count($formCollection->getFieldsets()), count($inputData));
    }

    public function testCanRemoveAllElementsIfAllowRemoveIsTrue()
    {
        /**
         * @var \Zend\Form\Element\Collection $collection
         */
        $collection = $this->form->get('colors');
        $collection->setAllowRemove(true);
        $collection->setCount(0);

        // By default, $collection contains 2 elements
        $data = array();

        $collection->populateValues($data);
        $this->assertEquals(0, count($collection->getElements()));
    }

    public function testCanBindObjectMultipleNestedFieldsets()
    {
        $productFieldset = new ProductFieldset();
        $productFieldset->setHydrator(new ClassMethods());
        $productFieldset->setObject(new Product());

        $nestedFieldset = new Fieldset('nested');
        $nestedFieldset->setHydrator(new ClassMethods());
        $nestedFieldset->setObject(new stdClass());
        $nestedFieldset->add(array(
            'name' => 'products',
            'type' => 'Collection',
            'options' => array(
                'target_element' => $productFieldset,
                'count' => 2,
            ),
        ));

        $mainFieldset = new Fieldset('main');
        $mainFieldset->setUseAsBaseFieldset(true);
        $mainFieldset->setHydrator(new ClassMethods());
        $mainFieldset->setObject(new stdClass());
        $mainFieldset->add(array(
            'name' => 'nested',
            'type' => 'Collection',
            'options' => array(
                'target_element' => $nestedFieldset,
                'count' => 2,
            ),
        ));

        $form = new Form();
        $form->setHydrator(new ObjectPropertyHydrator());
        $form->add($mainFieldset);

        $market = new stdClass();

        $prices = array(100, 200);

        $products[0] = new Product();
        $products[0]->setPrice($prices[0]);
        $products[1] = new Product();
        $products[1]->setPrice($prices[1]);

        $shop[0] = new stdClass();
        $shop[0]->products = $products;

        $shop[1] = new stdClass();
        $shop[1]->products = $products;

        $market->main = $shop;
        $form->bind($market);

        //test for object binding
        foreach ($form->get('main')->getFieldsets() as $_fieldset) {
            foreach($_fieldset->getFieldsets() as $_nestedfieldset) {
                $this->assertInstanceOf('ZendTest\Form\TestAsset\Entity\Product', $_nestedfieldset->get('products')->getObject());
            }
        };
    }

    public function testNestedCollections()
    {
        // @see https://github.com/zendframework/zf2/issues/5640
        $addressesFieldeset = new \ZendTest\Form\TestAsset\AddressFieldset();
        $addressesFieldeset->setHydrator(new \Zend\Stdlib\Hydrator\ClassMethods());

        $form = new Form();
        $form->setHydrator(new ObjectPropertyHydrator());
        $form->add(array(
            'name' => 'addresses',
            'type' => 'Collection',
            'options' => array(
                'target_element' => $addressesFieldeset,
                'count' => 2
            ),
        ));

        $data = array(
            array('number' => '0000000001', 'street' => 'street1'),
            array('number' => '0000000002', 'street' => 'street2'),
        );

        $phone1 = new Phone();
        $phone1->setNumber($data[0]['number']);

        $phone2 = new Phone();
        $phone2->setNumber($data[1]['number']);

        $address1 = new Address();
        $address1->setStreet($data[0]['street']);
        $address1->setPhones(array($phone1));

        $address2 = new Address();
        $address2->setStreet($data[1]['street']);
        $address2->setPhones(array($phone2));

        $customer = new stdClass();
        $customer->addresses = array($address1, $address2);

        $form->bind($customer);

        //test for object binding
        foreach ($form->get('addresses')->getFieldsets() as $_fieldset) {
            $this->assertInstanceOf('ZendTest\Form\TestAsset\Entity\Address', $_fieldset->getObject());
            foreach ($_fieldset->getFieldsets() as $_childFieldsetName => $_childFieldset) {
                switch ($_childFieldsetName) {
                    case 'city':
                        $this->assertInstanceOf('ZendTest\Form\TestAsset\Entity\City', $_childFieldset->getObject());
                        break;
                    case 'phones':
                        foreach ($_childFieldset->getFieldsets() as $_phoneFieldset) {
                            $this->assertInstanceOf('ZendTest\Form\TestAsset\Entity\Phone', $_phoneFieldset->getObject());
                        }
                        break;
                }
            }
        }

        //test for correct extract and populate
        $index = 0;
        foreach ($form->get('addresses') as $_addresses) {
            $this->assertEquals($data[$index]['street'], $_addresses->get('street')->getValue());
            //assuming data has just 1 phone entry
            foreach ($_addresses->get('phones') as $phone) {
                $this->assertEquals($data[$index]['number'], $phone->get('number')->getValue());
            }
            $index++;
        }
    }

    public function testSetDataOnFormPopulatesCollection()
    {
        $form = new Form();
        $form->add(array(
            'name' => 'names',
            'type' => 'Collection',
            'options' => array(
                'target_element' => new Element\Text(),
            ),
        ));

        $names = array('foo', 'bar', 'baz', 'bat');

        $form->setData(array(
            'names' => $names
        ));

        $this->assertCount(count($names), $form->get('names'));

        $i = 0;
        foreach($form->get('names') as $field) {
            $this->assertEquals($names[$i], $field->getValue());
            $i++;
        };
    }

    public function testSettingSomeDataButNoneForCollectionReturnsSpecifiedNumberOfElementsAfterPrepare()
    {
        $form = new Form();
        $form->add(new Element\Text('input'));
        $form->add(array(
            'name' => 'names',
            'type' => 'Collection',
            'options' => array(
                'target_element' => new Element\Text(),
                'count' => 2
            ),
        ));

        $form->setData(array(
            'input' => 'foo',
        ));

        $this->assertCount(0, $form->get('names'));

        $form->prepare();

        $this->assertCount(2, $form->get('names'));
    }
}


text:
package utils;

import java.io.Closeable;
import java.io.IOException;

/**
 * Created by Zfanji on 2017/3/27.
 */

public class AppUtils {
    /**
     * Close outputStream
     *
     * @param is
     */
    public static void closeStream(Closeable stream) {
        if (stream != null) {
            try {
                stream.close();
                stream = null;
            } catch (IOException e) {
            } finally {
                if (stream != null) {
                    try {
                        stream.close();
                    } catch (IOException e) {
                        stream = null;
                    }
                    stream = null;
                }
            }
        }
    }
}


text:
var requireDir = require('require-dir');
var _ = require('lodash');

module.exports = function (server) {
  var routers = requireDir('./routers', {recurse: true});
  _.each(routers, function(router, name) {
    router(server, name);
  });
};


text:
package io.agrest.client.it.noadapter;

import com.fasterxml.jackson.databind.JsonNode;
import io.agrest.Ag;
import io.agrest.DataResponse;
import io.agrest.client.ClientDataResponse;
import io.agrest.client.AgClient;
import io.agrest.client.protocol.Expression;
import io.agrest.client.protocol.Include;
import io.agrest.client.protocol.Sort;
import io.agrest.it.fixture.JerseyTestOnDerby;
import io.agrest.it.fixture.cayenne.E2;
import io.agrest.it.fixture.cayenne.E3;
import io.agrest.it.fixture.cayenne.E4;
import org.junit.Test;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.Configuration;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.FeatureContext;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.core.UriInfo;
import java.util.List;

import static org.junit.Assert.*;

public class GET_Client_IT extends JerseyTestOnDerby {

    @Override
    protected void doAddResources(FeatureContext context) {
        context.register(Resource.class);
    }

    @Test
    public void testClient() {

        insert("e4", "id, c_varchar, c_int", "1, 'xxx', 5");
        insert("e4", "id, c_varchar, c_int", "2, 'yyy', 7");

		ClientDataResponse<JsonNode> response = AgClient.client(target("/e4"))
                .exclude(E4.C_BOOLEAN.getName(), E4.C_DATE.getName(), E4.C_DECIMAL.getName(),
                        E4.C_TIME.getName(), E4.C_TIMESTAMP.getName())
                .get(JsonNode.class);

		assertEquals(Status.OK, response.getStatus());
        assertEquals(2, response.getTotal());

        List<JsonNode> items = response.getData();
        assertNotNull(items);
        assertEquals(2, items.size());

        JsonNode[] expected = new JsonNode[] {EntityUtil.createE4(1, "xxx", 5), EntityUtil.createE4(2, "yyy", 7)};
        assertArrayEquals(expected, items.toArray());
	}

    @Test
    public void testClient_Sort() {

        insert("e4", "id, c_varchar, c_int", "1, 'xxx', 5");
        insert("e4", "id, c_varchar, c_int", "2, 'yyy', 7");

		ClientDataResponse<JsonNode> response = AgClient.client(target("/e4"))
                .exclude(E4.C_BOOLEAN.getName(), E4.C_DATE.getName(), E4.C_DECIMAL.getName(),
                        E4.C_TIME.getName(), E4.C_TIMESTAMP.getName())
                .sort(Sort.property(E4.ID_PK_COLUMN).desc())
                .get(JsonNode.class);

		assertEquals(Status.OK, response.getStatus());
        assertEquals(2, response.getTotal());

        List<JsonNode> items = response.getData();
        assertNotNull(items);
        assertEquals(2, items.size());

        JsonNode[] expected = new JsonNode[] {EntityUtil.createE4(2, "yyy", 7), EntityUtil.createE4(1, "xxx", 5)};
        assertArrayEquals(expected, items.toArray());
	}

    @Test
    public void testClient_Include() {

        insert("e2", "id, name", "1, 'xxx'");
        insert("e3", "id, e2_id, name", "5, 1, 'aaa'");
        insert("e3", "id, e2_id, name", "6, 1, 'bbb'");
        insert("e3", "id, e2_id, name", "7, 1, 'ccc'");
        insert("e3", "id, e2_id, name", "8, 1, 'ddd'");
        insert("e3", "id, e2_id, name", "9, 1, 'eee'");

		ClientDataResponse<JsonNode> response = AgClient.client(target("/e2"))
                .include(Include.path(E2.E3S.getName())
                        .start(2).limit(2)
                        .sort(Sort.property(E3.NAME.getName()).desc()))
                .exclude(E2.ADDRESS.getName(), E2.E3S.dot(E3.PHONE_NUMBER).getName())
                .get(JsonNode.class);

        assertEquals(Status.OK, response.getStatus());
        assertEquals(1, response.getTotal());
        assertEquals(EntityUtil.createE2(1, "xxx", EntityUtil.createE3(7, "ccc"), EntityUtil.createE3(6, "bbb")), response.getData().get(0));
    }

    @Test
    public void testClient_CayenneExpression1() {

        insert("e2", "id, name", "1, 'xxx'");
        insert("e2", "id, name", "2, 'yyy'");
        insert("e3", "id, e2_id, name", "5, 1, 'aaa'");
        insert("e3", "id, e2_id, name", "6, 2, 'bbb'");
        insert("e3", "id, e2_id, name", "7, 1, 'ccc'");

        ClientDataResponse<JsonNode> response = AgClient.client(target("/e2"))
                .exclude(E2.ADDRESS.getName(), E2.E3S.dot(E3.PHONE_NUMBER).getName())
                .cayenneExp(Expression.query("name like 'xx%'"))
                .include(Include.path(E2.E3S.getName()).cayenneExp(Expression.query("name = $b").params("ccc")))
                .get(JsonNode.class);

        assertEquals(Status.OK, response.getStatus());
        assertEquals(1, response.getTotal());
        assertEquals(EntityUtil.createE2(1, "xxx", EntityUtil.createE3(7, "ccc")), response.getData().get(0));
    }

    @Test
    public void testClient_CayenneExpression2() {

        insert("e4", "id, c_varchar, c_int, c_boolean", "1, 'xxx', 1, false");
        insert("e4", "id, c_varchar, c_int, c_boolean", "2, 'yyy', 2, false");
        insert("e4", "id, c_varchar, c_int, c_boolean", "3, 'xxz', 3, true");

        ClientDataResponse<JsonNode> response = AgClient.client(target("/e4"))
                .include(E4.ID_PK_COLUMN, E4.C_VARCHAR.getName(), E4.C_INT.getName())
                .cayenneExp(Expression.query("cVarchar like $a and cInt >= $b and cBoolean <> $c")
                                      .param("a", "xx%").param("b", 2).param("c", false))
                .get(JsonNode.class);

        assertEquals(Status.OK, response.getStatus());
        assertEquals(1, response.getTotal());
        assertEquals(EntityUtil.createE4(3, "xxz", 3), response.getData().get(0));
    }

    @Path("")
    public static class Resource {

        @Context
        private Configuration config;

        @GET
        @Path("e2")
        public DataResponse<E2> getE2(@Context UriInfo uriInfo) {
            return Ag.service(config).select(E2.class).uri(uriInfo).get();
        }

        @GET
        @Path("e4")
        public DataResponse<E4> getE4(@Context UriInfo uriInfo) {
            return Ag.service(config).select(E4.class).uri(uriInfo).get();
        }
    }
}


text:
layout: post
title: Outdoor pussy play brings intense orgasm
titleinfo: pornvd
desc: Watch Outdoor pussy play brings intense orgasm. Pornhub is the ultimate xxx porn and sex site.
---

Outdoor pussy play brings intense orgasm

Watch Outdoor pussy play brings intense orgasm. Pornhub is the ultimate xxx porn and sex site.


text:
using QuantConnect.Data.Market;

namespace QuantConnect.Indicators
{
    /// <summary>
    ///     The Acceleration Bands created by Price Headley plots upper and lower envelope bands around a moving average.
    /// </summary>
    /// <seealso cref="Indicators.IndicatorBase{TradeBar}" />
    public class AccelerationBands : IndicatorBase<TradeBar>
    {
        private readonly decimal _width;

        /// <summary>
        ///     Gets the type of moving average
        /// </summary>
        public MovingAverageType MovingAverageType { get; }

        /// <summary>
        ///     Gets the middle acceleration band (moving average)
        /// </summary>
        public IndicatorBase<IndicatorDataPoint> MiddleBand { get; }

        /// <summary>
        ///     Gets the upper acceleration band  (High * ( 1 + Width * (High - Low) / (High + Low)))
        /// </summary>
        public IndicatorBase<IndicatorDataPoint> UpperBand { get; }

        /// <summary>
        ///     Gets the lower acceleration band  (Low * (1 - Width * (High - Low)/ (High + Low)))
        /// </summary>
        public IndicatorBase<IndicatorDataPoint> LowerBand { get; }

        /// <summary>
        ///     Initializes a new instance of the <see cref="AccelerationBands" /> class.
        /// </summary>
        /// <param name="name">The name of this indicator.</param>
        /// <param name="period">The period of the three moving average (middle, upper and lower band).</param>
        /// <param name="width">A coefficient specifying the distance between the middle band and upper or lower bands.</param>
        /// <param name="movingAverageType">Type of the moving average.</param>
        public AccelerationBands(string name, int period, decimal width,
            MovingAverageType movingAverageType = MovingAverageType.Simple)
            : base(name)
        {
            _width = width;
            MovingAverageType = movingAverageType;
            MiddleBand = movingAverageType.AsIndicator(name + "_MiddleBand", period);
            LowerBand = movingAverageType.AsIndicator(name + "_LowerBand", period);
            UpperBand = movingAverageType.AsIndicator(name + "_UpperBand", period);
        }

        /// <summary>
        ///     Initializes a new instance of the <see cref="AccelerationBands" /> class.
        /// </summary>
        /// <param name="period">The period of the three moving average (middle, upper and lower band).</param>
        /// <param name="width">A coefficient specifying the distance between the middle band and upper or lower bands.</param>
        public AccelerationBands(int period, decimal width)
            : this(string.Format("ABANDS({0},{1})", period, width), period, width)
        {
        }

        /// <summary>
        ///     Initializes a new instance of the <see cref="AccelerationBands" /> class.
        /// </summary>
        /// <param name="period">The period of the three moving average (middle, upper and lower band).</param>
        public AccelerationBands(int period)
            : this(string.Format("ABANDS({0},{1})", period, arg1: 4), period, width: 4)
        {
        }

        /// <summary>
        ///     Gets a flag indicating when this indicator is ready and fully initialized
        /// </summary>
        public override bool IsReady => MiddleBand.IsReady && LowerBand.IsReady && UpperBand.IsReady;

        /// <summary>
        ///     Resets this indicator to its initial state
        /// </summary>
        public override void Reset()
        {
            base.Reset();
            MiddleBand.Reset();
            LowerBand.Reset();
            UpperBand.Reset();
        }

        /// <summary>
        ///     Computes the next value of this indicator from the given state
        /// </summary>
        /// <param name="input">The input given to the indicator</param>
        /// <returns>
        ///     A new value for this indicator
        /// </returns>
        protected override decimal ComputeNextValue(TradeBar input)
        {
            MiddleBand.Update(new IndicatorDataPoint
            {
                Time = input.Time,
                Value = input.Close
            });

            var coeff = _width * (input.High - input.Low) / (input.High + input.Low);

            LowerBand.Update(new IndicatorDataPoint
            {
                Time = input.Time,
                Value = input.Low * (1 - coeff)
            });

            UpperBand.Update(new IndicatorDataPoint
            {
                Time = input.Time,
                Value = input.High * (1 + coeff)
            });

            return MiddleBand;
        }
    }
}


text:
package org.apache.maven.repository.internal.util;

import java.io.PrintStream;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.eclipse.aether.transfer.AbstractTransferListener;
import org.eclipse.aether.transfer.TransferEvent;
import org.eclipse.aether.transfer.TransferResource;

public class ConsoleTransferListener extends AbstractTransferListener {

    private PrintStream out;

    private Map<TransferResource, Long> downloads = new ConcurrentHashMap<>();

    private int lastLength;

    public ConsoleTransferListener() {
        this(null);
    }

    public ConsoleTransferListener(PrintStream out) {
        this.out = (out != null) ? out : System.out;
    }

    @Override
    public void transferInitiated(TransferEvent event) {
        String message = event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploading" : "Downloading";

        println(
                "transferInitiated",
                message + ": " + event.getResource().getRepositoryUrl()
                        + event.getResource().getResourceName());
    }

    @Override
    public void transferProgressed(TransferEvent event) {
        TransferResource resource = event.getResource();
        downloads.put(resource, event.getTransferredBytes());

        StringBuilder buffer = new StringBuilder(64);

        for (Map.Entry<TransferResource, Long> entry : downloads.entrySet()) {
            long total = entry.getKey().getContentLength();
            long complete = entry.getValue();

            buffer.append(getStatus(complete, total)).append("  ");
        }

        int pad = lastLength - buffer.length();
        lastLength = buffer.length();
        pad(buffer, pad);
        buffer.append('\r');

        print("transferProgressed", buffer.toString());
    }

    private String getStatus(long complete, long total) {
        if (total >= 1024) {
            return toKB(complete) + "/" + toKB(total) + " KB ";
        } else if (total >= 0) {
            return complete + "/" + total + " B ";
        } else if (complete >= 1024) {
            return toKB(complete) + " KB ";
        } else {
            return complete + " B ";
        }
    }

    private void pad(StringBuilder buffer, int spaces) {
        String block = "                                        ";
        while (spaces > 0) {
            int n = Math.min(spaces, block.length());
            buffer.append(block, 0, n);
            spaces -= n;
        }
    }

    @Override
    public void transferSucceeded(TransferEvent event) {
        transferCompleted(event);

        TransferResource resource = event.getResource();
        long contentLength = event.getTransferredBytes();
        if (contentLength >= 0) {
            String type = (event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploaded" : "Downloaded");
            String len = contentLength >= 1024 ? toKB(contentLength) + " KB" : contentLength + " B";

            String throughput = "";
            long duration = System.currentTimeMillis() - resource.getTransferStartTime();
            if (duration > 0) {
                DecimalFormat format = new DecimalFormat("0.0", new DecimalFormatSymbols(Locale.ENGLISH));
                double kbPerSec = (contentLength / 1024.0) / (duration / 1000.0);
                throughput = " at " + format.format(kbPerSec) + " KB/sec";
            }

            println(
                    "transferSucceeded",
                    type + ": " + resource.getRepositoryUrl() + resource.getResourceName() + " (" + len + throughput
                            + ")");
        }
    }

    @Override
    public void transferFailed(TransferEvent event) {
        transferCompleted(event);

        println(
                "transferFailed",
                event.getException().getClass() + ": " + event.getException().getMessage());
    }

    private void transferCompleted(TransferEvent event) {
        downloads.remove(event.getResource());

        StringBuilder buffer = new StringBuilder(64);
        pad(buffer, lastLength);
        buffer.append('\r');
        out.println(buffer);
    }

    @Override
    public void transferCorrupted(TransferEvent event) {
        println(
                "transferCorrupted",
                event.getException().getClass() + ": " + event.getException().getMessage());
    }

    protected long toKB(long bytes) {
        return (bytes + 1023) / 1024;
    }

    private void println(String event, String message) {
        print(event, message);
        out.println();
    }

    private void print(String event, String message) {
        out.print("Aether Transfer - " + event);
        if (message != null) {
            out.print(": ");
            out.print(message);
        }
    }
}


text:
package com.spotify.flo.context;

import static java.util.stream.Collectors.joining;

import com.spotify.flo.TaskId;
import com.spotify.flo.TaskInfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
import java.util.function.BiConsumer;

/**
 * Utilities for printing the task tree
 */
final class PrintUtils {

  private PrintUtils() {
  }

  static List<String> tree(TaskInfo taskInfo) {
    final List<String> lines = new ArrayList<>();
    traverseTree(taskInfo, (taskId, s) -> lines.add(s));
    return lines;
  }

  static void traverseTree(TaskInfo taskInfo, BiConsumer<TaskId, String> consumer) {
    consumer.accept(taskInfo.id(), taskInfo.id().toString());
    popSubTree(taskInfo.inputs(), consumer, new Stack<>());
  }

  private static void popSubTree(List<TaskInfo> inputs, BiConsumer<TaskId, String> consumer, Stack<Boolean> indents) {
    for (int i = 0; i < inputs.size(); i++) {
      final TaskInfo taskInfo = inputs.get(i);
      final String indent = indents.stream()
          .map(b -> b ? "   " : "│  ")
          .collect(joining());
      final String branch = (i < inputs.size() - 1) ? "├" : "└";
      final String prefix = indent + branch + "▸ ";
      final String refArrow = taskInfo.isReference()
          ? " ⤴"
          : "";

      consumer.accept(taskInfo.id(), prefix + taskInfo.id() + refArrow);

      indents.push(i == inputs.size() - 1);
      popSubTree(taskInfo.inputs(), consumer, indents);
      indents.pop();
    }
  }
}


text:
import ValidatorInvoker from './ValidatorInvoker';

class ValidatorCollection {

  constructor() {
    this.validators = {};
  }

  addValidator(validator, module) {
    if (!this.validators[validator.name]) {
      this.validators[validator.name] = [];
    }
    this.validators[validator.name].push({
      validatorInvoker: new ValidatorInvoker(validator),
      module:module
    });
  }

  /**
   * @param {String} validationRule
   * @return {ValidatorInvoker}
   */
  resolveValidator(validationRule) {
    const parts = validationRule.split('/'),
      rule = parts.length == 1 ? parts[0] : parts[1],
      module = parts.length == 1 ? false: parts[0];

    let resolvedValidator = null;
    if (rule in this.validators) {
      if (!module) {
        resolvedValidator = this.validators[rule][0].validatorInvoker;
      } else {
        this.validators[rule].every(obj => {
          if (obj.module == module) {
            resolvedValidator = obj.validatorInvoker
          } else {
            return true;
          }
        });
      }
    }
    return resolvedValidator;
  }

}

/**
 * @param {jQuery} $
 * @returns {ValidatorCollection}
 */
ValidatorCollection.loadViaJquery = ($) => {
  $.formUtils = $.formUtils || {};
  if (!$.formUtils.validatorCollection) {
    $.formUtils.validatorCollection = new ValidatorCollection();
  }
  return $.formUtils.validatorCollection;
};

export default ValidatorCollection;


text:
categories:
- tumblr
- archive
- link
date: 2009-05-24T07:52:54Z
link: http://www.mmop.org.au
title: Melbourne Museum of Printing
url: /2009/05/24/link-melbourne-museum-of-printing/
---


text:
<title>Create Library Database and Table</title>

<?php
echo ( '
Creating Personal Library Database and Table with SQLite Version: '
 . sqlite_libversion() . '
' );
$libraryDB = "C:\Program Files\Apache Group\Apache2\htdocs\PHP5\AppC\sqlite\library";
if ($db = @sqlite_open($libraryDB, 0666, $error)) {
   print ( '
Successfully created SQLite database called library
' );
   $sql = "CREATE TABLE books (
      book_id INTEGER PRIMARY KEY,
      book_title VARCHAR,
      book_author VARCHAR,
      book_pub_year INTEGER,
      book_publisher VARCHAR,
      book_read VARCHAR,
      book_score VARCHAR,
      book_loan VARCHAR
   )";
   if ( @sqlite_query($db, $sql) ) {
      print ( '
Successfully created SQLite table called books
' );
   } else {
      print ( '
Failed creating SQLite table called books because of error:

' . sqlite_error_string(sqlite_last_error($db)) . '
' );
   }
} else {
   print ( '
Failed creating SQLite database called library because of error:

' . $error . '
' );
}
?>


text:
package org.trustedanalytics.sparktk.models.clustering.gmm

import java.nio.file.{ Files, Path }

import org.apache.spark.sql.Row
import org.apache.spark.SparkContext
import org.apache.spark.mllib.clustering.{ GaussianMixture => SparkGaussianMixture, GaussianMixtureModel => SparkGaussianMixtureModel }
import org.apache.spark.rdd.RDD
import org.trustedanalytics.sparktk.TkContext
import org.trustedanalytics.sparktk.frame._
import org.trustedanalytics.sparktk.frame.internal.RowWrapper
import org.trustedanalytics.sparktk.frame.internal.rdd.{ FrameRdd, RowWrapperFunctions }
import org.trustedanalytics.sparktk.saveload.{ SaveLoad, TkSaveLoad, TkSaveableObject }
import org.json4s.JsonAST.JValue
import org.trustedanalytics.sparktk.models.MatrixImplicits._
import java.io.{ FileOutputStream, File }
import org.apache.spark.mllib.linalg.{ DenseVector, Vectors }
import org.apache.commons.io.{ IOUtils, FileUtils }
import org.trustedanalytics.sparktk.models.{ SparkTkModelAdapter, TkSearchPath, ScoringModelUtils }
import org.trustedanalytics.scoring.interfaces.{ ModelMetaData, Field, Model }

object GaussianMixtureModel extends TkSaveableObject {

  /**
   *
   * @param frame A frame to train the model on
   * @param observationColumns Columns containing the observations
   * @param columnScalings Column scalings for each of the observation columns.
   *                       The scaling value is multiplied by the corresponding value in the observation column
   * @param k Desired number of clusters. Default is 2
   * @param maxIterations Number of iterations for which the algorithm should run. Default is 100.
   * @param convergenceTol Largest change in log-likelihood at which convergence is considered to have occurred.
   * @param seed Random seed
   * @return GaussianMixtureModel The trained model
   */
  def train(frame: Frame,
            observationColumns: Seq[String],
            columnScalings: Seq[Double],
            k: Int = 2,
            maxIterations: Int = 100,
            convergenceTol: Double = 0.01,
            seed: Long = scala.util.Random.nextLong()): GaussianMixtureModel = {

    require(frame != null, "frame must not be null")
    require(observationColumns != null && observationColumns.nonEmpty, "observationColumn must not be null nor empty")
    require(columnScalings != null && columnScalings.nonEmpty, "columnWeights must not be null or empty")
    require(columnScalings.length == observationColumns.length, "Length of columnWeights and observationColumns needs to be the same")
    require(k > 0, "k must be at least 1")
    require(maxIterations > 0, "maxIterations must be a positive value")

    val sparkGaussianMixture = new SparkGaussianMixture()
    sparkGaussianMixture.setK(k)
    sparkGaussianMixture.setConvergenceTol(convergenceTol)
    sparkGaussianMixture.setMaxIterations(maxIterations)
    sparkGaussianMixture.setSeed(seed)

    val trainFrameRdd = new FrameRdd(frame.schema, frame.rdd)
    trainFrameRdd.cache()
    val vectorRDD = trainFrameRdd.toDenseVectorRddWithWeights(observationColumns, columnScalings)
    val model = sparkGaussianMixture.run(vectorRDD)
    trainFrameRdd.unpersist()

    val gaussians = model.gaussians.map(g => Gaussian(g.mu.toArray, g.sigma.toListOfList()))

    GaussianMixtureModel(observationColumns,
      columnScalings,
      k,
      maxIterations,
      convergenceTol,
      seed,
      gaussians,
      model)
  }

  /**
   * Load a GaussianMixtureModel from the given path
   * @param tc TkContext
   * @param path location
   * @return
   */
  def load(tc: TkContext, path: String): GaussianMixtureModel = {
    tc.load(path).asInstanceOf[GaussianMixtureModel]
  }

  /**
   * *
   *
   * @param sc active spark context
   * @param path the source path
   * @param formatVersion the version of the format for the tk metadata that should be recorded.
   * @param tkMetadata the data to save (should be a case class), must be serializable to JSON using json4s
   * @return
   */
  def loadTkSaveableObject(sc: SparkContext, path: String, formatVersion: Int, tkMetadata: JValue): Any = {

    validateFormatVersion(formatVersion, 1)
    val m: GaussianMixtureModelTkMetaData = SaveLoad.extractFromJValue[GaussianMixtureModelTkMetaData](tkMetadata)
    val sparkModel = SparkGaussianMixtureModel.load(sc, path)

    GaussianMixtureModel(m.observationColumns, m.columnScalings, m.k, m.maxIterations, m.convergenceTol, m.seed, m.gaussians, sparkModel)
  }

}

/**
 * Holds mu and sigma values in the trained GMM model
 * @param mu The mean vector of the distribution
 * @param sigma The covariance matrix of the distribution
 */
case class Gaussian(mu: Seq[Double], sigma: Seq[Seq[Double]])

case class GaussianMixtureModel private[gmm] (observationColumns: Seq[String],
                                              columnScalings: Seq[Double],
                                              k: Int = 2,
                                              maxIterations: Int = 100,
                                              convergenceTol: Double = 0.01,
                                              seed: Long = scala.util.Random.nextLong(),
                                              gaussians: Seq[Gaussian],
                                              sparkModel: SparkGaussianMixtureModel) extends Serializable with Model {

  implicit def rowWrapperToRowWrapperFunctions(rowWrapper: RowWrapper): RowWrapperFunctions = {
    new RowWrapperFunctions(rowWrapper)
  }

  /**
   *
   * @param frame The frame to compute the cluster size on, after prediction
   * @return Returns a map of cluster names(string) and sizes(integer)
   */
  def computeGmmClusterSize(frame: Frame): Map[String, Int] = {
    val trainFrameRdd = new FrameRdd(frame.schema, frame.rdd)
    val vectorRDD = trainFrameRdd.toDenseVectorRddWithWeights(observationColumns, columnScalings)
    val predictRDD = sparkModel.predict(vectorRDD)
    predictRDD.map(row => ("Cluster:" + row.toString, 1)).reduceByKey(_ + _).collect().toMap
  }

  /**
   * Predicts the labels for the observation columns in the input frame
   * @param frame frame whose cluster assignments are to be predicted
   * @param observationColumns Column(s) containing the observations whose clusters are to be predicted. By default,
   *                           we predict the clusters over columns the GMMModel was trained on. The columns are
   *                           scaled using the same values used when training the model
   * @return New frame containing the original frame's columns and a column with the predicted label
   */
  def predict(frame: Frame, observationColumns: Option[Seq[String]] = None): Frame = {
    require(frame != null, "frame is required")
    if (observationColumns.isDefined) {
      require(observationColumns.get.length == observationColumns.get.length, "Number of columns for train and predict should be same")
    }

    val gmmColumns = observationColumns.getOrElse(this.observationColumns)
    val scalingValues = columnScalings
    val frameRdd = new FrameRdd(frame.schema, frame.rdd)

    val predictionsRdd = sparkModel.predict(frameRdd.toDenseVectorRdd(gmmColumns, Some(scalingValues)))
    val indexedPredictionsRdd = predictionsRdd.zipWithIndex().map { case (cluster, index) => (index.toLong, Row.apply(cluster)) }

    val indexedFrameRdd = frame.rdd.zipWithIndex().map { case (row, index) => (index, row) }

    val resultRdd: RDD[Row] = indexedPredictionsRdd.join(indexedFrameRdd).map { value =>
      val row = value._2._2
      val cluster = value._2._1
      Row.merge(row, cluster)
    }
    val predictSchema = frame.schema.addColumn(Column("predicted_cluster", DataTypes.int32))
    new Frame(resultRdd, predictSchema)
  }

  /**
   * Saves this model to a file
   *
   * @param sc active SparkContext
   * @param path save to path
   */
  def save(sc: SparkContext, path: String): Unit = {
    sparkModel.save(sc, path)
    val formatVersion: Int = 1
    val tkMetadata = GaussianMixtureModelTkMetaData(observationColumns, columnScalings, k, maxIterations, convergenceTol, seed, gaussians)
    TkSaveLoad.saveTk(sc, path, GaussianMixtureModel.formatId, formatVersion, tkMetadata)
  }

  /**
   * gets the prediction on the provided record
   * @param row a record that needs to be predicted on
   * @return the row along with its prediction
   */
  def score(row: Array[Any]): Array[Any] = {
    require(row != null)
    require(row.length == observationColumns.length,
      s"The number of scoring inputs (${row.length}) should be equal to the number of observation columns (${observationColumns.length}).")

    row :+ sparkModel.predict(new DenseVector(row.map(i => ScoringModelUtils.asDouble(i))))
  }

  /**
   * @return fields containing the input names and their datatypes
   */
  def input(): Array[Field] = {
    var input = Array[Field]()
    observationColumns.foreach { name =>
      input = input :+ Field(name, "Double")
    }
    input
  }

  /**
   * @return fields containing the input names and their datatypes along with the output and its datatype
   */
  def output(): Array[Field] = {
    val output = input()
    output :+ Field("Score", "Int")
  }

  /**
   * @return metadata about the model
   */
  def modelMetadata(): ModelMetaData = {
    //todo provide a for the user to populate the custom metadata fields
    new ModelMetaData("Gaussian Mixture Model", classOf[GaussianMixtureModel].getName, classOf[SparkTkModelAdapter].getName, Map())
  }

  /**
   * @param sc active SparkContext
   * @param marSavePath location where the MAR file needs to be saved
   * @return full path to the location of the MAR file
   */
  def exportToMar(sc: SparkContext, marSavePath: String): String = {
    var tmpDir: Path = null
    try {
      tmpDir = Files.createTempDirectory("sparktk-scoring-model")
      save(sc, tmpDir.toString)
      ScoringModelUtils.saveToMar(sc, marSavePath, classOf[GaussianMixtureModel].getName, tmpDir)
    }
    finally {
      sys.addShutdownHook(FileUtils.deleteQuietly(tmpDir.toFile)) // Delete temporary directory on exit
    }
  }

}

case class GaussianMixtureModelTkMetaData(observationColumns: Seq[String],
                                          columnScalings: Seq[Double],
                                          k: Int,
                                          maxIterations: Int,
                                          convergenceTol: Double,
                                          seed: Long,
                                          gaussians: Seq[Gaussian]) extends Serializable


text: var Fsy =  function(){};


text:
package ucsclient

type Config struct {
	IpAddress             string
	Username              string
	Password              string
	TslInsecureSkipVerify bool
	LogLevel              int
	LogFilename           string
	AppName               string
}

// Configures and returns a fully initialised UCSClient.
func (c *Config) Client() *UCSClient {
	return NewUCSClient(c)
}


text:
{% extends "cosinnus/base.html" %}
{% load i18n cosinnus_tags static ecobasa_tags ecobasa_time thumbnail %}
{% load static from staticfiles %}

{% block page_title %}{% blocktrans %}Users in group {{ group }}{% endblocktrans %}{% endblock %}

{% block content %}
    {% trans "Add user" %}

    {% if object_list %}

                {% trans "User" %}
                {% trans "Status" %}

        {% for user in object_list %}

            {% if user.cosinnus_profile.avatar %}

                  {% else %}

                  {% endif %}
                  {{ user.username }}

                     {% trans "edit status" %}
                     {% trans "delete" %}

        {% endfor %}

    {% else %}
        {% trans "There are no users." %}
    {% endif %}
{% endblock %}


text:
function ValidationError(errors, message) {
    this.errors = errors;
    this.message = message || 'Validation exception';
}
ValidationError.prototype = Object.create(Error.prototype);
ValidationError.prototype.constructor = ValidationError;

module.exports = ValidationError;


text:
<?xml version="1.0" encoding="UTF-8"?><ti:app xmlns:ti="http://ti.appcelerator.org">
	<id>test</id>
	<name>test</name>
	<version>1.0</version>
	<publisher>not specified</publisher>
	<url/>
	<description>not specified</description>
	<copyright>not specified</copyright>
	<icon>appicon.png</icon>
	<fullscreen>false</fullscreen>
	<navbar-hidden>false</navbar-hidden>
	<analytics>true</analytics>
	<guid>d5945507-90e8-445f-86a2-8775159c1cbb</guid>
	<property name="ti.ui.defaultunit" type="string">dp</property>
	<ios>
		<plist>
			<dict>
				<key>UISupportedInterfaceOrientations~iphone</key>
				<array>
					<string>UIInterfaceOrientationPortrait</string>
				</array>
				<key>UISupportedInterfaceOrientations~ipad</key>
				<array>
					<string>UIInterfaceOrientationPortrait</string>
					<string>UIInterfaceOrientationPortraitUpsideDown</string>
					<string>UIInterfaceOrientationLandscapeLeft</string>
					<string>UIInterfaceOrientationLandscapeRight</string>
				</array>
				<key>UIRequiresPersistentWiFi</key>
				<false/>
				<key>UIPrerenderedIcon</key>
				<false/>
				<key>UIStatusBarHidden</key>
				<false/>
				<key>UIStatusBarStyle</key>
				<string>UIStatusBarStyleDefault</string>
			</dict>
		</plist>
	</ios>
	<android xmlns:android="http://schemas.android.com/apk/res/android">
    <manifest>
        <application android:theme="@style/Light"/>
        <uses-sdk android:minSdkVersion="14"/>
    </manifest>
	</android>
	<mobileweb>
		<precache>
		</precache>
		<splash>
			<enabled>true</enabled>
			<inline-css-images>true</inline-css-images>
		</splash>
		<theme>default</theme>
	</mobileweb>
	<modules>
    <module platform="android">com.alcoapps.actionbarextras</module>
    <module platform="iphone">ti.newsstand</module>
  </modules>
	<deployment-targets>
		<target device="android">true</target>
		<target device="ipad">true</target>
		<target device="iphone">true</target>
		<target device="mobileweb">false</target>
	</deployment-targets>
	<sdk-version>3.4.0.GA</sdk-version>
<plugins><plugin version="1.5.0">ti.alloy</plugin>
</plugins>
</ti:app>


text:
<?php

namespace PHPHealth\CDA\Component;

use PHPHealth\CDA\ClinicalDocument as CD;

/**
 * Component which contains the body of the document
 *
 * @author Julien Fastré <julien.fastre@champs-libres.coop>
 */
class RootBodyComponent extends AbstractComponent
{
    /**
     *
     * @var AbstractComponent[]
     */
    private $components = array();

    public function addComponent(AbstractComponent $component)
    {
        $this->components[] = $component;
    }

    /**
     *
     * @return AbstractComponent[]
     */
    public function getComponents()
    {
        return $this->components;
    }

    public function isEmpty()
    {
        return count($this->components) == 0;
    }

    public function toDOMElement(\DOMDocument $doc)
    {
        $component = $doc->createElement('component');

        foreach ($this->getComponents() as $subComponent) {
            $component->appendChild($subComponent->toDOMElement($doc));
        }

        return $component;
    }
}


text:
#region License
//
// Copyright Tony Beveridge 2015. All rights reserved.
// MIT license applies.
//
#endregion
using System.Collections.Generic;

namespace ControlCentre.Models {

    public class QueryModel : BaseRequestModel {
        public IEnumerable<string> Machines { get; set; }
    }

}