text:
package lms.model;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

public class LmsStationRepetoryExample {
    protected String orderByClause;

    protected boolean distinct;

    protected List<Criteria> oredCriteria;

    public LmsStationRepetoryExample() {
        oredCriteria = new ArrayList<Criteria>();
    }

    public void setOrderByClause(String orderByClause) {
        this.orderByClause = orderByClause;
    }

    public String getOrderByClause() {
        return orderByClause;
    }

    public void setDistinct(boolean distinct) {
        this.distinct = distinct;
    }

    public boolean isDistinct() {
        return distinct;
    }

    public List<Criteria> getOredCriteria() {
        return oredCriteria;
    }

    public void or(Criteria criteria) {
        oredCriteria.add(criteria);
    }

    public Criteria or() {
        Criteria criteria = createCriteriaInternal();
        oredCriteria.add(criteria);
        return criteria;
    }

    public Criteria createCriteria() {
        Criteria criteria = createCriteriaInternal();
        if (oredCriteria.size() == 0) {
            oredCriteria.add(criteria);
        }
        return criteria;
    }

    protected Criteria createCriteriaInternal() {
        Criteria criteria = new Criteria();
        return criteria;
    }

    public void clear() {
        oredCriteria.clear();
        orderByClause = null;
        distinct = false;
    }

    protected abstract static class GeneratedCriteria {
        protected List<Criterion> criteria;

        protected GeneratedCriteria() {
            super();
            criteria = new ArrayList<Criterion>();
        }

        public boolean isValid() {
            return criteria.size() > 0;
        }

        public List<Criterion> getAllCriteria() {
            return criteria;
        }

        public List<Criterion> getCriteria() {
            return criteria;
        }

        protected void addCriterion(String condition) {
            if (condition == null) {
                throw new RuntimeException("Value for condition cannot be null");
            }
            criteria.add(new Criterion(condition));
        }

        protected void addCriterion(String condition, Object value, String property) {
            if (value == null) {
                throw new RuntimeException("Value for " + property + " cannot be null");
            }
            criteria.add(new Criterion(condition, value));
        }

        protected void addCriterion(String condition, Object value1, Object value2, String property) {
            if (value1 == null || value2 == null) {
                throw new RuntimeException("Between values for " + property + " cannot be null");
            }
            criteria.add(new Criterion(condition, value1, value2));
        }

        public Criteria andIdIsNull() {
            addCriterion("id is null");
            return (Criteria) this;
        }

        public Criteria andIdIsNotNull() {
            addCriterion("id is not null");
            return (Criteria) this;
        }

        public Criteria andIdEqualTo(Long value) {
            addCriterion("id =", value, "id");
            return (Criteria) this;
        }

        public Criteria andIdNotEqualTo(Long value) {
            addCriterion("id <>", value, "id");
            return (Criteria) this;
        }

        public Criteria andIdGreaterThan(Long value) {
            addCriterion("id >", value, "id");
            return (Criteria) this;
        }

        public Criteria andIdGreaterThanOrEqualTo(Long value) {
            addCriterion("id >=", value, "id");
            return (Criteria) this;
        }

        public Criteria andIdLessThan(Long value) {
            addCriterion("id <", value, "id");
            return (Criteria) this;
        }

        public Criteria andIdLessThanOrEqualTo(Long value) {
            addCriterion("id <=", value, "id");
            return (Criteria) this;
        }

        public Criteria andIdIn(List<Long> values) {
            addCriterion("id in", values, "id");
            return (Criteria) this;
        }

        public Criteria andIdNotIn(List<Long> values) {
            addCriterion("id not in", values, "id");
            return (Criteria) this;
        }

        public Criteria andIdBetween(Long value1, Long value2) {
            addCriterion("id between", value1, value2, "id");
            return (Criteria) this;
        }

        public Criteria andIdNotBetween(Long value1, Long value2) {
            addCriterion("id not between", value1, value2, "id");
            return (Criteria) this;
        }

        public Criteria andNameIsNull() {
            addCriterion("name is null");
            return (Criteria) this;
        }

        public Criteria andNameIsNotNull() {
            addCriterion("name is not null");
            return (Criteria) this;
        }

        public Criteria andNameEqualTo(String value) {
            addCriterion("name =", value, "name");
            return (Criteria) this;
        }

        public Criteria andNameNotEqualTo(String value) {
            addCriterion("name <>", value, "name");
            return (Criteria) this;
        }

        public Criteria andNameGreaterThan(String value) {
            addCriterion("name >", value, "name");
            return (Criteria) this;
        }

        public Criteria andNameGreaterThanOrEqualTo(String value) {
            addCriterion("name >=", value, "name");
            return (Criteria) this;
        }

        public Criteria andNameLessThan(String value) {
            addCriterion("name <", value, "name");
            return (Criteria) this;
        }

        public Criteria andNameLessThanOrEqualTo(String value) {
            addCriterion("name <=", value, "name");
            return (Criteria) this;
        }

        public Criteria andNameLike(String value) {
            addCriterion("name like", value, "name");
            return (Criteria) this;
        }

        public Criteria andNameNotLike(String value) {
            addCriterion("name not like", value, "name");
            return (Criteria) this;
        }

        public Criteria andNameIn(List<String> values) {
            addCriterion("name in", values, "name");
            return (Criteria) this;
        }

        public Criteria andNameNotIn(List<String> values) {
            addCriterion("name not in", values, "name");
            return (Criteria) this;
        }

        public Criteria andNameBetween(String value1, String value2) {
            addCriterion("name between", value1, value2, "name");
            return (Criteria) this;
        }

        public Criteria andNameNotBetween(String value1, String value2) {
            addCriterion("name not between", value1, value2, "name");
            return (Criteria) this;
        }

        public Criteria andAddressIsNull() {
            addCriterion("address is null");
            return (Criteria) this;
        }

        public Criteria andAddressIsNotNull() {
            addCriterion("address is not null");
            return (Criteria) this;
        }

        public Criteria andAddressEqualTo(String value) {
            addCriterion("address =", value, "address");
            return (Criteria) this;
        }

        public Criteria andAddressNotEqualTo(String value) {
            addCriterion("address <>", value, "address");
            return (Criteria) this;
        }

        public Criteria andAddressGreaterThan(String value) {
            addCriterion("address >", value, "address");
            return (Criteria) this;
        }

        public Criteria andAddressGreaterThanOrEqualTo(String value) {
            addCriterion("address >=", value, "address");
            return (Criteria) this;
        }

        public Criteria andAddressLessThan(String value) {
            addCriterion("address <", value, "address");
            return (Criteria) this;
        }

        public Criteria andAddressLessThanOrEqualTo(String value) {
            addCriterion("address <=", value, "address");
            return (Criteria) this;
        }

        public Criteria andAddressLike(String value) {
            addCriterion("address like", value, "address");
            return (Criteria) this;
        }

        public Criteria andAddressNotLike(String value) {
            addCriterion("address not like", value, "address");
            return (Criteria) this;
        }

        public Criteria andAddressIn(List<String> values) {
            addCriterion("address in", values, "address");
            return (Criteria) this;
        }

        public Criteria andAddressNotIn(List<String> values) {
            addCriterion("address not in", values, "address");
            return (Criteria) this;
        }

        public Criteria andAddressBetween(String value1, String value2) {
            addCriterion("address between", value1, value2, "address");
            return (Criteria) this;
        }

        public Criteria andAddressNotBetween(String value1, String value2) {
            addCriterion("address not between", value1, value2, "address");
            return (Criteria) this;
        }

        public Criteria andPhoneIsNull() {
            addCriterion("phone is null");
            return (Criteria) this;
        }

        public Criteria andPhoneIsNotNull() {
            addCriterion("phone is not null");
            return (Criteria) this;
        }

        public Criteria andPhoneEqualTo(BigDecimal value) {
            addCriterion("phone =", value, "phone");
            return (Criteria) this;
        }

        public Criteria andPhoneNotEqualTo(BigDecimal value) {
            addCriterion("phone <>", value, "phone");
            return (Criteria) this;
        }

        public Criteria andPhoneGreaterThan(BigDecimal value) {
            addCriterion("phone >", value, "phone");
            return (Criteria) this;
        }

        public Criteria andPhoneGreaterThanOrEqualTo(BigDecimal value) {
            addCriterion("phone >=", value, "phone");
            return (Criteria) this;
        }

        public Criteria andPhoneLessThan(BigDecimal value) {
            addCriterion("phone <", value, "phone");
            return (Criteria) this;
        }

        public Criteria andPhoneLessThanOrEqualTo(BigDecimal value) {
            addCriterion("phone <=", value, "phone");
            return (Criteria) this;
        }

        public Criteria andPhoneIn(List<BigDecimal> values) {
            addCriterion("phone in", values, "phone");
            return (Criteria) this;
        }

        public Criteria andPhoneNotIn(List<BigDecimal> values) {
            addCriterion("phone not in", values, "phone");
            return (Criteria) this;
        }

        public Criteria andPhoneBetween(BigDecimal value1, BigDecimal value2) {
            addCriterion("phone between", value1, value2, "phone");
            return (Criteria) this;
        }

        public Criteria andPhoneNotBetween(BigDecimal value1, BigDecimal value2) {
            addCriterion("phone not between", value1, value2, "phone");
            return (Criteria) this;
        }

        public Criteria andLmsAdminIdIsNull() {
            addCriterion("LMS_Admin_id is null");
            return (Criteria) this;
        }

        public Criteria andLmsAdminIdIsNotNull() {
            addCriterion("LMS_Admin_id is not null");
            return (Criteria) this;
        }

        public Criteria andLmsAdminIdEqualTo(Long value) {
            addCriterion("LMS_Admin_id =", value, "lmsAdminId");
            return (Criteria) this;
        }

        public Criteria andLmsAdminIdNotEqualTo(Long value) {
            addCriterion("LMS_Admin_id <>", value, "lmsAdminId");
            return (Criteria) this;
        }

        public Criteria andLmsAdminIdGreaterThan(Long value) {
            addCriterion("LMS_Admin_id >", value, "lmsAdminId");
            return (Criteria) this;
        }

        public Criteria andLmsAdminIdGreaterThanOrEqualTo(Long value) {
            addCriterion("LMS_Admin_id >=", value, "lmsAdminId");
            return (Criteria) this;
        }

        public Criteria andLmsAdminIdLessThan(Long value) {
            addCriterion("LMS_Admin_id <", value, "lmsAdminId");
            return (Criteria) this;
        }

        public Criteria andLmsAdminIdLessThanOrEqualTo(Long value) {
            addCriterion("LMS_Admin_id <=", value, "lmsAdminId");
            return (Criteria) this;
        }

        public Criteria andLmsAdminIdIn(List<Long> values) {
            addCriterion("LMS_Admin_id in", values, "lmsAdminId");
            return (Criteria) this;
        }

        public Criteria andLmsAdminIdNotIn(List<Long> values) {
            addCriterion("LMS_Admin_id not in", values, "lmsAdminId");
            return (Criteria) this;
        }

        public Criteria andLmsAdminIdBetween(Long value1, Long value2) {
            addCriterion("LMS_Admin_id between", value1, value2, "lmsAdminId");
            return (Criteria) this;
        }

        public Criteria andLmsAdminIdNotBetween(Long value1, Long value2) {
            addCriterion("LMS_Admin_id not between", value1, value2, "lmsAdminId");
            return (Criteria) this;
        }

        public Criteria andLmsStationIdIsNull() {
            addCriterion("LMS_Station_id is null");
            return (Criteria) this;
        }

        public Criteria andLmsStationIdIsNotNull() {
            addCriterion("LMS_Station_id is not null");
            return (Criteria) this;
        }

        public Criteria andLmsStationIdEqualTo(Long value) {
            addCriterion("LMS_Station_id =", value, "lmsStationId");
            return (Criteria) this;
        }

        public Criteria andLmsStationIdNotEqualTo(Long value) {
            addCriterion("LMS_Station_id <>", value, "lmsStationId");
            return (Criteria) this;
        }

        public Criteria andLmsStationIdGreaterThan(Long value) {
            addCriterion("LMS_Station_id >", value, "lmsStationId");
            return (Criteria) this;
        }

        public Criteria andLmsStationIdGreaterThanOrEqualTo(Long value) {
            addCriterion("LMS_Station_id >=", value, "lmsStationId");
            return (Criteria) this;
        }

        public Criteria andLmsStationIdLessThan(Long value) {
            addCriterion("LMS_Station_id <", value, "lmsStationId");
            return (Criteria) this;
        }

        public Criteria andLmsStationIdLessThanOrEqualTo(Long value) {
            addCriterion("LMS_Station_id <=", value, "lmsStationId");
            return (Criteria) this;
        }

        public Criteria andLmsStationIdIn(List<Long> values) {
            addCriterion("LMS_Station_id in", values, "lmsStationId");
            return (Criteria) this;
        }

        public Criteria andLmsStationIdNotIn(List<Long> values) {
            addCriterion("LMS_Station_id not in", values, "lmsStationId");
            return (Criteria) this;
        }

