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

edu.berkeley.nlp.util.Freezer 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;

public class Freezer implements Serializable {
	private static final long serialVersionUID = 1L;
	private boolean frozen = false;
	private String owner;

	public Freezer(Object owner) {
		this.owner = owner.toString();
	}

	public void freeze() {
		frozen = true;
	}

	public boolean checkEasy() {
		return frozen;
	}

	public void checkHard() {
		if (frozen) {
			throw new RuntimeException("Attempt to edit "+owner+" while it was frozen.");
		}
	}

	public void check() {
		checkHard();
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy