<commit_before>// Copyright (c) 2003 Compaq Corporation.  All rights reserved.
// Portions Copyright (c) 2003 Microsoft Corporation.  All rights reserved.
// Last modified on Wed 12 Jul 2017 at 16:10:00 PST by <NAME>
//      modified on Sat 23 February 2008 at 10:16:24 PST by lamport
//      modified on Mon Aug 20 10:54:08 PDT 2001 by yuanyu

package tlc2.value.impl;

import java.io.IOException;
import java.util.Map;

import tlc2.tool.FingerprintException;
import tlc2.tool.coverage.CostModel;
import tlc2.util.FP64;
import tlc2.value.IMVPerm;
import tlc2.value.IValue;
import tlc2.value.IValueInputStream;
import tlc2.value.IValueOutputStream;
import tlc2.value.RandomEnumerableValues;
import tlc2.value.ValueInputStream;
import tlc2.value.Values;
import util.Assert;
import util.UniqueString;

@SuppressWarnings("serial")
public class SetEnumValue extends EnumerableValue
implements Enumerable, Reducible {
  public ValueVec elems;         // the elements of the set
  private boolean isNorm;        // normalized?
public static final SetEnumValue EmptySet = new SetEnumValue(new ValueVec(0), true);
public static final SetEnumValue DummyEnum = new SetEnumValue((ValueVec)null, true);

  /* Constructor */
  public SetEnumValue(Value[] elems, boolean isNorm) {
	  this(new ValueVec(elems), isNorm);
  }

  public SetEnumValue(Value[] vals, boolean isNorm, CostModel cm) {
	  this(vals, isNorm);
	  this.cm = cm;
  }

  public SetEnumValue(ValueVec elems, boolean isNorm) {
    this.elems = elems;
    this.isNorm = isNorm;
  }

  public SetEnumValue(ValueVec elems, boolean isNorm, final CostModel cm) {
	  this(elems, isNorm);
	  this.cm = cm;
  }

  public SetEnumValue() {
	  this(new ValueVec(0), true);
  }
  
  public SetEnumValue(CostModel cm) {
	  this();
	  this.cm = cm;
  }
  
  // See IValue#isAtom except that this is for sets of atoms.
  public final boolean isSetOfAtoms() {
      final int len = this.elems.size();
      for (int i = 0; i < len; i++) {
    	  final Value v = this.elems.elementAt(i);
    	  if (v instanceof SetEnumValue) {
    		  // Sets of sets of sets... of atoms.
    		  final SetEnumValue sev = (SetEnumValue) v;
    		  if (!sev.isSetOfAtoms()) {
    			  return false;
    		  }
    	  } else if (!v.isAtom()) {
    		  return false;<commit_msg>Constructor to create a set with a single element.<commit_after>// Copyright (c) 2003 Compaq Corporation.  All rights reserved.
// Portions Copyright (c) 2003 Microsoft Corporation.  All rights reserved.
// Last modified on Wed 12 Jul 2017 at 16:10:00 PST by <NAME>
//      modified on Sat 23 February 2008 at 10:16:24 PST by lamport
//      modified on Mon Aug 20 10:54:08 PDT 2001 by yuanyu

package tlc2.value.impl;

import java.io.IOException;
import java.util.Map;

import tlc2.tool.FingerprintException;
import tlc2.tool.coverage.CostModel;
import tlc2.util.FP64;
import tlc2.value.IMVPerm;
import tlc2.value.IValue;
import tlc2.value.IValueInputStream;
import tlc2.value.IValueOutputStream;
import tlc2.value.RandomEnumerableValues;
import tlc2.value.ValueInputStream;
import tlc2.value.Values;
import util.Assert;
import util.UniqueString;

@SuppressWarnings("serial")
public class SetEnumValue extends EnumerableValue
implements Enumerable, Reducible {
  public ValueVec elems;         // the elements of the set
  private boolean isNorm;        // normalized?
public static final SetEnumValue EmptySet = new SetEnumValue(new ValueVec(0), true);
public static final SetEnumValue DummyEnum = new SetEnumValue((ValueVec)null, true);

  /* Constructor */
  public SetEnumValue(Value[] elems, boolean isNorm) {
	  this(new ValueVec(elems), isNorm);
  }

  public SetEnumValue(Value[] vals, boolean isNorm, CostModel cm) {
	  this(vals, isNorm);
	  this.cm = cm;
  }

  public SetEnumValue(ValueVec elems, boolean isNorm) {
    this.elems = elems;
    this.isNorm = isNorm;
  }

  public SetEnumValue(ValueVec elems, boolean isNorm, final CostModel cm) {
	  this(elems, isNorm);
	  this.cm = cm;
  }

  public SetEnumValue() {
	  this(new ValueVec(0), true);
  }
  
  public SetEnumValue(final Value elem) {
	  this(new Value[] {elem}, true); // single element is normalized by definition.
  }
  
  public SetEnumValue(CostModel cm) {
	  this();
	  this.cm = cm;
  }
  
  // See IValue#isAtom except that this is for sets of atoms.
  public final boolean isSetOfAtoms() {
      final int len = this.elems.size();
      for (int i = 0; i < len; i++) {
    	  final Value v = this.elems.elementAt(i);
    	  if (v instanceof SetEnumValue) {
    		  // Sets of sets of sets... of atoms.
    		  final SetEnumValue sev = (SetEnumValue) v;
    		  if (!sev.isSetOfAtoms()) {
    			  return false;
    		  }
    	  } else if (!v.isAtom()) {
    		  return false;
{'fraction_non_alphanumeric': 0.10265039966344132, 'fraction_numerical': 0.02524190155658393, 'mean_word_length': 3.3623853211009176, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4940580', 'n_tokens_mistral': 1683, 'n_tokens_neox': 1546, 'n_words': 471}