        public Criteria andLmsStationIdBetween(Long value1, Long value2) {
            addCriterion("LMS_Station_id between", value1, value2, "lmsStationId");
            return (Criteria) this;
        }

        public Criteria andLmsStationIdNotBetween(Long value1, Long value2) {
            addCriterion("LMS_Station_id not between", value1, value2, "lmsStationId");
            return (Criteria) this;
        }
    }

    public static class Criteria extends GeneratedCriteria {

        protected Criteria() {
            super();
        }
    }

    public static class Criterion {
        private String condition;

        private Object value;

        private Object secondValue;

        private boolean noValue;

        private boolean singleValue;

        private boolean betweenValue;

        private boolean listValue;

        private String typeHandler;

        public String getCondition() {
            return condition;
        }

        public Object getValue() {
            return value;
        }

        public Object getSecondValue() {
            return secondValue;
        }

        public boolean isNoValue() {
            return noValue;
        }

        public boolean isSingleValue() {
            return singleValue;
        }

        public boolean isBetweenValue() {
            return betweenValue;
        }

        public boolean isListValue() {
            return listValue;
        }

        public String getTypeHandler() {
            return typeHandler;
        }

        protected Criterion(String condition) {
            super();
            this.condition = condition;
            this.typeHandler = null;
            this.noValue = true;
        }

        protected Criterion(String condition, Object value, String typeHandler) {
            super();
            this.condition = condition;
            this.value = value;
            this.typeHandler = typeHandler;
            if (value instanceof List<?>) {
                this.listValue = true;
            } else {
                this.singleValue = true;
            }
        }

        protected Criterion(String condition, Object value) {
            this(condition, value, null);
        }

        protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
            super();
            this.condition = condition;
            this.value = value;
            this.secondValue = secondValue;
            this.typeHandler = typeHandler;
            this.betweenValue = true;
        }

        protected Criterion(String condition, Object value, Object secondValue) {
            this(condition, value, secondValue, null);
        }
    }
}


text:
package influent.server.clustering;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import java.util.UUID;

import influent.idl.FL_Cluster;
import influent.idl.FL_DistributionRange;
import influent.idl.FL_Entity;
import influent.idl.FL_EntityTag;
import influent.idl.FL_Frequency;
import influent.idl.FL_GeoData;
import influent.idl.FL_Geocoding;
import influent.idl.FL_Property;
import influent.idl.FL_PropertyTag;
import influent.idl.FL_PropertyType;
import influent.idl.FL_RangeType;
import influent.idlhelper.ClusterHelper;
import influent.idlhelper.EntityHelper;
import influent.idlhelper.PropertyHelper;
import influent.idlhelper.SingletonRangeHelper;
import influent.server.clustering.utils.EntityClusterFactory;
import influent.server.spi.impl.BasicCountryLevelGeocoding;
import influent.server.utilities.IdGenerator;
import influent.server.utilities.InfluentId;

import oculus.aperture.spi.common.Properties;

import org.junit.Assert;
import org.junit.Test;
import org.junit.Before;

public class EntityClusterFactoryTest {

	EntityClusterFactory clusterFactory;

	FL_Entity entityA;
	FL_Entity entityB;
	FL_Entity entityC;
	FL_Entity entityD;
	FL_Cluster clusterSummaryA;

	@Before
	public void setup() {
		Properties pMgr = new Properties() {
			Map<String, String> values = new Hashtable<String, String>();

			public void init() {
				values.put("entity.clusterer.clusterproperties", "TYPE:type-dist,GEO:location-dist,AvTransAmnt:avTran-dist");
			}

			@Override
			public Object getObject(String key) {
				init();
				return values.get(key);
			}

			@Override
			public Iterable<Object> getObjects(String key) { throw new UnsupportedOperationException(); }

			@Override
			public String getString(String key, String defaultValue) {
				init();
				if (values.containsKey(key)) return values.get(key);
				else return defaultValue;
			}

			@Override
			public Iterable<String> getStrings(String key) { throw new UnsupportedOperationException(); }

			@Override
			public Boolean getBoolean(String key, Boolean defaultValue) { throw new UnsupportedOperationException(); }

			@Override
			public Iterable<Boolean> getBooleans(String key) { throw new UnsupportedOperationException(); }

			@Override
			public Integer getInteger(String key, Integer defaultValue) { throw new UnsupportedOperationException(); }

			@Override
			public Iterable<Integer> getIntegers(String key) { throw new UnsupportedOperationException(); }

			@Override
			public Long getLong(String key, Long defaultValue) { throw new UnsupportedOperationException(); }

			@Override
			public Iterable<Long> getLongs(String key) { throw new UnsupportedOperationException(); }

			@Override
			public Float getFloat(String key, Float defaultValue) { throw new UnsupportedOperationException(); }

			@Override
			public Iterable<Float> getFloats(String key) { throw new UnsupportedOperationException(); }

			@Override
			public Double getDouble(String key, Double defaultValue) { throw new UnsupportedOperationException(); }

			@Override
			public Iterable<Double> getDoubles(String key) { throw new UnsupportedOperationException(); }

			@Override
			public Properties getPropertiesSet(String key, Properties defaultValue) { throw new UnsupportedOperationException(); }

			@Override
			public Iterable<Properties> getPropertiesSets(String key) { throw new UnsupportedOperationException(); }
		};

		FL_Geocoding geocoding = new BasicCountryLevelGeocoding();
		IdGenerator idGen = new IdGenerator() {
			@Override
			public String nextId() {
				return InfluentId.fromNativeId(InfluentId.CLUSTER, "cluster", UUID.randomUUID().toString()).getInfluentId();
			}
		};

		clusterFactory = new EntityClusterFactory(idGen, geocoding, pMgr);

		entityA = createEntity("entityA", FL_EntityTag.ACCOUNT, "Toronto", "CAN", 43.653226, -79.38318429999998, 100.0, 2, 3);
		entityB = createEntity("entityB", FL_EntityTag.ANONYMOUS, "Vancouver", "CAN", 49.2500, -123.1000, 200.0, 5, 7);
		entityC = createEntity("entityC", FL_EntityTag.ACCOUNT, "NYC", "USA", 40.7143528, -74.0059731, 300.0, 11, 13);
		entityD = createEntity("entityD", FL_EntityTag.ACCOUNT, "LA", "USA", 34.0522342, -118.2436849, 400.0, 17, 19);

		Hashtable<String, Double> locationDist = new Hashtable<String, Double>();
		locationDist.put("CAN", 200.0);
		locationDist.put("USA", 500.0);
		Hashtable<String, Double> typeDist = new Hashtable<String, Double>();
		typeDist.put("ACCOUNT", 400.0);
		typeDist.put("ANONYMOUS", 300.0);
		Hashtable<Double, Double> avTranDist = new Hashtable<Double, Double>();
		avTranDist.put(1000.0, 1.0);
		clusterSummaryA = createClusterSummary("clusterSummaryA", locationDist, typeDist, avTranDist, 700, 3000, 7000);
	}

	private FL_Entity createEntity(String name,
									FL_EntityTag tag,
									String location,
									String cc,
									double lat,
									double lon,
									double avTransAmnt,
									int indegree,
									int outdegree) {
		List<FL_Property> props = new ArrayList<FL_Property>();
		props.add(
			new PropertyHelper(
				"inflowing",
				"inflowing",
				indegree,
				Arrays.asList(
					FL_PropertyTag.INFLOWING,
					FL_PropertyTag.AMOUNT,
					FL_PropertyTag.USD
				)
			)
		);
		props.add(
			new PropertyHelper(
				"outflowing",
				"outflowing",
				outdegree,
				Arrays.asList(
					FL_PropertyTag.OUTFLOWING,
					FL_PropertyTag.AMOUNT,
					FL_PropertyTag.USD
				)
			)
		);
		props.add(
			new PropertyHelper(
				"AvTransAmnt",
				"AvTransAmnt",
				avTransAmnt,
				Arrays.asList(
					FL_PropertyTag.STAT
				)
			)
		);
		FL_GeoData geoData = FL_GeoData.newBuilder().setText(location).setLat(lat).setLon(lon).setCc(cc).build();
		props.add(
			FL_Property.newBuilder()
				.setKey("geo")
				.setFriendlyText("")
				.setTags(Collections.singletonList(FL_PropertyTag.GEO))
				.setRange(SingletonRangeHelper.from(geoData))
				.setProvenance(null)
				.setUncertainty(null)
				.build()
		);
		return new EntityHelper( name,
								name,
								tag.name(),
								tag,
								props );
	}

	private FL_Cluster createClusterSummary(String name,
											Hashtable<String, Double> locationDist,
											Hashtable<String, Double> typeDist,
											Hashtable<Double, Double> avTranDist,
											int count,
											int indegree,
											int outdegree) {
		List<FL_Property> props = new ArrayList<FL_Property>();
		props.add(
			new PropertyHelper(
				"inflowing",
				"inflowing",
				indegree,
				Arrays.asList(
					FL_PropertyTag.INFLOWING,
					FL_PropertyTag.AMOUNT,
					FL_PropertyTag.USD
				)
			)
		);
		props.add(
			new PropertyHelper(
				"outflowing",
				"outflowing",
				outdegree,
				Arrays.asList(
					FL_PropertyTag.OUTFLOWING,
					FL_PropertyTag.AMOUNT,
					FL_PropertyTag.USD
				)
			)
		);
		props.add(
			new PropertyHelper(
				"count",
				"count",
				count,
				FL_PropertyType.INTEGER,
				FL_PropertyTag.STAT)
		);

		// create location dist prop
		List<FL_Frequency> freqs = new ArrayList<FL_Frequency>();

		for (String cc : locationDist.keySet()) {
			FL_GeoData geo = FL_GeoData.newBuilder().setText(null).setLat(null).setLon(null).setCc(cc).build();

			double freq = locationDist.get(cc);
			freqs.add(FL_Frequency.newBuilder().setRange(geo).setFrequency(freq).build());
		}

		FL_DistributionRange range = FL_DistributionRange.newBuilder().setDistribution(freqs).setRangeType(FL_RangeType.DISTRIBUTION).setType(FL_PropertyType.GEO ).setIsProbability(false).build();
		props.add( FL_Property.newBuilder()
					.setKey("location-dist")
					.setFriendlyText("location-dist")
					.setRange(range)
					.setProvenance(null)
					.setUncertainty(null)
					.setTags(Arrays.asList(FL_PropertyTag.GEO))
					.build() );

		// create type dist prop
		freqs = new ArrayList<FL_Frequency>();

		for (String type : typeDist.keySet()) {
			double freq = typeDist.get(type);
			freqs.add(FL_Frequency.newBuilder().setRange(type).setFrequency(freq).build());
		}

		range = FL_DistributionRange.newBuilder().setDistribution(freqs).setRangeType(FL_RangeType.DISTRIBUTION).setType(FL_PropertyType.STRING ).setIsProbability(false).build();
		props.add( FL_Property.newBuilder()
					.setKey("type-dist")
					.setFriendlyText("type-dist")
					.setRange(range)
					.setProvenance(null)
					.setUncertainty(null)
					.setTags(Arrays.asList(FL_PropertyTag.TYPE))
					.build() );

		// create avTran dist prop
		freqs = new ArrayList<FL_Frequency>();

		for (Double avTran : avTranDist.keySet()) {
			double freq = avTranDist.get(avTran);
			freqs.add(FL_Frequency.newBuilder().setRange(avTran).setFrequency(freq).build());
		}

		range = FL_DistributionRange.newBuilder().setDistribution(freqs).setRangeType(FL_RangeType.DISTRIBUTION).setType(FL_PropertyType.DOUBLE ).setIsProbability(false).build();
		props.add( FL_Property.newBuilder()
					.setKey("avTran-dist")
					.setFriendlyText("avTran-dist")
					.setRange(range)
					.setProvenance(null)
					.setUncertainty(null)
					.setTags(Arrays.asList(FL_PropertyTag.STAT))
					.build() );

		return new ClusterHelper( InfluentId.fromNativeId(InfluentId.CLUSTER_SUMMARY, "cluster", name).getInfluentId(),
								name,
								Arrays.asList(FL_EntityTag.CLUSTER_SUMMARY),
								props,
								new ArrayList<String>(0),
								new ArrayList<String>(0),
								null,
								null,
								-1 );
	}

	private void assertDistributionEquals(FL_Property property, Hashtable<Object, Double> expected) {
		PropertyHelper helper = PropertyHelper.from(property);

		@SuppressWarnings("unchecked")
		List<FL_Frequency> freqs = (List<FL_Frequency>)helper.getValue();

		for (FL_Frequency freq : freqs) {
			Object key = null;
			if (freq.getRange() instanceof FL_GeoData) {
				key = ((FL_GeoData)freq.getRange()).getCc();
			}
			else {
				key = freq.getRange();
			}
			double count = freq.getFrequency();

			Assert.assertTrue(expected.containsKey(key));
			Assert.assertEquals(expected.get(key), count, 0.0001);
		}
	}

