All Downloads are FREE. Search and download functionalities are using the official Maven repository.

edu.berkeley.nlp.util.SetFactory Maven / Gradle / Ivy

Go to download

The Berkeley parser analyzes the grammatical structure of natural language using probabilistic context-free grammars (PCFGs).

The newest version!
package edu.berkeley.nlp.util;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import java.util.TreeSet;


/**
 * The MapFactory is a mechanism for specifying what kind of map is to be used
 * by some object.  For example, if you want a Counter which is backed by an
 * IdentityHashMap instead of the defaul HashMap, you can pass in an
 * IdentityHashMapFactory.
 *
 * @author Dan Klein
 */

public abstract class SetFactory implements Serializable
{

	public static class HashSetFactory extends SetFactory
	{
		private static final long serialVersionUID = 1L;

		@Override
		public Set buildSet()
		{
			return new HashSet();
		}
	}

	public static class IdentityHashMapFactory extends SetFactory
	{
		private static final long serialVersionUID = 1L;

		@Override
		public Set buildSet()
		{
			return new IdentityHashSet();
		}
	}

	public static class TreeMapFactory extends SetFactory
	{
		private static final long serialVersionUID = 1L;

		@Override
		public Set buildSet()
		{
			return new TreeSet();
		}
	}

	

	public abstract Set buildSet();
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy