<commit_before>/**
 * 
 */
package org.javarosa.model.xform;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

import org.javarosa.core.model.DataBinding;
import org.javarosa.core.model.utils.ExternalizableHelper;
import org.javarosa.core.util.Utilities;
import org.javarosa.core.util.db.PersistentHelper;


/**
 * 
 */
public class XPathBinding implements DataBinding {

	private String id;
	private String nodeset;
	private String type;
	private String relevancy;
	private boolean required = false;

	public String preload;
	public String preloadParams;
	
	private String xpathBinding;
	private String relevantString;
	
	/**
	 * 
	 */
	public XPathBinding() {
		super();
		// TODO Auto-generated constructor stub
	}

	public String getId() {
		return this.id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getNodeset() {
		return this.nodeset;
	}
	public void setNodeset(String nodeset) {
		this.nodeset = nodeset;
	}
	public String getType() {
		return this.type;
	}
	public void setType(String type) {
		this.type = type;
	}
	public String getRelevancy() {
		return this.relevancy;
	}
	public void setRelevancy(String relevancy) {
		this.relevancy = relevancy;
	}

	public String toString() {
		return "id:"+id + " nodset: " + nodeset + " rel: " + relevancy + " req: "+required+" type " + type;
	}

	public void setRequired(String attributeValue) throws Exception {
		//#if debug.output==verbose
		System.out.println("setting bind "+this.id+ " req="+attributeValue);
		//#endif
		this.required = Utilities.getBoolean(attributeValue);
	}

	public void setRequired(boolean required) {
		this.required = required;
	}

	public boolean isRequired() {
		return required;
	}
	
	/**
	 * Reads the object from stream.
	 */
	public void readExternal(DataInputStream dis) throws IOException, IllegalAccessException, InstantiationException{
		if(!PersistentHelper.isEOF(dis)){
			setId(ExternalizableHelper.readUTF(dis));
			setNodeset(ExternalizableHelper.readUTF(dis));
			setType(ExternalizableHelper.readUTF(dis));
			setRelevancy(ExternalizableHelper.readUTF(dis));
			setRequired(dis.readBoolean());
			preload = ExternalizableHelper.readUTF(dis);
			preloadParams = ExternalizableHelper.readUTF(dis);
		}
	}

	/**
	 * Write the object to stream.
	 */
	public void writeExternal(DataOutputStream dos) throws IOException {
		ExternalizableHelper.writeUTF(dos, getId());
		ExternalizableHelper.writeUTF(dos, getNodeset());
		ExternalizableHelper.writeUTF(dos, getType());
		ExternalizableHelper.writeUTF(dos, getRelevancy());
		dos.writeBoolean(isRequired());
		
		ExternalizableHelper.writeUTF(dos, preload);
		ExternalizableHelper.writeUTF(dos, preloadParams);
	}

}<commit_msg>[r585] [branches/dev] Submitting the right object this time<commit_after>/**
 * 
 */
package org.javarosa.model.xform;

import org.javarosa.core.model.IDataReference;

/**
 * 
 */
public class XPathBinding implements IDataReference {
	private String xpath;
	
	public XPathBinding () {
		this(null);
	}
	
	public XPathBinding (String xpath) {
		setReference(xpath);
	}
	
	public Object getReference () {
		return xpath;
	}
	
	public void setReference (Object o) {
		xpath = (String)o;
	}
}
{'fraction_non_alphanumeric': 0.11695544554455446, 'fraction_numerical': 0.0009282178217821782, 'mean_word_length': 4.479661016949152, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3402502', 'n_tokens_mistral': 1106, 'n_tokens_neox': 1016, 'n_words': 227}