	private void assertPropertyEquals(FL_Property property, int expected) {
		PropertyHelper helper = PropertyHelper.from(property);

		Integer value = (Integer)helper.getValue();

		Assert.assertEquals(expected, (int)value);
	}

	private void assertPropertyEquals(FL_Property property, String expected) {
		PropertyHelper helper = PropertyHelper.from(property);

		String value = (String)helper.getValue();

		Assert.assertEquals(expected, value);
	}

	@Test
	public void testCreateMutableCluster() {
		FL_Cluster cluster = clusterFactory.toCluster( Arrays.asList(entityA, entityB, entityC) );

		Assert.assertEquals(cluster.getMembers().size(), 3);
		Assert.assertEquals(cluster.getSubclusters().size(), 0);
		Assert.assertEquals(cluster.getTags(), Arrays.asList(FL_EntityTag.CLUSTER));

		FL_Property prop = ClusterHelper.getFirstPropertyByTag(cluster,FL_PropertyTag.TYPE);
		Hashtable<Object, Double> dist = new Hashtable<Object, Double>();
		dist.put(FL_EntityTag.ACCOUNT.name(), 2.0);
		dist.put(FL_EntityTag.ANONYMOUS.name(), 1.0);
		assertDistributionEquals(prop, dist);

		prop = ClusterHelper.getFirstPropertyByTag(cluster,FL_PropertyTag.GEO);
		dist = new Hashtable<Object, Double>();
		dist.put("CAN", 2.0);
		dist.put("USA", 1.0);
		assertDistributionEquals(prop, dist);

		prop = ClusterHelper.getFirstProperty(cluster,"avTran-dist");
		dist = new Hashtable<Object, Double>();
		dist.put(200.0, 3.0);
		assertDistributionEquals(prop, dist);

		Assert.assertEquals(1.0, cluster.getUncertainty().getConfidence(), 0.0001);

		prop = ClusterHelper.getFirstPropertyByTag(cluster, FL_PropertyTag.LABEL);
		assertPropertyEquals(prop, "entityA");

		prop = ClusterHelper.getFirstProperty(cluster, "count");
		assertPropertyEquals(prop, 3);

		prop = ClusterHelper.getFirstPropertyByTag(cluster, FL_PropertyTag.INFLOWING);
		assertPropertyEquals(prop, 18);

		prop = ClusterHelper.getFirstPropertyByTag(cluster, FL_PropertyTag.OUTFLOWING);
		assertPropertyEquals(prop, 23);
	}

	@Test
	public void testCreateMutableClusterWithSubCluster() {
		FL_Cluster subcluster = clusterFactory.toCluster( Arrays.asList(entityC, entityD) );
		FL_Cluster cluster = clusterFactory.toCluster( Arrays.asList(entityA, entityB), Arrays.asList(subcluster) );

		Assert.assertEquals(cluster.getMembers().size(), 2);
		Assert.assertEquals(cluster.getSubclusters().size(), 1);
		Assert.assertEquals(cluster.getTags(), Arrays.asList(FL_EntityTag.CLUSTER));

		FL_Property prop = ClusterHelper.getFirstPropertyByTag(cluster,FL_PropertyTag.TYPE);
		Hashtable<Object, Double> dist = new Hashtable<Object, Double>();
		dist.put(FL_EntityTag.ACCOUNT.name(), 3.0);
		dist.put(FL_EntityTag.ANONYMOUS.name(), 1.0);
		assertDistributionEquals(prop, dist);

		prop = ClusterHelper.getFirstPropertyByTag(cluster,FL_PropertyTag.GEO);
		dist = new Hashtable<Object, Double>();
		dist.put("CAN", 2.0);
		dist.put("USA", 2.0);
		assertDistributionEquals(prop, dist);

		prop = ClusterHelper.getFirstProperty(cluster,"avTran-dist");
		dist = new Hashtable<Object, Double>();
		dist.put((650.0/3.0), 4.0);
		assertDistributionEquals(prop, dist);

		Assert.assertEquals(1.0, cluster.getUncertainty().getConfidence(), 0.0001);

		prop = ClusterHelper.getFirstPropertyByTag(cluster, FL_PropertyTag.LABEL);
		assertPropertyEquals(prop, "entityA");

		prop = ClusterHelper.getFirstProperty(cluster, "count");
		assertPropertyEquals(prop, 4);

		prop = ClusterHelper.getFirstPropertyByTag(cluster, FL_PropertyTag.INFLOWING);
		assertPropertyEquals(prop, 35);

		prop = ClusterHelper.getFirstPropertyByTag(cluster, FL_PropertyTag.OUTFLOWING);
		assertPropertyEquals(prop, 42);
	}

	@Test
	public void testCreateMutableClusterWithSubClusterSummary() {
		FL_Cluster cluster = clusterFactory.toCluster( Arrays.asList(entityA, entityB), Arrays.asList(clusterSummaryA) );

		Assert.assertEquals(cluster.getMembers().size(), 2);
		Assert.assertEquals(cluster.getSubclusters().size(), 1);
		Assert.assertEquals(cluster.getTags(), Arrays.asList(FL_EntityTag.CLUSTER));

		FL_Property prop = ClusterHelper.getFirstPropertyByTag(cluster,FL_PropertyTag.TYPE);
		Hashtable<Object, Double> dist = new Hashtable<Object, Double>();
		dist.put(FL_EntityTag.ACCOUNT.name(), 401.0);
		dist.put(FL_EntityTag.ANONYMOUS.name(), 301.0);
		assertDistributionEquals(prop, dist);

		prop = ClusterHelper.getFirstPropertyByTag(cluster,FL_PropertyTag.GEO);
		dist = new Hashtable<Object, Double>();
		dist.put("CAN", 202.0);
		dist.put("USA", 500.0);
		assertDistributionEquals(prop, dist);

		prop = ClusterHelper.getFirstProperty(cluster,"avTran-dist");
		dist = new Hashtable<Object, Double>();
		dist.put((1300.0/3.0), 702.0);
		assertDistributionEquals(prop, dist);

		Assert.assertEquals(1.0, cluster.getUncertainty().getConfidence(), 0.0001);

		prop = ClusterHelper.getFirstPropertyByTag(cluster, FL_PropertyTag.LABEL);
		assertPropertyEquals(prop, "entityA");

		prop = ClusterHelper.getFirstProperty(cluster, "count");
		assertPropertyEquals(prop, 702);

		prop = ClusterHelper.getFirstPropertyByTag(cluster, FL_PropertyTag.INFLOWING);
		assertPropertyEquals(prop, 3007);

		prop = ClusterHelper.getFirstPropertyByTag(cluster, FL_PropertyTag.OUTFLOWING);
		assertPropertyEquals(prop, 7010);
	}

	@Test
	public void testCreateOwnerCluster() {
		FL_Cluster owner = clusterFactory.toAccountOwnerSummary(entityA, Arrays.asList(entityB, entityC), new ArrayList<FL_Cluster>(0));

		Assert.assertEquals(owner.getMembers().size(), 2);
		Assert.assertEquals(owner.getSubclusters().size(), 0);
		Assert.assertEquals(owner.getTags(), Arrays.asList(FL_EntityTag.CLUSTER, FL_EntityTag.ACCOUNT_OWNER));

		FL_Property prop = ClusterHelper.getFirstPropertyByTag(owner,FL_PropertyTag.TYPE);
		Hashtable<Object, Double> dist = new Hashtable<Object, Double>();
		dist.put(FL_EntityTag.ACCOUNT.name(), 1.0);
		dist.put(FL_EntityTag.ANONYMOUS.name(), 1.0);
		assertDistributionEquals(prop, dist);

		prop = ClusterHelper.getFirstPropertyByTag(owner,FL_PropertyTag.GEO);
		dist = new Hashtable<Object, Double>();
		dist.put("CAN", 1.0);
		dist.put("USA", 1.0);
		assertDistributionEquals(prop, dist);

		prop = ClusterHelper.getFirstProperty(owner,"avTran-dist");
		dist = new Hashtable<Object, Double>();
		dist.put(250.0, 2.0);
		assertDistributionEquals(prop, dist);

		Assert.assertEquals(1.0, owner.getUncertainty().getConfidence(), 0.0001);

		prop = ClusterHelper.getFirstPropertyByTag(owner, FL_PropertyTag.LABEL);
		assertPropertyEquals(prop, "entityA");

		prop = ClusterHelper.getFirstProperty(owner, "count");
		assertPropertyEquals(prop, 2);

		prop = ClusterHelper.getFirstPropertyByTag(owner, FL_PropertyTag.INFLOWING);
		assertPropertyEquals(prop, 16);

		prop = ClusterHelper.getFirstPropertyByTag(owner, FL_PropertyTag.OUTFLOWING);
		assertPropertyEquals(prop, 20);
	}

	@Test
	public void testCreateOwnerClusterWithSubCluster() {
		FL_Cluster subcluster = clusterFactory.toCluster(Arrays.asList(entityD), new ArrayList<FL_Cluster>(0));
		FL_Cluster owner = clusterFactory.toAccountOwnerSummary(entityA, Arrays.asList(entityB, entityC), Arrays.asList(subcluster));

		Assert.assertEquals(owner.getMembers().size(), 2);
		Assert.assertEquals(owner.getSubclusters().size(), 1);
		Assert.assertEquals(owner.getTags(), Arrays.asList(FL_EntityTag.CLUSTER, FL_EntityTag.ACCOUNT_OWNER));

		FL_Property prop = ClusterHelper.getFirstPropertyByTag(owner,FL_PropertyTag.TYPE);
		Hashtable<Object, Double> dist = new Hashtable<Object, Double>();
		dist.put(FL_EntityTag.ACCOUNT.name(), 2.0);
		dist.put(FL_EntityTag.ANONYMOUS.name(), 1.0);
		assertDistributionEquals(prop, dist);

		prop = ClusterHelper.getFirstPropertyByTag(owner,FL_PropertyTag.GEO);
		dist = new Hashtable<Object, Double>();
		dist.put("CAN", 1.0);
		dist.put("USA", 2.0);
		assertDistributionEquals(prop, dist);

		prop = ClusterHelper.getFirstProperty(owner,"avTran-dist");
		dist = new Hashtable<Object, Double>();
		dist.put(300.0, 3.0);
		assertDistributionEquals(prop, dist);

		Assert.assertEquals(1.0, owner.getUncertainty().getConfidence(), 0.0001);

		prop = ClusterHelper.getFirstPropertyByTag(owner, FL_PropertyTag.LABEL);
		assertPropertyEquals(prop, "entityA");

		prop = ClusterHelper.getFirstProperty(owner, "count");
		assertPropertyEquals(prop, 3);

		prop = ClusterHelper.getFirstPropertyByTag(owner, FL_PropertyTag.INFLOWING);
		assertPropertyEquals(prop, 33);

		prop = ClusterHelper.getFirstPropertyByTag(owner, FL_PropertyTag.OUTFLOWING);
		assertPropertyEquals(prop, 39);
	}

