<commit_before>// Copyright (c) 1999 <NAME> (<EMAIL>)
// Portions Copyright (c) 1999 Network Associates, Inc.

package org.xbill.DNS;

import java.io.*;
import java.util.*;

/**
 * A DNS Zone.  This encapsulates all data related to a Zone, and provides
 * convienient lookup methods.
 *
 * @author <NAME>
 */

public class Zone extends NameSet {

class AXFREnumeration implements Enumeration {
	private Enumeration znames;
	private Name currentName;
	private Object [] current;
	int count;
	boolean sentFirstSOA, sentNS, sentOrigin, sentLastSOA;

	AXFREnumeration() {
		znames = names();
	}

	public boolean
	hasMoreElements() {
		return (!sentLastSOA);
	}

	public Object
	nextElement() {
		if (sentLastSOA)
			return null;
		if (!sentFirstSOA) {
			sentFirstSOA = true;
			return (RRset) findExactSet(origin, Type.SOA, dclass);
		}
		if (!sentNS) {
			sentNS = true;
			RRset nsset = getNS();
			if (nsset != null)
				return nsset;
		}
		if (!sentOrigin) {
			if (currentName == null) {
				currentName = getOrigin();
				TypeClassMap tcm = findName(currentName);
				current = (Object []) tcm.getMultiple(Type.ANY,
								      dclass);
				count = 0;
			}
			while (count < current.length) {
				RRset rrset = (RRset) current[count];
				if (rrset.getType() != Type.SOA &&
				    rrset.getType() != Type.NS)
					return current[count++];
				count++;
			}
			current = null;
			sentOrigin = true;
		}
		if (current != null && count < current.length)
			return current[count++];
		while (znames.hasMoreElements()) {
			Name currentName = (Name) znames.nextElement();
			if (currentName.equals(getOrigin()))
				continue;
			TypeClassMap tcm = findName(currentName);
			current = (Object []) tcm.getMultiple(Type.ANY, dclass);
			count = 0;
			if (count < current.length)
				return current[count++];<commit_msg>handle zones with no NS records<commit_after>// Copyright (c) 1999 <NAME> (<EMAIL>)
// Portions Copyright (c) 1999 Network Associates, Inc.

package org.xbill.DNS;

import java.io.*;
import java.util.*;

/**
 * A DNS Zone.  This encapsulates all data related to a Zone, and provides
 * convienient lookup methods.
 *
 * @author <NAME>
 */

public class Zone extends NameSet {

class AXFREnumeration implements Enumeration {
	private Enumeration znames;
	private Name currentName;
	private Object [] current;
	int count;
	boolean sentFirstSOA, sentNS, sentOrigin, sentLastSOA;

	AXFREnumeration() {
		znames = names();
	}

	public boolean
	hasMoreElements() {
		return (!sentLastSOA);
	}

	public Object
	nextElement() {
		if (sentLastSOA)
			return null;
		if (!sentFirstSOA) {
			sentFirstSOA = true;
			return (RRset) findExactSet(origin, Type.SOA, dclass);
		}
		if (!sentNS) {
			sentNS = true;
			return getNS();
		}
		if (!sentOrigin) {
			if (currentName == null) {
				currentName = getOrigin();
				TypeClassMap tcm = findName(currentName);
				current = (Object []) tcm.getMultiple(Type.ANY,
								      dclass);
				count = 0;
			}
			while (count < current.length) {
				RRset rrset = (RRset) current[count];
				if (rrset.getType() != Type.SOA &&
				    rrset.getType() != Type.NS)
					return current[count++];
				count++;
			}
			current = null;
			sentOrigin = true;
		}
		if (current != null && count < current.length)
			return current[count++];
		while (znames.hasMoreElements()) {
			Name currentName = (Name) znames.nextElement();
			if (currentName.equals(getOrigin()))
				continue;
			TypeClassMap tcm = findName(currentName);
			current = (Object []) tcm.getMultiple(Type.ANY, dclass);
			count = 0;
			if (count < current.length)
				return current[count++];
{'fraction_non_alphanumeric': 0.13259361997226074, 'fraction_numerical': 0.005547850208044383, 'mean_word_length': 3.370909090909091, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 9, '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': '1323507', 'n_tokens_mistral': 1416, 'n_tokens_neox': 1195, 'n_words': 324}