	@Test
	public void testUpdateMutableCluster() {
		FL_Cluster cluster = clusterFactory.toCluster( Arrays.asList(entityA, entityB) );

		Map<String, FL_Entity> relatedEntities = new Hashtable<String, FL_Entity>();
		relatedEntities.put(entityA.getUid(), entityA);
		relatedEntities.put(entityB.getUid(), entityB);
		relatedEntities.put(entityC.getUid(), entityC);
		Map<String, FL_Cluster> relatedClusters = new Hashtable<String, FL_Cluster>();

		// remove a member
		ClusterHelper.removeMember(cluster, entityA);

		clusterFactory.updateClusterProperties(cluster, relatedEntities, relatedClusters, true);

		Assert.assertEquals(cluster.getMembers().size(), 1);
		Assert.assertEquals(cluster.getSubclusters().size(), 0);
		Assert.assertEquals(cluster.getTags(), Arrays.asList(FL_EntityTag.CLUSTER));

		FL_Property prop = ClusterHelper.getFirstPropertyByTag(cluster,FL_PropertyTag.TYPE);
		Hashtable<Object, Double> dist = new Hashtable<Object, Double>();
		dist.put(FL_EntityTag.ANONYMOUS.name(), 1.0);
		assertDistributionEquals(prop, dist);

		prop = ClusterHelper.getFirstPropertyByTag(cluster,FL_PropertyTag.GEO);
		dist = new Hashtable<Object, Double>();
		dist.put("CAN", 1.0);
		assertDistributionEquals(prop, dist);

		prop = ClusterHelper.getFirstProperty(cluster,"avTran-dist");
		dist = new Hashtable<Object, Double>();
		dist.put(200.0, 1.0);
		assertDistributionEquals(prop, dist);

		Assert.assertEquals(1.0, cluster.getUncertainty().getConfidence(), 0.0001);

		prop = ClusterHelper.getFirstPropertyByTag(cluster, FL_PropertyTag.LABEL);
		assertPropertyEquals(prop, "entityA");

		prop = ClusterHelper.getFirstProperty(cluster, "count");
		assertPropertyEquals(prop, 1);

		prop = ClusterHelper.getFirstPropertyByTag(cluster, FL_PropertyTag.INFLOWING);
		assertPropertyEquals(prop, 5);

		prop = ClusterHelper.getFirstPropertyByTag(cluster, FL_PropertyTag.OUTFLOWING);
		assertPropertyEquals(prop, 7);

		// add a member
		ClusterHelper.addMember(cluster, entityC);

		clusterFactory.updateClusterProperties(cluster, relatedEntities, relatedClusters, true);

		Assert.assertEquals(cluster.getMembers().size(), 2);
		Assert.assertEquals(cluster.getSubclusters().size(), 0);
		Assert.assertEquals(cluster.getTags(), Arrays.asList(FL_EntityTag.CLUSTER));

		prop = ClusterHelper.getFirstPropertyByTag(cluster,FL_PropertyTag.TYPE);
		dist = new Hashtable<Object, Double>();
		dist.put(FL_EntityTag.ACCOUNT.name(), 1.0);
		dist.put(FL_EntityTag.ANONYMOUS.name(), 1.0);
		assertDistributionEquals(prop, dist);

		prop = ClusterHelper.getFirstPropertyByTag(cluster,FL_PropertyTag.GEO);
		dist = new Hashtable<Object, Double>();
		dist.put("CAN", 1.0);
		dist.put("USA", 1.0);
		assertDistributionEquals(prop, dist);

		prop = ClusterHelper.getFirstProperty(cluster,"avTran-dist");
		dist = new Hashtable<Object, Double>();
		dist.put(250.0, 2.0);
		assertDistributionEquals(prop, dist);

		Assert.assertEquals(1.0, cluster.getUncertainty().getConfidence(), 0.0001);

		prop = ClusterHelper.getFirstPropertyByTag(cluster, FL_PropertyTag.LABEL);
		assertPropertyEquals(prop, "entityA");

		prop = ClusterHelper.getFirstProperty(cluster, "count");
		assertPropertyEquals(prop, 2);

		prop = ClusterHelper.getFirstPropertyByTag(cluster, FL_PropertyTag.INFLOWING);
		assertPropertyEquals(prop, 16);

		prop = ClusterHelper.getFirstPropertyByTag(cluster, FL_PropertyTag.OUTFLOWING);
		assertPropertyEquals(prop, 20);
	}

	@Test
	public void testUpdateMutableClusterWithSubCluster() {
		FL_Cluster subcluster = clusterFactory.toCluster( Arrays.asList(entityC, entityD) );
		FL_Cluster cluster = clusterFactory.toCluster( Arrays.asList(entityA, entityB), Arrays.asList(subcluster) );

		Map<String, FL_Entity> relatedEntities = new Hashtable<String, FL_Entity>();
		relatedEntities.put(entityA.getUid(), entityA);
		relatedEntities.put(entityB.getUid(), entityB);
		relatedEntities.put(entityC.getUid(), entityC);
		relatedEntities.put(entityD.getUid(), entityD);
		Map<String, FL_Cluster> relatedClusters = new Hashtable<String, FL_Cluster>();
		relatedClusters.put(subcluster.getUid(), subcluster);

		// remove subcluster
		ClusterHelper.removeSubCluster(cluster, subcluster);

		clusterFactory.updateClusterProperties(cluster, relatedEntities, relatedClusters, true);

		Assert.assertEquals(cluster.getMembers().size(), 2);
		Assert.assertEquals(cluster.getSubclusters().size(), 0);
		Assert.assertEquals(cluster.getTags(), Arrays.asList(FL_EntityTag.CLUSTER));

		FL_Property prop = ClusterHelper.getFirstPropertyByTag(cluster,FL_PropertyTag.TYPE);
		Hashtable<Object, Double> dist = new Hashtable<Object, Double>();
		dist.put(FL_EntityTag.ACCOUNT.name(), 1.0);
		dist.put(FL_EntityTag.ANONYMOUS.name(), 1.0);
		assertDistributionEquals(prop, dist);

		prop = ClusterHelper.getFirstPropertyByTag(cluster,FL_PropertyTag.GEO);
		dist = new Hashtable<Object, Double>();
		dist.put("CAN", 2.0);
		assertDistributionEquals(prop, dist);

		prop = ClusterHelper.getFirstProperty(cluster,"avTran-dist");
		dist = new Hashtable<Object, Double>();
		dist.put(150.0, 2.0);
		assertDistributionEquals(prop, dist);

		Assert.assertEquals(1.0, cluster.getUncertainty().getConfidence(), 0.0001);

		prop = ClusterHelper.getFirstPropertyByTag(cluster, FL_PropertyTag.LABEL);
		assertPropertyEquals(prop, "entityA");

		prop = ClusterHelper.getFirstProperty(cluster, "count");
		assertPropertyEquals(prop, 2);

		prop = ClusterHelper.getFirstPropertyByTag(cluster, FL_PropertyTag.INFLOWING);
		assertPropertyEquals(prop, 7);

		prop = ClusterHelper.getFirstPropertyByTag(cluster, FL_PropertyTag.OUTFLOWING);
		assertPropertyEquals(prop, 10);

		// add subcluster
		ClusterHelper.addSubCluster(cluster, subcluster);

		clusterFactory.updateClusterProperties(cluster, relatedEntities, relatedClusters, true);

		Assert.assertEquals(cluster.getMembers().size(), 2);
		Assert.assertEquals(cluster.getSubclusters().size(), 1);
		Assert.assertEquals(cluster.getTags(), Arrays.asList(FL_EntityTag.CLUSTER));

		prop = ClusterHelper.getFirstPropertyByTag(cluster,FL_PropertyTag.TYPE);
		dist = new Hashtable<Object, Double>();
		dist.put(FL_EntityTag.ACCOUNT.name(), 3.0);
		dist.put(FL_EntityTag.ANONYMOUS.name(), 1.0);
		assertDistributionEquals(prop, dist);

		prop = ClusterHelper.getFirstPropertyByTag(cluster,FL_PropertyTag.GEO);
		dist = new Hashtable<Object, Double>();
		dist.put("CAN", 2.0);
		dist.put("USA", 2.0);
		assertDistributionEquals(prop, dist);

		prop = ClusterHelper.getFirstProperty(cluster,"avTran-dist");
		dist = new Hashtable<Object, Double>();
		dist.put((650.0/3.0), 4.0);
		assertDistributionEquals(prop, dist);

		Assert.assertEquals(1.0, cluster.getUncertainty().getConfidence(), 0.0001);

		prop = ClusterHelper.getFirstPropertyByTag(cluster, FL_PropertyTag.LABEL);
		assertPropertyEquals(prop, "entityA");

		prop = ClusterHelper.getFirstProperty(cluster, "count");
		assertPropertyEquals(prop, 4);

		prop = ClusterHelper.getFirstPropertyByTag(cluster, FL_PropertyTag.INFLOWING);
		assertPropertyEquals(prop, 35);

		prop = ClusterHelper.getFirstPropertyByTag(cluster, FL_PropertyTag.OUTFLOWING);
		assertPropertyEquals(prop, 42);

		// remove subcluster member
		ClusterHelper.removeMember(subcluster, entityC);

		clusterFactory.updateClusterProperties(cluster, relatedEntities, relatedClusters, true);

		Assert.assertEquals(cluster.getMembers().size(), 2);
		Assert.assertEquals(cluster.getSubclusters().size(), 1);
		Assert.assertEquals(cluster.getTags(), Arrays.asList(FL_EntityTag.CLUSTER));

		prop = ClusterHelper.getFirstPropertyByTag(cluster,FL_PropertyTag.TYPE);
		dist = new Hashtable<Object, Double>();
		dist.put(FL_EntityTag.ACCOUNT.name(), 2.0);
		dist.put(FL_EntityTag.ANONYMOUS.name(), 1.0);
		assertDistributionEquals(prop, dist);

		prop = ClusterHelper.getFirstPropertyByTag(cluster,FL_PropertyTag.GEO);
		dist = new Hashtable<Object, Double>();
		dist.put("CAN", 2.0);
		dist.put("USA", 1.0);
		assertDistributionEquals(prop, dist);

		prop = ClusterHelper.getFirstProperty(cluster,"avTran-dist");
		dist = new Hashtable<Object, Double>();
		dist.put((700.0/3.0), 3.0);
		assertDistributionEquals(prop, dist);

		Assert.assertEquals(1.0, cluster.getUncertainty().getConfidence(), 0.0001);

		prop = ClusterHelper.getFirstPropertyByTag(cluster, FL_PropertyTag.LABEL);
		assertPropertyEquals(prop, "entityA");

		prop = ClusterHelper.getFirstProperty(cluster, "count");
		assertPropertyEquals(prop, 3);

		prop = ClusterHelper.getFirstPropertyByTag(cluster, FL_PropertyTag.INFLOWING);
		assertPropertyEquals(prop, 24);

		prop = ClusterHelper.getFirstPropertyByTag(cluster, FL_PropertyTag.OUTFLOWING);
		assertPropertyEquals(prop, 29);

		Assert.assertEquals(subcluster.getMembers().size(), 1);
		Assert.assertEquals(subcluster.getSubclusters().size(), 0);
		Assert.assertEquals(subcluster.getTags(), Arrays.asList(FL_EntityTag.CLUSTER));

		prop = ClusterHelper.getFirstPropertyByTag(subcluster,FL_PropertyTag.TYPE);
		dist = new Hashtable<Object, Double>();
		dist.put(FL_EntityTag.ACCOUNT.name(), 1.0);
		assertDistributionEquals(prop, dist);

		prop = ClusterHelper.getFirstPropertyByTag(subcluster,FL_PropertyTag.GEO);
		dist = new Hashtable<Object, Double>();
		dist.put("USA", 1.0);
		assertDistributionEquals(prop, dist);

		Assert.assertEquals(1.0, subcluster.getUncertainty().getConfidence(), 0.0001);

		prop = ClusterHelper.getFirstPropertyByTag(subcluster, FL_PropertyTag.LABEL);
		assertPropertyEquals(prop, "entityC");

		prop = ClusterHelper.getFirstProperty(subcluster, "count");
		assertPropertyEquals(prop, 1);

		prop = ClusterHelper.getFirstPropertyByTag(subcluster, FL_PropertyTag.INFLOWING);
		assertPropertyEquals(prop, 17);

		prop = ClusterHelper.getFirstPropertyByTag(subcluster, FL_PropertyTag.OUTFLOWING);
		assertPropertyEquals(prop, 19);
	}

	@Test
	public void testUpdateMutableClusterWithSubClusterSummary() {
		FL_Cluster cluster = clusterFactory.toCluster( Arrays.asList(entityA, entityB), Arrays.asList(clusterSummaryA) );

		Map<String, FL_Entity> relatedEntities = new Hashtable<String, FL_Entity>();
		relatedEntities.put(entityA.getUid(), entityA);
		relatedEntities.put(entityB.getUid(), entityB);
		relatedEntities.put(entityC.getUid(), entityC);
		relatedEntities.put(entityD.getUid(), entityD);
		Map<String, FL_Cluster> relatedClusters = new Hashtable<String, FL_Cluster>();
		relatedClusters.put(clusterSummaryA.getUid(), clusterSummaryA);

		// remove entity
		ClusterHelper.removeMember(cluster, entityA);

		clusterFactory.updateClusterProperties(cluster, relatedEntities, relatedClusters, true);

		Assert.assertEquals(cluster.getMembers().size(), 1);
		Assert.assertEquals(cluster.getSubclusters().size(), 1);
		Assert.assertEquals(cluster.getTags(), Arrays.asList(FL_EntityTag.CLUSTER));

		FL_Property prop = ClusterHelper.getFirstPropertyByTag(cluster,FL_PropertyTag.TYPE);
		Hashtable<Object, Double> dist = new Hashtable<Object, Double>();
		dist.put(FL_EntityTag.ACCOUNT.name(), 400.0);
		dist.put(FL_EntityTag.ANONYMOUS.name(), 301.0);
		assertDistributionEquals(prop, dist);

		prop = ClusterHelper.getFirstPropertyByTag(cluster,FL_PropertyTag.GEO);
		dist = new Hashtable<Object, Double>();
		dist.put("CAN", 201.0);
		dist.put("USA", 500.0);
		assertDistributionEquals(prop, dist);

		prop = ClusterHelper.getFirstProperty(cluster,"avTran-dist");
		dist = new Hashtable<Object, Double>();
		dist.put(600.0, 701.0);
		assertDistributionEquals(prop, dist);

		Assert.assertEquals(1.0, cluster.getUncertainty().getConfidence(), 0.0001);

		prop = ClusterHelper.getFirstPropertyByTag(cluster, FL_PropertyTag.LABEL);
		assertPropertyEquals(prop, "entityA");

		prop = ClusterHelper.getFirstProperty(cluster, "count");
		assertPropertyEquals(prop, 701);

		prop = ClusterHelper.getFirstPropertyByTag(cluster, FL_PropertyTag.INFLOWING);
		assertPropertyEquals(prop, 3005);

		prop = ClusterHelper.getFirstPropertyByTag(cluster, FL_PropertyTag.OUTFLOWING);
		assertPropertyEquals(prop, 7007);

		Assert.assertEquals(clusterSummaryA.getMembers().size(), 0);
		Assert.assertEquals(clusterSummaryA.getSubclusters().size(), 0);
		Assert.assertEquals(clusterSummaryA.getTags(), Arrays.asList(FL_EntityTag.CLUSTER_SUMMARY));

		prop = ClusterHelper.getFirstPropertyByTag(clusterSummaryA,FL_PropertyTag.TYPE);
		dist = new Hashtable<Object, Double>();
		dist.put(FL_EntityTag.ACCOUNT.name(), 400.0);
		dist.put(FL_EntityTag.ANONYMOUS.name(), 300.0);
		assertDistributionEquals(prop, dist);

		prop = ClusterHelper.getFirstPropertyByTag(clusterSummaryA,FL_PropertyTag.GEO);
		dist = new Hashtable<Object, Double>();
		dist.put("CAN", 200.0);
		dist.put("USA", 500.0);
		assertDistributionEquals(prop, dist);

		prop = ClusterHelper.getFirstPropertyByTag(clusterSummaryA, FL_PropertyTag.LABEL);
		assertPropertyEquals(prop, "clusterSummaryA");

		prop = ClusterHelper.getFirstProperty(clusterSummaryA, "count");
		assertPropertyEquals(prop, 700);

		prop = ClusterHelper.getFirstPropertyByTag(clusterSummaryA, FL_PropertyTag.INFLOWING);
		assertPropertyEquals(prop, 3000);

		prop = ClusterHelper.getFirstPropertyByTag(clusterSummaryA, FL_PropertyTag.OUTFLOWING);
		assertPropertyEquals(prop, 7000);
	}

	@Test
	public void testUpdateOwnerCluster() {
		FL_Cluster owner = clusterFactory.toAccountOwnerSummary(entityA, Arrays.asList(entityB, entityC), new ArrayList<FL_Cluster>(0));

		Map<String, FL_Entity> relatedEntities = new Hashtable<String, FL_Entity>();
		relatedEntities.put(entityA.getUid(), entityA);
		relatedEntities.put(entityB.getUid(), entityB);
		relatedEntities.put(entityC.getUid(), entityC);
		Map<String, FL_Cluster> relatedClusters = new Hashtable<String, FL_Cluster>();

		// remove member
		ClusterHelper.removeMember(owner, entityB);

		clusterFactory.updateClusterProperties(owner, relatedEntities, relatedClusters, true);

		Assert.assertEquals(owner.getMembers().size(), 1);
		Assert.assertEquals(owner.getSubclusters().size(), 0);
		Assert.assertEquals(owner.getTags(), Arrays.asList(FL_EntityTag.CLUSTER, FL_EntityTag.ACCOUNT_OWNER));

		FL_Property prop = ClusterHelper.getFirstPropertyByTag(owner,FL_PropertyTag.TYPE);
		Hashtable<Object, Double> dist = new Hashtable<Object, Double>();
		dist.put(FL_EntityTag.ACCOUNT.name(), 1.0);
		assertDistributionEquals(prop, dist);

		prop = ClusterHelper.getFirstPropertyByTag(owner,FL_PropertyTag.GEO);
		dist = new Hashtable<Object, Double>();
		dist.put("USA", 1.0);
		assertDistributionEquals(prop, dist);

		prop = ClusterHelper.getFirstProperty(owner,"avTran-dist");
		dist = new Hashtable<Object, Double>();
		dist.put(300.0, 1.0);
		assertDistributionEquals(prop, dist);

		Assert.assertEquals(1.0, owner.getUncertainty().getConfidence(), 0.0001);

		prop = ClusterHelper.getFirstPropertyByTag(owner, FL_PropertyTag.LABEL);
		assertPropertyEquals(prop, "entityA");

		prop = ClusterHelper.getFirstProperty(owner, "count");
		assertPropertyEquals(prop, 1);

		prop = ClusterHelper.getFirstPropertyByTag(owner, FL_PropertyTag.INFLOWING);
		assertPropertyEquals(prop, 11);

		prop = ClusterHelper.getFirstPropertyByTag(owner, FL_PropertyTag.OUTFLOWING);
		assertPropertyEquals(prop, 13);

		// add member
		ClusterHelper.addMember(owner, entityB);

		clusterFactory.updateClusterProperties(owner, relatedEntities, relatedClusters, true);

		Assert.assertEquals(owner.getMembers().size(), 2);
		Assert.assertEquals(owner.getSubclusters().size(), 0);
		Assert.assertEquals(owner.getTags(), Arrays.asList(FL_EntityTag.CLUSTER, FL_EntityTag.ACCOUNT_OWNER));

		prop = ClusterHelper.getFirstPropertyByTag(owner,FL_PropertyTag.TYPE);
		dist = new Hashtable<Object, Double>();
		dist.put(FL_EntityTag.ACCOUNT.name(), 1.0);
		dist.put(FL_EntityTag.ANONYMOUS.name(), 1.0);
		assertDistributionEquals(prop, dist);

		prop = ClusterHelper.getFirstPropertyByTag(owner,FL_PropertyTag.GEO);
		dist = new Hashtable<Object, Double>();
		dist.put("CAN", 1.0);
		dist.put("USA", 1.0);
		assertDistributionEquals(prop, dist);

		prop = ClusterHelper.getFirstProperty(owner,"avTran-dist");
		dist = new Hashtable<Object, Double>();
		dist.put(250.0, 2.0);
		assertDistributionEquals(prop, dist);

		Assert.assertEquals(1.0, owner.getUncertainty().getConfidence(), 0.0001);

		prop = ClusterHelper.getFirstPropertyByTag(owner, FL_PropertyTag.LABEL);
		assertPropertyEquals(prop, "entityA");

		prop = ClusterHelper.getFirstProperty(owner, "count");
		assertPropertyEquals(prop, 2);

		prop = ClusterHelper.getFirstPropertyByTag(owner, FL_PropertyTag.INFLOWING);
		assertPropertyEquals(prop, 16);

		prop = ClusterHelper.getFirstPropertyByTag(owner, FL_PropertyTag.OUTFLOWING);
		assertPropertyEquals(prop, 20);
	}

	@Test
	public void testUpdateOwnerClusterWithSubClusters() {
		FL_Cluster subcluster = clusterFactory.toCluster( Arrays.asList(entityD) );
		FL_Cluster owner = clusterFactory.toAccountOwnerSummary(entityA, Arrays.asList(entityB, entityC), Arrays.asList(subcluster));

		Map<String, FL_Entity> relatedEntities = new Hashtable<String, FL_Entity>();
		relatedEntities.put(entityA.getUid(), entityA);
		relatedEntities.put(entityB.getUid(), entityB);
		relatedEntities.put(entityC.getUid(), entityC);
		relatedEntities.put(entityD.getUid(), entityD);
		Map<String, FL_Cluster> relatedClusters = new Hashtable<String, FL_Cluster>();
		relatedClusters.put(subcluster.getUid(), subcluster);

		// remove subcluster
		ClusterHelper.removeSubCluster(owner, subcluster);

		clusterFactory.updateClusterProperties(owner, relatedEntities, relatedClusters, true);

		Assert.assertEquals(owner.getMembers().size(), 2);
		Assert.assertEquals(owner.getSubclusters().size(), 0);
		Assert.assertEquals(owner.getTags(), Arrays.asList(FL_EntityTag.CLUSTER, FL_EntityTag.ACCOUNT_OWNER));

		FL_Property prop = ClusterHelper.getFirstPropertyByTag(owner,FL_PropertyTag.TYPE);
		Hashtable<Object, Double> dist = new Hashtable<Object, Double>();
		dist.put(FL_EntityTag.ANONYMOUS.name(), 1.0);
		dist.put(FL_EntityTag.ACCOUNT.name(), 1.0);
		assertDistributionEquals(prop, dist);

		prop = ClusterHelper.getFirstPropertyByTag(owner,FL_PropertyTag.GEO);
		dist = new Hashtable<Object, Double>();
		dist.put("CAN", 1.0);
		dist.put("USA", 1.0);
		assertDistributionEquals(prop, dist);

		prop = ClusterHelper.getFirstProperty(owner,"avTran-dist");
		dist = new Hashtable<Object, Double>();
		dist.put(250.0, 2.0);
		assertDistributionEquals(prop, dist);

		Assert.assertEquals(1.0, owner.getUncertainty().getConfidence(), 0.0001);

		prop = ClusterHelper.getFirstPropertyByTag(owner, FL_PropertyTag.LABEL);
		assertPropertyEquals(prop, "entityA");

		prop = ClusterHelper.getFirstProperty(owner, "count");
		assertPropertyEquals(prop, 2);

		prop = ClusterHelper.getFirstPropertyByTag(owner, FL_PropertyTag.INFLOWING);
		assertPropertyEquals(prop, 16);

		prop = ClusterHelper.getFirstPropertyByTag(owner, FL_PropertyTag.OUTFLOWING);
		assertPropertyEquals(prop, 20);

		// add subcluster
		ClusterHelper.addSubCluster(owner, subcluster);

		clusterFactory.updateClusterProperties(owner, relatedEntities, relatedClusters, true);

		Assert.assertEquals(owner.getMembers().size(), 2);
		Assert.assertEquals(owner.getSubclusters().size(), 1);
		Assert.assertEquals(owner.getTags(), Arrays.asList(FL_EntityTag.CLUSTER, FL_EntityTag.ACCOUNT_OWNER));

		prop = ClusterHelper.getFirstPropertyByTag(owner,FL_PropertyTag.TYPE);
		dist = new Hashtable<Object, Double>();
		dist.put(FL_EntityTag.ACCOUNT.name(), 2.0);
		dist.put(FL_EntityTag.ANONYMOUS.name(), 1.0);
		assertDistributionEquals(prop, dist);

		prop = ClusterHelper.getFirstPropertyByTag(owner,FL_PropertyTag.GEO);
		dist = new Hashtable<Object, Double>();
		dist.put("CAN", 1.0);
		dist.put("USA", 2.0);
		assertDistributionEquals(prop, dist);

		prop = ClusterHelper.getFirstProperty(owner,"avTran-dist");
		dist = new Hashtable<Object, Double>();
		dist.put(300.0, 3.0);
		assertDistributionEquals(prop, dist);

		Assert.assertEquals(1.0, owner.getUncertainty().getConfidence(), 0.0001);

		prop = ClusterHelper.getFirstPropertyByTag(owner, FL_PropertyTag.LABEL);
		assertPropertyEquals(prop, "entityA");

		prop = ClusterHelper.getFirstProperty(owner, "count");
		assertPropertyEquals(prop, 3);

		prop = ClusterHelper.getFirstPropertyByTag(owner, FL_PropertyTag.INFLOWING);
		assertPropertyEquals(prop, 33);

		prop = ClusterHelper.getFirstPropertyByTag(owner, FL_PropertyTag.OUTFLOWING);
		assertPropertyEquals(prop, 39);
	}
}

redpajama_set_name: RedPajamaGithub


text:
package specs.bowling.tiros;

import org.concordion.integration.junit4.ConcordionRunner;
import org.junit.runner.RunWith;

@RunWith(ConcordionRunner.class)
public class TirosFixture {

}


text: Scala code editor


text:
package org.apache.jackrabbit.oak.spi.gc;

import org.apache.jackrabbit.oak.spi.whiteboard.AbstractServiceTracker;
import org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard;

/**
 * This {@link GCMonitor} implementation tracks {@code GCMonitor} instances registered
 * to the {@link Whiteboard} delegating all calls to to those.
 */
public class GCMonitorTracker extends AbstractServiceTracker<GCMonitor> implements GCMonitor {
    public GCMonitorTracker() {
        super(GCMonitor.class);
    }

    @Override
    public void info(String message, Object... arguments) {
        for (GCMonitor gcMonitor : getServices()) {
            gcMonitor.info(message, arguments);
        }
    }

    @Override
    public void warn(String message, Object... arguments) {
        for (GCMonitor gcMonitor : getServices()) {
            gcMonitor.warn(message, arguments);
        }
    }

    @Override
    public void error(String message, Exception e) {
        for (GCMonitor gcMonitor : getServices()) {
            gcMonitor.error(message, e);
        }
    }

    @Override
    public void skipped(String message, Object... arguments) {
        for (GCMonitor gcMonitor : getServices()) {
            gcMonitor.skipped(message, arguments);
        }
    }

    @Override
    public void compacted() {
        for (GCMonitor gcMonitor : getServices()) {
            gcMonitor.compacted();
        }
    }

    @Override
    public void cleaned(long reclaimedSize, long currentSize) {
        for (GCMonitor gcMonitor : getServices()) {
            gcMonitor.cleaned(reclaimedSize, currentSize);
        }
    }

    @Override
    public void updateStatus(String status) {
        for (GCMonitor gcMonitor : getServices()) {
            gcMonitor.updateStatus(status);
        }
    }
}


text:
package space.hideaway.model;

import javax.persistence.*;
import java.util.Set;

/**
 * The type Role.
 */
@Entity
@Table(name = "role")
public class Role {

    private Long id;

    private String name;

    private Set<User> userSet;

    /**
     * Gets id.
     *
     * @return the id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    public Long getId() {
        return id;
    }

    /**
     * Sets id.
     *
     * @param id the id
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * Gets name.
     *
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * Sets name.
     *
     * @param name the name
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * Gets user set.
     *
     * @return the user set
     */
    @ManyToMany(mappedBy = "roleSet")
    public Set<User> getUserSet() {
        return userSet;
    }

    /**
     * Sets user set.
     *
     * @param userSet the user set
     */
    public void setUserSet(Set<User> userSet) {
        this.userSet = userSet;
    }
}


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width initial-scale=1" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge">

  <title>Welcome to the Macroevolution Group!</title>
  <meta name="description" content="Thomas lab at the University of Sheffield">
  <meta name="author" content="Gavin Thomas">
  <meta name="HandheldFriendly" content="True">
  <meta name="MobileOptimized" content="320">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

  <meta name="twitter:card" content="summary">
  <meta name="twitter:title" content="Macroevolution Group">
  <meta name="twitter:description" content="Thomas lab at the University of Sheffield">

  <meta property="og:type" content="article">
  <meta property="og:title" content="Macroevolution Group">
  <meta property="og:description" content="Thomas lab at the University of Sheffield">

  <link rel="apple-touch-icon" sizes="57x57" href="/ghthomas.github.io/images/favicons/apple-touch-icon-57x57.png">
  <link rel="apple-touch-icon" sizes="60x60" href="/ghthomas.github.io/images/favicons/apple-touch-icon-60x60.png">
  <link rel="apple-touch-icon" sizes="72x72" href="/ghthomas.github.io/images/favicons/apple-touch-icon-72x72.png">
  <link rel="apple-touch-icon" sizes="76x76" href="/ghthomas.github.io/images/favicons/apple-touch-icon-76x76.png">
  <link rel="apple-touch-icon" sizes="114x114" href="/ghthomas.github.io/images/favicons/apple-touch-icon-114x114.png">
  <link rel="apple-touch-icon" sizes="120x120" href="/ghthomas.github.io/images/favicons/apple-touch-icon-120x120.png">
  <link rel="apple-touch-icon" sizes="144x144" href="/ghthomas.github.io/images/favicons/apple-touch-icon-144x144.png">
  <link rel="apple-touch-icon" sizes="152x152" href="/ghthomas.github.io/images/favicons/apple-touch-icon-152x152.png">
  <link rel="apple-touch-icon" sizes="180x180" href="/ghthomas.github.io/images/favicons/apple-touch-icon-180x180.png">
  <link rel="icon" type="image/png" href="/ghthomas.github.io/images/favicons/favicon-32x32.png" sizes="32x32">
  <link rel="icon" type="image/png" href="/ghthomas.github.io/images/favicons/favicon-194x194.png" sizes="194x194">
  <link rel="icon" type="image/png" href="/ghthomas.github.io/images/favicons/favicon-96x96.png" sizes="96x96">
  <link rel="icon" type="image/png" href="/ghthomas.github.io/images/favicons/android-chrome-192x192.png" sizes="192x192">
  <link rel="icon" type="image/png" href="/ghthomas.github.io/images/favicons/favicon-16x16.png" sizes="16x16">
  <link rel="manifest" href="/ghthomas.github.io/images/favicons/manifest.json">
  <link rel="shortcut icon" href="/ghthomas.github.io/images/favicons/favicon.ico">
  <meta name="msapplication-TileColor" content="#ffc40d">
  <meta name="msapplication-TileImage" content="/ghthomas.github.io/images/favicons/mstile-144x144.png">
  <meta name="theme-color" content="#ffffff">

  <link rel="stylesheet" href="/ghthomas.github.io/css/main.css">
  <link rel="canonical" href="http://joshgerdes.com/jekyll-uno/ghthomas.github.io//2016/welcome-to-jekyll/">
  <link rel="alternate" type="application/rss+xml" title="Macroevolution Group" href="/ghthomas.github.io/feed.xml">

Macroevolution Group

Thomas lab at the University of Sheffield

About

People

                  Twitter

                  GitHub

                  Email

                RSS

      <time datetime="8 Jan 2016" class="post-meta__date date">8 Jan 2016</time> • on jekyll

Welcome to the Macroevolution Group!

You'll find this post in your _posts directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run jekyll serve --watch, which launches a web server and auto-regenerates your site when a file is updated.

To add new posts, simply add a file in the _posts directory that follows the convention YYYY-MM-DD-name-of-post.ext and includes the necessary front matter. Take a look at the source for this post to get an idea about how it works.

Jekyll also offers powerful support for code snippets:

def print_hi(name)
  puts "Hi, #{name}"
end
print_hi('Tom')
#=> prints 'Hi, Tom' to STDOUT.

Check out the Jekyll docs for more info on how to get the most out of Jekyll. File all bugs/feature requests at Jekyll's GitHub repo. If you have questions, you can ask them on Jekyll's dedicated Help repository.

  © 2017 Gavin Thomas. All rights reserved.


text:
#include "SkImageDecoder.h"
#include "SkBitmap.h"
#include "SkImagePriv.h"
#include "SkPixelRef.h"
#include "SkStream.h"
#include "SkTemplates.h"
#include "SkCanvas.h"

SkImageDecoder::SkImageDecoder()
    : fPeeker(NULL)
#ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER
    , fChooser(NULL)
#endif
    , fAllocator(NULL)
    , fSampleSize(1)
    , fDefaultPref(kUnknown_SkColorType)
    , fPreserveSrcDepth(false)
    , fDitherImage(true)
    , fSkipWritingZeroes(false)
    , fPreferQualityOverSpeed(false)
    , fRequireUnpremultipliedColors(false) {
}

SkImageDecoder::~SkImageDecoder() {
    SkSafeUnref(fPeeker);
#ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER
    SkSafeUnref(fChooser);
#endif
    SkSafeUnref(fAllocator);
}

void SkImageDecoder::copyFieldsToOther(SkImageDecoder* other) {
    if (NULL == other) {
        return;
    }
    other->setPeeker(fPeeker);
#ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER
    other->setChooser(fChooser);
#endif
    other->setAllocator(fAllocator);
    other->setSampleSize(fSampleSize);
    other->setPreserveSrcDepth(fPreserveSrcDepth);
    other->setDitherImage(fDitherImage);
    other->setSkipWritingZeroes(fSkipWritingZeroes);
    other->setPreferQualityOverSpeed(fPreferQualityOverSpeed);
    other->setRequireUnpremultipliedColors(fRequireUnpremultipliedColors);
}

SkImageDecoder::Format SkImageDecoder::getFormat() const {
    return kUnknown_Format;
}

const char* SkImageDecoder::getFormatName() const {
    return GetFormatName(this->getFormat());
}

const char* SkImageDecoder::GetFormatName(Format format) {
    switch (format) {
        case kUnknown_Format:
            return "Unknown Format";
        case kBMP_Format:
            return "BMP";
        case kGIF_Format:
            return "GIF";
        case kICO_Format:
            return "ICO";
        case kPKM_Format:
            return "PKM";
        case kKTX_Format:
            return "KTX";
        case kASTC_Format:
            return "ASTC";
        case kJPEG_Format:
            return "JPEG";
        case kPNG_Format:
            return "PNG";
        case kWBMP_Format:
            return "WBMP";
        case kWEBP_Format:
            return "WEBP";
        default:
            SkDEBUGFAIL("Invalid format type!");
    }
    return "Unknown Format";
}

SkImageDecoder::Peeker* SkImageDecoder::setPeeker(Peeker* peeker) {
    SkRefCnt_SafeAssign(fPeeker, peeker);
    return peeker;
}

#ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER
SkImageDecoder::Chooser* SkImageDecoder::setChooser(Chooser* chooser) {
    SkRefCnt_SafeAssign(fChooser, chooser);
    return chooser;
}
#endif

SkBitmap::Allocator* SkImageDecoder::setAllocator(SkBitmap::Allocator* alloc) {
    SkRefCnt_SafeAssign(fAllocator, alloc);
    return alloc;
}

void SkImageDecoder::setSampleSize(int size) {
    if (size < 1) {
        size = 1;
    }
    fSampleSize = size;
}

#ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER
// TODO: change Chooser virtual to take colorType, so we can stop calling SkColorTypeToBitmapConfig
//
bool SkImageDecoder::chooseFromOneChoice(SkColorType colorType, int width, int height) const {
    Chooser* chooser = fChooser;

    if (NULL == chooser) {    // no chooser, we just say YES to decoding :)
        return true;
    }
    chooser->begin(1);
    chooser->inspect(0, SkColorTypeToBitmapConfig(colorType), width, height);
    return chooser->choose() == 0;
}
#endif

bool SkImageDecoder::allocPixelRef(SkBitmap* bitmap,
                                   SkColorTable* ctable) const {
    return bitmap->tryAllocPixels(fAllocator, ctable);
}

///////////////////////////////////////////////////////////////////////////////

SkColorType SkImageDecoder::getPrefColorType(SrcDepth srcDepth, bool srcHasAlpha) const {
    SkColorType ct = fDefaultPref;
    if (fPreserveSrcDepth) {
        switch (srcDepth) {
            case kIndex_SrcDepth:
                ct = kIndex_8_SkColorType;
                break;
            case k8BitGray_SrcDepth:
                ct = kN32_SkColorType;
                break;
            case k32Bit_SrcDepth:
                ct = kN32_SkColorType;
                break;
        }
    }
    return ct;
}

bool SkImageDecoder::decode(SkStream* stream, SkBitmap* bm, SkColorType pref, Mode mode) {
    // we reset this to false before calling onDecode
    fShouldCancelDecode = false;
    // assign this, for use by getPrefColorType(), in case fUsePrefTable is false
    fDefaultPref = pref;

    // pass a temporary bitmap, so that if we return false, we are assured of
    // leaving the caller's bitmap untouched.
    SkBitmap    tmp;
    if (!this->onDecode(stream, &tmp, mode)) {
        return false;
    }
    bm->swap(tmp);
    return true;
}

bool SkImageDecoder::decodeSubset(SkBitmap* bm, const SkIRect& rect, SkColorType pref) {
    // we reset this to false before calling onDecodeSubset
    fShouldCancelDecode = false;
    // assign this, for use by getPrefColorType(), in case fUsePrefTable is false
    fDefaultPref = pref;

    return this->onDecodeSubset(bm, rect);
}

bool SkImageDecoder::buildTileIndex(SkStreamRewindable* stream, int *width, int *height) {
    // we reset this to false before calling onBuildTileIndex
    fShouldCancelDecode = false;

    return this->onBuildTileIndex(stream, width, height);
}

bool SkImageDecoder::cropBitmap(SkBitmap *dst, SkBitmap *src, int sampleSize,
                                int dstX, int dstY, int width, int height,
                                int srcX, int srcY) {
    int w = width / sampleSize;
    int h = height / sampleSize;
    if (src->colorType() == kIndex_8_SkColorType) {
        // kIndex8 does not allow drawing via an SkCanvas, as is done below.
        // Instead, use extractSubset. Note that this shares the SkPixelRef and
        // SkColorTable.
        // FIXME: Since src is discarded in practice, this holds on to more
        // pixels than is strictly necessary. Switch to a copy if memory
        // savings are more important than speed here. This also means
        // that the pixels in dst can not be reused (though there is no
        // allocation, which was already done on src).
        int x = (dstX - srcX) / sampleSize;
        int y = (dstY - srcY) / sampleSize;
        SkIRect subset = SkIRect::MakeXYWH(x, y, w, h);
        return src->extractSubset(dst, subset);
    }
    // if the destination has no pixels then we must allocate them.
    if (dst->isNull()) {
        dst->setInfo(src->info().makeWH(w, h));

        if (!this->allocPixelRef(dst, NULL)) {
            SkDEBUGF(("failed to allocate pixels needed to crop the bitmap"));
            return false;
        }
    }
    // check to see if the destination is large enough to decode the desired
    // region. If this assert fails we will just draw as much of the source
    // into the destination that we can.
    if (dst->width() < w || dst->height() < h) {
        SkDEBUGF(("SkImageDecoder::cropBitmap does not have a large enough bitmap.\n"));
    }

    // Set the Src_Mode for the paint to prevent transparency issue in the
    // dest in the event that the dest was being re-used.
    SkPaint paint;
    paint.setXfermodeMode(SkXfermode::kSrc_Mode);

    SkCanvas canvas(*dst);
    canvas.drawSprite(*src, (srcX - dstX) / sampleSize,
                            (srcY - dstY) / sampleSize,
                            &paint);
    return true;
}

///////////////////////////////////////////////////////////////////////////////

bool SkImageDecoder::DecodeFile(const char file[], SkBitmap* bm, SkColorType pref,  Mode mode,
                                Format* format) {
    SkASSERT(file);
    SkASSERT(bm);

    SkAutoTUnref<SkStreamRewindable> stream(SkStream::NewFromFile(file));
    if (stream.get()) {
        if (SkImageDecoder::DecodeStream(stream, bm, pref, mode, format)) {
            bm->pixelRef()->setURI(file);
            return true;
        }
    }
    return false;
}

bool SkImageDecoder::DecodeMemory(const void* buffer, size_t size, SkBitmap* bm, SkColorType pref,
                                  Mode mode, Format* format) {
    if (0 == size) {
        return false;
    }
    SkASSERT(buffer);

    SkMemoryStream  stream(buffer, size);
    return SkImageDecoder::DecodeStream(&stream, bm, pref, mode, format);
}

bool SkImageDecoder::DecodeStream(SkStreamRewindable* stream, SkBitmap* bm, SkColorType pref,
                                  Mode mode, Format* format) {
    SkASSERT(stream);
    SkASSERT(bm);

    bool success = false;
    SkImageDecoder* codec = SkImageDecoder::Factory(stream);

    if (codec) {
        success = codec->decode(stream, bm, pref, mode);
        if (success && format) {
            *format = codec->getFormat();
            if (kUnknown_Format == *format) {
                if (stream->rewind()) {
                    *format = GetStreamFormat(stream);
                }
            }
        }
        delete codec;
    }
    return success;
}


text:
package pl.pronux.sokker.ui.widgets.tables;

import java.util.Collections;
import java.util.List;

import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;

import pl.pronux.sokker.comparators.PlayerArchiveComparator;
import pl.pronux.sokker.handlers.SettingsHandler;
import pl.pronux.sokker.interfaces.SVComparator;
import pl.pronux.sokker.model.PlayerArchive;
import pl.pronux.sokker.resources.Messages;
import pl.pronux.sokker.ui.beans.ConfigBean;
import pl.pronux.sokker.ui.listeners.SortTableListener;
import pl.pronux.sokker.ui.resources.FlagsResources;
import pl.pronux.sokker.ui.resources.ImageResources;
import pl.pronux.sokker.ui.widgets.interfaces.IViewSort;

public class PlayersArchiveTable extends SVTable<PlayerArchive> implements IViewSort<PlayerArchive> {
	private PlayerArchiveComparator comparator;
	private List<PlayerArchive> players;

	public PlayersArchiveTable(Composite parent, int style) {
		super(parent, style);

		comparator = new PlayerArchiveComparator();
		comparator.setColumn(PlayerArchiveComparator.SURNAME);
		comparator.setDirection(PlayerArchiveComparator.ASCENDING);

		this.setLinesVisible(true);
		this.setHeaderVisible(true);
		this.setFont(ConfigBean.getFontTable());

		String[] columns = { "",
				Messages.getString("table.id"),
				Messages.getString("table.name"),
				Messages.getString("table.surname"),
				Messages.getString("table.youthTeamId"),
				Messages.getString("table.note"),
				""
		};

		for (int j = 0; j < columns.length; j++) {
			TableColumn column = new TableColumn(this, SWT.NONE);

			if (j > 5 && j < columns.length - 1) {
				column.setAlignment(SWT.RIGHT);
			} else {
				column.setAlignment(SWT.LEFT);
			}

			column.setText(columns[j]);
			column.setResizable(false);
			column.setMoveable(false);

			if (j == columns.length - 1) {
				// column.setWidth(70);
				if (SettingsHandler.IS_LINUX) {
					column.pack();
				}
			} else {
				// column.setWidth(40);
				column.pack();
				column.addSelectionListener(new SortTableListener<PlayerArchive>(this, comparator));
			}
		}

		this.setSortColumn(this.getColumn(comparator.getColumn()));
		this.setSortDirection(comparator.getDirection());

		this.addLabelsListener();
		this.addNoteListener(PlayerArchive.class.getName(), PlayerArchiveComparator.NOTE);
	}

	public void fill(List<PlayerArchive> players) {
		this.players = players;
		// Turn off drawing to avoid flicker
		this.setRedraw(false);

		// We remove all the table entries, sort our
		// rows, then add the entries
		this.remove(0, this.getItemCount() - 1);
		Collections.sort(players, comparator);
		for (PlayerArchive player : players) {
			TableItem item = new TableItem(this, SWT.NONE);
			int c = 0;
			item.setData(PlayerArchive.class.getName(), player);
			if (player.getCountryId() > 0) {
				item.setImage(c++, FlagsResources.getFlag(player.getCountryId()));
			} else {
				item.setImage(c++, FlagsResources.getFlag(FlagsResources.EMPTY_FLAG));
			}

			item.setText(c++, String.valueOf(player.getId()));
			item.setText(c++, player.getName());
			item.setText(c++, player.getSurname());
			item.setText(c++, String.valueOf(player.getYouthTeamId()));
			if (player.getNote().isEmpty()) {
				c++;
			} else {
				item.setImage(c++, ImageResources.getImageResources("note.png"));
			}

		}
		for (int i = 0; i < this.getColumnCount() - 1; i++) {
			this.getColumn(i).pack();
		}

		// Turn drawing back on
		this.setRedraw(true);
	}

	public void sort(SVComparator<PlayerArchive> comparator) {
		if (players != null) {
			Collections.sort(players, comparator);
			fill(players);
		}
	}

	public SVComparator<PlayerArchive> getComparator() {
		return comparator;
	}

	@Override
	public void setLabel(Label label, int column, TableItem item) {
		if (column == PlayerArchiveComparator.NOTE) {
			PlayerArchive player = (PlayerArchive) item.getData(PlayerArchive.class.getName());
			if (player.getNote() != null && !player.getNote().isEmpty()) {
				label.setText(player.getNote());
				int minSizeX = 200;
				int minSizeY = 80;
				int maxSizeX = 400;
				int maxSizeY = 200;

				Point size = label.computeSize(SWT.DEFAULT, SWT.DEFAULT);
				if (size.x < minSizeX) {
					size.x = minSizeX;
				}
				if (size.y < minSizeY) {
					size.y = minSizeY;
				}
				if (size.x > maxSizeX) {
					size.x = maxSizeX;
				}
				if (size.y > maxSizeY) {
					size.y = maxSizeY;
				}

				label.setSize(size);
			}
		}
		super.setLabel(label, column, item);
	}
}


text:
delete from lm_employee_override_t where lm_employee_override_id = '3000';
delete from lm_accrual_category_t where lm_accrual_category_id = '3000';
delete from lm_accrual_category_t where lm_accrual_category_id = '3001';
delete from hr_principal_attributes_t where principal_id = '111';


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="../../favicon.ico">

    <title>Starter Template for Bootstrap</title>

    <link href="../../dist/css/bootstrap.min.css" rel="stylesheet">

    <link href="starter-template.css" rel="stylesheet">

      <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">

      </button>
      Navbar

            Home (current)

            Link

            Disabled

            Dropdown

              Action
              Another action
              Something else here

        <form class="form-inline my-2 my-lg-0">
          <input class="form-control mr-sm-2" type="text" placeholder="Search">
          <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
        </form>

Bootstrap starter template

Use this document as a way to quickly start any new project.
 All you get is this text and a mostly barebones HTML document.


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

  <title>Simple RPC</title>

  <meta name="description" content="">

Simple RPC Developing Server

Api Explorer


text:
#ifndef __EFI_IP4_DRIVER_H__
#define __EFI_IP4_DRIVER_H__

#include <Protocol/ServiceBinding.h>

extern EFI_DRIVER_BINDING_PROTOCOL   gIp4DriverBinding;
extern EFI_COMPONENT_NAME_PROTOCOL   gIp4ComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL  gIp4ComponentName2;

//
// Function prototype for the driver's entry point
//
/**
  This is the declaration of an EFI image entry point. This entry point is
  the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including
  both device drivers and bus drivers.

  The entry point for IP4 driver which install the driver
  binding and component name protocol on its image.

  @param[in]  ImageHandle           The firmware allocated handle for the UEFI image.
  @param[in]  SystemTable           A pointer to the EFI System Table.

  @retval EFI_SUCCESS           The operation completed successfully.
  @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack of resources.

**/
EFI_STATUS
EFIAPI
Ip4DriverEntryPoint (
  IN EFI_HANDLE             ImageHandle,
  IN EFI_SYSTEM_TABLE       *SystemTable
  );

//
// Function prototypes for the Drivr Binding Protocol
//
/**
  Test to see if this driver supports ControllerHandle. This service
  is called by the EFI boot service ConnectController(). In
  order to make drivers as small as possible, there are a few calling
  restrictions for this service. ConnectController() must
  follow these calling restrictions. If any other agent wishes to call
  Supported() it must also follow these calling restrictions.

  @param[in]  This                Protocol instance pointer.
  @param[in]  ControllerHandle    Handle of device to test
  @param[in]  RemainingDevicePath Optional parameter use to pick a specific child
                                  device to start.

  @retval EFI_SUCCESS         This driver supports this device
  @retval EFI_ALREADY_STARTED This driver is already running on this device
  @retval other               This driver does not support this device

**/
EFI_STATUS
EFIAPI
Ip4DriverBindingSupported (
  IN EFI_DRIVER_BINDING_PROTOCOL  * This,
  IN EFI_HANDLE                   ControllerHandle,
  IN EFI_DEVICE_PATH_PROTOCOL     * RemainingDevicePath OPTIONAL
  );

/**
  Start this driver on ControllerHandle. This service is called by the
  EFI boot service ConnectController(). In order to make
  drivers as small as possible, there are a few calling restrictions for
  this service. ConnectController() must follow these
  calling restrictions. If any other agent wishes to call Start() it
  must also follow these calling restrictions.

  @param[in]  This                 Protocol instance pointer.
  @param[in]  ControllerHandle     Handle of device to bind driver to
  @param[in]  RemainingDevicePath  Optional parameter use to pick a specific child
                                   device to start.

  @retval EFI_SUCCESS          This driver is added to ControllerHandle
  @retval EFI_ALREADY_STARTED  This driver is already running on ControllerHandle
  @retval other                This driver does not support this device

**/
EFI_STATUS
EFIAPI
Ip4DriverBindingStart (
  IN EFI_DRIVER_BINDING_PROTOCOL  * This,
  IN EFI_HANDLE                   ControllerHandle,
  IN EFI_DEVICE_PATH_PROTOCOL     * RemainingDevicePath OPTIONAL
  );

/**
  Stop this driver on ControllerHandle. This service is called by the
  EFI boot service DisconnectController(). In order to
  make drivers as small as possible, there are a few calling
  restrictions for this service. DisconnectController()
  must follow these calling restrictions. If any other agent wishes
  to call Stop() it must also follow these calling restrictions.

  @param[in]  This              Protocol instance pointer.
  @param[in]  ControllerHandle  Handle of device to stop driver on
  @param[in]  NumberOfChildren  Number of Handles in ChildHandleBuffer. If number
                                of children is zero stop the entire bus driver.
  @param[in]  ChildHandleBuffer List of Child Handles to Stop.

  @retval EFI_SUCCESS           This driver is removed ControllerHandle
  @retval other                 This driver was not removed from this device

**/
EFI_STATUS
EFIAPI
Ip4DriverBindingStop (
  IN  EFI_DRIVER_BINDING_PROTOCOL  *This,
  IN  EFI_HANDLE                   ControllerHandle,
  IN  UINTN                        NumberOfChildren,
  IN  EFI_HANDLE                   *ChildHandleBuffer
  );

//
// Function ptototypes for the ServiceBinding Prococol
//
/**
  Creates a child handle and installs a protocol.

  The CreateChild() function installs a protocol on ChildHandle.
  If ChildHandle is a pointer to NULL, then a new handle is created and returned in ChildHandle.
  If ChildHandle is not a pointer to NULL, then the protocol installs on the existing ChildHandle.

  @param  This        Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.
  @param  ChildHandle Pointer to the handle of the child to create. If it is NULL,
                      then a new handle is created. If it is a pointer to an existing UEFI handle,
                      then the protocol is added to the existing UEFI handle.

  @retval EFI_SUCCES            The protocol was added to ChildHandle.
  @retval EFI_INVALID_PARAMETER ChildHandle is NULL.
  @retval EFI_OUT_OF_RESOURCES  There are not enough resources availabe to create
                                the child
  @retval other                 The child handle was not created

**/
EFI_STATUS
EFIAPI
Ip4ServiceBindingCreateChild (
  IN EFI_SERVICE_BINDING_PROTOCOL  *This,
  IN OUT EFI_HANDLE                *ChildHandle
  );

/**
  Destroys a child handle with a protocol installed on it.

  The DestroyChild() function does the opposite of CreateChild(). It removes a protocol
  that was installed by CreateChild() from ChildHandle. If the removed protocol is the
  last protocol on ChildHandle, then ChildHandle is destroyed.

  @param  This        Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.
  @param  ChildHandle Handle of the child to destroy

  @retval EFI_SUCCES            The protocol was removed from ChildHandle.
  @retval EFI_UNSUPPORTED       ChildHandle does not support the protocol that is being removed.
  @retval EFI_INVALID_PARAMETER Child handle is NULL.
  @retval EFI_ACCESS_DENIED     The protocol could not be removed from the ChildHandle
                                because its services are being used.
  @retval other                 The child handle was not destroyed

**/
EFI_STATUS
EFIAPI
Ip4ServiceBindingDestroyChild (
  IN EFI_SERVICE_BINDING_PROTOCOL  *This,
  IN EFI_HANDLE                    ChildHandle
  );
#endif


text:
Deployment Status

  {{vm.endTimeStamp | date:'mediumTime'}}

        {{vm.alertList.length}}
        Deployment Alerts

        {{vm.failedDeployments || 0}} Failed
        Deployments

        {{vm.resourceList.length || 0}} Enabled
        Deployments

        {{vm.disabledDeployments || 0}} Disabled
        Deployments

      <button class="btn btn-link hk-trigger" ng-click="showAllAlerts = !showAllAlerts"> 0" ng-class="showAllAlerts ? 'fa-minus-square-o' : 'fa-plus-square-o'"> Deployment Alerts  0">({{showAllAlerts ? vm.alertList.length : vm.math.min(vm.alertList.length, 3)}} of {{vm.alertList.length}})</button>

    Alert Settings

No alerts have been fired in this category and time range.

{{alert.evalSets[0][0].evalTimestamp | date:'medium' }}

Alert Summary: alert details.

  <div ng-show="vm.resourceList.$resolved && vm.resourceList.length <= 0">

Deployments

No deployments.

<button class="btn btn-primary btn-lg">Add Deployment</button>

 0">

Deployments

        <button class="btn btn-default add" type="button" disabled>Add Deployment</button>

          <button class="btn btn-default" type="button" id="dropdownMenu1" dropdown-toggle>
            Actions

          </button>

Enable

Disable

Redeploy

Undeploy

Delete

          <input type="search" ng-model="vm.search" aria-controls="DataTables_Table_0">

Showing 1 to {{vm.resourceList.length}} of {{vm.resourceList.length}} Items

              <input type="checkbox">
              Current State
              Deployments {{vm.alertList.length}}
              Enabled/Disabled
              Computed Health
              Actions

Suggestions

Check the syntax of the search term.

Check that the correct menu option is chosen (token ID vs. user ID).

Use wildcards (* to match zero or more characters or ? to match a single character).

Clear the search field, then click Search to return to the 20 most recent records.

              <input type="checkbox">
               OK
               Stopped
               Failed
               Unknown
              {{res.properties.name | limitTo14 : res.properties.name.length-13 : 12}} ({{res.properties.name | limitTo14 : res.properties.name.length-13 : 12}}) {{res.alerts}}
              Enabled
              Disabled
              Good
              Fair
              Poor

                  <button class="btn btn-default" type="button" id="dropdownMenu2" dropdown-toggle>
                    Actions

                  </button>

Enable

Disable

Redeploy

Undeploy

Delete

            <input type="text" class="paginate_input" value="1">of 1


text:
package uk.co.pragmasoft.experiments.bigdata.spark.cdc

import org.scalatest.{Matchers, FlatSpec}
import uk.co.pragmasoft.experiments.bigdata.spark.SparkTestSupport
import Cdc._

case class Record(key: Int, value: String)

class CdcSupportTest extends FlatSpec with Matchers with SparkTestSupport with CdcSupport {

  behavior of "extractDeletedRecords"

  it should "extract as deleted record the ones with keys present in the previousSnapshot but not in the new one" in withSparkContext { sc =>

    val previousSnapshot = sc.parallelize( List( Record(1, "value"), Record(2, "value 2"), Record(3, "value") ) ).keyBy( _.key )
    val newSnapshot = sc.parallelize( List( Record(1, "new value"), Record(3, "value") ) ).keyBy( _.key )

    val deletedRecords = extractDeletedRecords(newSnapshot, previousSnapshot)

    deletedRecords.collect().toList should be ( List(deleted(Record(2, "value 2"))) )
  }

  behavior of "extractNewAndUpdated"

  it should "Extract as NEW records the ones with keys not present in previous but present in new snapshot" in withSparkContext { sc =>
    val previousSnapshot  = sc.parallelize( List( Record(1, "value"), Record(3, "value") ) ).keyBy( _.key )
    val newSnapshot= sc.parallelize( List( Record(1, "value"), Record(2, "value 2"), Record(3, "value") ) ).keyBy( _.key )

    val deletedRecords = extractNewAndUpdated(newSnapshot, previousSnapshot)

    deletedRecords.collect().toList should be ( List(inserted(Record(2, "value 2"))) )

  }

  it should "Extract as UPDATED records the ones with keys present both snapshots but with different values and return new value" in withSparkContext { sc =>
    val previousSnapshot  = sc.parallelize( List( Record(1, "value"), Record(3, "value") ) ).keyBy( _.key )
    val newSnapshot= sc.parallelize( List( Record(1, "value"), Record(3, "new value") ) ).keyBy( _.key )

    val deletedRecords = extractNewAndUpdated(newSnapshot, previousSnapshot)

    deletedRecords.collect().toList should be ( List(updated(Record(3, "new value"))) )
  }

  behavior of "computeCdc"

  it should "Detect updated, inserted and deleted records composing the other two functions, unaltered records should be ignored" in withSparkContext { sc =>
    val record1 = Record(1, "value")
    val record2 = Record(2, "value")
    val record3 = Record(3, "value")
    val record3Updated: Record = record3.copy(value = "new value")
    val record4: Record = Record(4, "value")

    val previousSnapshot  = sc.parallelize( List( record1, record2, record3 ) )
    val newSnapshot= sc.parallelize( List( record1, record3Updated, record4 ) )

    val cdc = computeCdc( (record: Record) => record.key )(newSnapshot, previousSnapshot)

    cdc.collect().toSet should be ( Set( deleted(record2), updated(record3Updated), inserted(record4)  ) )
  }
}


text:
@interface Demo1ViewController : UIViewController<WRPageViewControllerDelegate>

@end


text:
ACCEPTED

#### According to
International Plant Names Index

#### Published in
Bot. Mag. 68: t. 3919. 1842

#### Original name
null

### Remarks
null


text:
require 'spec_helper'

describe Brainstem do
  describe "default_namespace attribute" do
    it "can be set and read" do
      Brainstem.default_namespace = "something"
      expect(Brainstem.default_namespace).to eq("something")
    end

    it "returns 'none' if unset" do
      expect(Brainstem.default_namespace).to eq("none")
    end
  end

  describe "presenter collection method" do
    it "returns an instance of PresenterCollection" do
      expect(Brainstem.presenter_collection).to be_a(Brainstem::PresenterCollection)
    end

    it "accepts a namespace" do
      expect(Brainstem.presenter_collection("v1")).to be_a(Brainstem::PresenterCollection)
      expect(Brainstem.presenter_collection("v1")).not_to eq(Brainstem.presenter_collection)
    end
  end
end


text:
SPA which you can search for pharmacies on duty in Istanbul, made with angular.

##[demo](http://hanakamer.github.io/istanbul-pharmacy-angular/build/)

for the api ==> [pharmacyOnDuty](https://github.com/emre/PharmacyOnDuty)


text:
set -e -x -u -o pipefail

REPO_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"

docker pull radiasoft/beamsim:latest
docker run --rm -u vagrant -v "${REPO_DIR}:/rslinac" radiasoft/beamsim /rslinac/bin/test_cpp.sh
docker run --rm -u vagrant -v "${REPO_DIR}:/rslinac" radiasoft/beamsim /rslinac/bin/test_python.sh


text:
/* -------------------------------------------------------------------------- */
/* waitmex functions */
/* -------------------------------------------------------------------------- */

/* This file includes the following functions for handling waitbars in MATLAB:

    waitbar_create: create a waitbar
    waitbar_update: update a waitbar
    waitbar_destroy: destroy a waitbar
    waitbar_return: return a waitbar

    in C                            MATLAB equivalent
    ----                            -----------------
    h = waitbar_create (x,msg)      h = waitbar (x,msg)
    waitbar_update (x,h,NULL)       waitbar (x,h)
    waitbar_update (x,h,msg)        waitbar (x,h,msg)
    waitbar_destroy (h)             close (h)
    waitbar_return (h)              for returning h from a mexFunction

    Copyright 2007, Timothy A. Davis, http://www.suitesparse.com
*/

#include "waitmex.h"

/* -------------------------------------------------------------------------- */
/* waitbar_create: create a waitbar */
/* -------------------------------------------------------------------------- */

/* Create a waitbar and return a point to the new waitbar.  Example:
 * h = waitbar_create (x, "Please wait...") in C is just like
 * h = waitbar (x, 'Please wait') in MATLAB, where x is a fraction between
 * 0 and 1.
*/

waitbar *waitbar_create         /* return a pointer to the new waitbar */
(
    double fraction,            /* fraction from 0 to 1 */
    char *message               /* message to display */
)
{
    int error ;
    waitbar *h ;

    h = mxMalloc (sizeof (waitbar)) ;
    h->fraction = mxCreateDoubleScalar (fraction) ;
    h->message = mxCreateString (message) ;

    /* h = waitbar (fraction, message) ; */
    h->inputs [0] = h->fraction ;
    h->inputs [1] = h->message ;
    error = mexCallMATLAB (1, h->outputs, 2, h->inputs, "waitbar") ;
    if (error)
    {
        mexErrMsgTxt ("unable to create waitbar") ;
    }

    /* save the MATLAB handle h in the waitbar struct */
    h->handle = h->outputs [0] ;

    return (h) ;
}

/* -------------------------------------------------------------------------- */
/* waitbar_update: update a waitbar */
/* -------------------------------------------------------------------------- */

/* Update the length of the bar in an existing waitbar.  Example:
 * waitbar_update (x, h, NULL) in C is just like waitbar (x,h) in MATLAB,
 * where h is the handle to the existing waitbar.  The message is not changed.
 * To change the message, use waitbar_update (x, h, "new message"), which is
 * just like waitbar (x, h, 'new message') in MATLAB.
 */

void waitbar_update
(
    double fraction,
    waitbar *h,
    char *message
)
{
    int error ;
    if (h == NULL) return ;                 /* nothing to do */
    (* mxGetPr (h->fraction)) = fraction ;  /* update the fraction */
    h->inputs [0] = h->fraction ;           /* define the inputs x and h */
    h->inputs [1] = h->handle ;

    if (message == NULL)
    {
        /* use the existing message; waitbar (x,h) in MATLAB */
        error = mexCallMATLAB (0, h->outputs, 2, h->inputs, "waitbar") ;
    }
    else
    {
        /* define a new message; waitbar (x,h,message) in MATLAB */
        mxDestroyArray (h->message) ;
        h->message = mxCreateString (message) ;
        h->inputs [2] = h->message ;
        error = mexCallMATLAB (0, h->outputs, 3, h->inputs, "waitbar") ;
    }
    if (error)
    {
        mexErrMsgTxt ("unable to update waitbar") ;
    }
}

/* -------------------------------------------------------------------------- */
/* waitbar_destroy: destroy a waitbar */
/* -------------------------------------------------------------------------- */

/* Destroys a waitbar; same as close(h) in MATLAB */

void waitbar_destroy
(
    waitbar *h
)
{
    int error ;
    if (h == NULL) return ;             /* nothing to do */
    h->inputs [0] = h->handle ;
    mxDestroyArray (h->fraction) ;      /* free the internal mxArrays */
    mxDestroyArray (h->message) ;
    error = mexCallMATLAB (0, h->outputs, 1, h->inputs, "close") ;
    mxDestroyArray (h->handle) ;
    mxFree (h) ;
    if (error)
    {
        mexErrMsgTxt ("error closing waitbar") ;
    }
}

/* -------------------------------------------------------------------------- */
/* waitbar_return: return a waitbar handle to the caller */
/* -------------------------------------------------------------------------- */

/* This function frees the space used internally in a mexFunction for managing
 * the waitbar, and returns the mxArray handle to the caller.  The waitbar still
 * exists in MATLAB.  Example: pargout [0] = waitbar_return (h) to return the
 * MATLAB handle to the caller of your mexFunction.
 */

mxArray *waitbar_return
(
    waitbar *h
)
{
    mxArray *handle ;
    if (h == NULL) return (NULL) ;      /* nothing to do */
    handle = h->handle ;                /* get the MATLAB handle */
    mxDestroyArray (h->fraction) ;      /* free the internal mxArrays */
    mxDestroyArray (h->message) ;
    mxFree (h) ;
    return (handle) ;                   /* return the MATLAB handle */
}