Java

Moderators: zibadian
Number of threads: 7836
Number of posts: 18235

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Branchng Help Posted by Colin01 on 13 Sept 2006 at 11:10 AM
Hi all,
I am hoping someone here can help me figure this one out. I am building a web application that requires multiple branching- or control flow statements.This app takes a condition and then skips the selected page if those conditions are met. What I need now is to be able to take multiple conditions- from multiple answers- and target the same page.

The code is below:

public class BranchingRule extends AbstractIdentified
{
private String formId;
/** @dbmap.field name=PBPBTP */
private String type;
/** @dbmap.field name=PBPGID */
private String targetPageId;
/** @dbmap.field name=PBQUID */
private String questionId;
/** @dbmap.field name=PBPBVL */
private String value;
//bcl 11/29/05
private String status;
private String alias;
//gdj 8/2/06
private boolean newRule;
//gdj 8/3/06
private String id;
//


public BranchingRule()
{
super();
}

protected BranchingRule(BranchingRule from)
{
super((AbstractIdentified) from);
this.type = from.getType();
this.value = from.getValue();
this.targetPageId = from.getTargetPageId();
this.questionId = from.getQuestionId();
this.alias = from.getAlias();
this.id = from.getId();
}

/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object object)
{
if ((object == null) || (!object.getClass().equals(this.getClass())))
{
return false;
}
BranchingRule rhs = (BranchingRule) object;
return new EqualsBuilder()
.append(this.getFormId(), rhs.getFormId())
.append(this.getTargetPageId(), rhs.getTargetPageId())
.append(this.getQuestionId(), rhs.getQuestionId())
.append(this.getValue(), rhs.getValue())
.append(this.getType(), rhs.getType())
.append(this.getAlias(), rhs.getAlias())
.append(this.getId(), rhs.getId())
.isEquals();
}

/**
* @return
*/
public String getFormId()
{
if (formId == null)
formId = "";
return formId;
}

/**
* @return String
*/
public String getType()
{
if (type == null)
type = "";
return type;
}

/**
* @return String
*/
public String getValue()
{
if (value == null)
value = "";
return value;
}

/**
* @return String
*/
public String getStatus()
{
if (status == null)
status = "";
return status;
}

/**
* @param string void
*/
public void setType(String string)
{

type = string;
}

/**
* @param string void
*/
public void setValue(String string)
{
value = string;
}

/* (non-Javadoc)
* @see org.vsac.forager4j.beans.Copyable#copy()
*/
public Copyable copy()
{
return new BranchingRule(this);
}

/**
* @return
*/
public String getQuestionId()
{
return questionId;
}

/**
* @return
*/
public String getTargetPageId()
{
return targetPageId;
}

/**
* @param string
*/
public void setFormId(String string)
{
formId = string;
}

/**
* @param string
*/
public void setQuestionId(String string)
{
questionId = string;
}

/**
* @param string
*/
public void setTargetPageId(String string)
{
targetPageId = string;
}
public void setStatus(String string)
{
this.status = string;
}


/**
* @see java.lang.Object#toString()
*/
public String toString() {
return new ToStringBuilder(this)
.append("id", this.getId())
.append("targetPageId", this.targetPageId)
.append("questionId", this.questionId)
.append("value", this.value)
.append("type", this.type)
.append("temporarlyIdentified", this.isTemporarlyIdentified())
.append("alias", this.getAlias())
.toString();
}

/**
* @return
*/
public String getAlias() {
return alias;
}

/**
* @param string
*/
public void setAlias(String string) {
alias = string;
}

/**
* @return
*/
public boolean isNewRule() {
return newRule;
}

/**
* @param b
*/
public void setNewRule(boolean b) {
newRule = b;
}

/**
* @return
*/
public String getId() {
return id;
}

/**
* @param string
*/
public void setId(String string) {
id = string;
}

}

Your help is appreciated. Thanks!


Report
Re: Branchng Help Posted by zibadian on 13 Sept 2006 at 11:25 AM
: Hi all,
: I am hoping someone here can help me figure this one out. I am building a web application that requires multiple branching- or control flow statements.This app takes a condition and then skips the selected page if those conditions are met. What I need now is to be able to take multiple conditions- from multiple answers- and target the same page.
:
: The code is below:
:
: public class BranchingRule extends AbstractIdentified
: {
: private String formId;
: /** @dbmap.field name=PBPBTP */
: private String type;
: /** @dbmap.field name=PBPGID */
: private String targetPageId;
: /** @dbmap.field name=PBQUID */
: private String questionId;
: /** @dbmap.field name=PBPBVL */
: private String value;
: //bcl 11/29/05
: private String status;
: private String alias;
: //gdj 8/2/06
: private boolean newRule;
: //gdj 8/3/06
: private String id;
: //
:
:
: public BranchingRule()
: {
: super();
: }
:
: protected BranchingRule(BranchingRule from)
: {
: super((AbstractIdentified) from);
: this.type = from.getType();
: this.value = from.getValue();
: this.targetPageId = from.getTargetPageId();
: this.questionId = from.getQuestionId();
: this.alias = from.getAlias();
: this.id = from.getId();
: }
:
: /* (non-Javadoc)
: * @see java.lang.Object#equals(java.lang.Object)
: */
: public boolean equals(Object object)
: {
: if ((object == null) || (!object.getClass().equals(this.getClass())))
: {
: return false;
: }
: BranchingRule rhs = (BranchingRule) object;
: return new EqualsBuilder()
: .append(this.getFormId(), rhs.getFormId())
: .append(this.getTargetPageId(), rhs.getTargetPageId())
: .append(this.getQuestionId(), rhs.getQuestionId())
: .append(this.getValue(), rhs.getValue())
: .append(this.getType(), rhs.getType())
: .append(this.getAlias(), rhs.getAlias())
: .append(this.getId(), rhs.getId())
: .isEquals();
: }
:
: /**
: * @return
: */
: public String getFormId()
: {
: if (formId == null)
: formId = "";
: return formId;
: }
:
: /**
: * @return String
: */
: public String getType()
: {
: if (type == null)
: type = "";
: return type;
: }
:
: /**
: * @return String
: */
: public String getValue()
: {
: if (value == null)
: value = "";
: return value;
: }
:
: /**
: * @return String
: */
: public String getStatus()
: {
: if (status == null)
: status = "";
: return status;
: }
:
: /**
: * @param string void
: */
: public void setType(String string)
: {
:
: type = string;
: }
:
: /**
: * @param string void
: */
: public void setValue(String string)
: {
: value = string;
: }
:
: /* (non-Javadoc)
: * @see org.vsac.forager4j.beans.Copyable#copy()
: */
: public Copyable copy()
: {
: return new BranchingRule(this);
: }
:
: /**
: * @return
: */
: public String getQuestionId()
: {
: return questionId;
: }
:
: /**
: * @return
: */
: public String getTargetPageId()
: {
: return targetPageId;
: }
:
: /**
: * @param string
: */
: public void setFormId(String string)
: {
: formId = string;
: }
:
: /**
: * @param string
: */
: public void setQuestionId(String string)
: {
: questionId = string;
: }
:
: /**
: * @param string
: */
: public void setTargetPageId(String string)
: {
: targetPageId = string;
: }
: public void setStatus(String string)
: {
: this.status = string;
: }
:
:
: /**
: * @see java.lang.Object#toString()
: */
: public String toString() {
: return new ToStringBuilder(this)
: .append("id", this.getId())
: .append("targetPageId", this.targetPageId)
: .append("questionId", this.questionId)
: .append("value", this.value)
: .append("type", this.type)
: .append("temporarlyIdentified", this.isTemporarlyIdentified())
: .append("alias", this.getAlias())
: .toString();
: }
:
: /**
: * @return
: */
: public String getAlias() {
: return alias;
: }
:
: /**
: * @param string
: */
: public void setAlias(String string) {
: alias = string;
: }
:
: /**
: * @return
: */
: public boolean isNewRule() {
: return newRule;
: }
:
: /**
: * @param b
: */
: public void setNewRule(boolean b) {
: newRule = b;
: }
:
: /**
: * @return
: */
: public String getId() {
: return id;
: }
:
: /**
: * @param string
: */
: public void setId(String string) {
: id = string;
: }
:
: }
:
: Your help is appreciated. Thanks!
:
:
:
Change the equals() to take multiple objects as a parameter. Then loop through those objects using the code you already have. If one of those objects results in a false, then the total result should be false.
Report
Re: Branchng Help Posted by Colin01 on 14 Sept 2006 at 6:23 AM
: : Hi all,
: : I am hoping someone here can help me figure this one out. I am building a web application that requires multiple branching- or control flow statements.This app takes a condition and then skips the selected page if those conditions are met. What I need now is to be able to take multiple conditions- from multiple answers- and target the same page.
: :
: : The code is below:
: :
: : public class BranchingRule extends AbstractIdentified
: : {
: : private String formId;
: : /** @dbmap.field name=PBPBTP */
: : private String type;
: : /** @dbmap.field name=PBPGID */
: : private String targetPageId;
: : /** @dbmap.field name=PBQUID */
: : private String questionId;
: : /** @dbmap.field name=PBPBVL */
: : private String value;
: : //bcl 11/29/05
: : private String status;
: : private String alias;
: : //gdj 8/2/06
: : private boolean newRule;
: : //gdj 8/3/06
: : private String id;
: : //
: :
: :
: : public BranchingRule()
: : {
: : super();
: : }
: :
: : protected BranchingRule(BranchingRule from)
: : {
: : super((AbstractIdentified) from);
: : this.type = from.getType();
: : this.value = from.getValue();
: : this.targetPageId = from.getTargetPageId();
: : this.questionId = from.getQuestionId();
: : this.alias = from.getAlias();
: : this.id = from.getId();
: : }
: :
: : /* (non-Javadoc)
: : * @see java.lang.Object#equals(java.lang.Object)
: : */
: : public boolean equals(Object object)
: : {
: : if ((object == null) || (!object.getClass().equals(this.getClass())))
: : {
: : return false;
: : }
: : BranchingRule rhs = (BranchingRule) object;
: : return new EqualsBuilder()
: : .append(this.getFormId(), rhs.getFormId())
: : .append(this.getTargetPageId(), rhs.getTargetPageId())
: : .append(this.getQuestionId(), rhs.getQuestionId())
: : .append(this.getValue(), rhs.getValue())
: : .append(this.getType(), rhs.getType())
: : .append(this.getAlias(), rhs.getAlias())
: : .append(this.getId(), rhs.getId())
: : .isEquals();
: : }
: :
: : /**
: : * @return
: : */
: : public String getFormId()
: : {
: : if (formId == null)
: : formId = "";
: : return formId;
: : }
: :
: : /**
: : * @return String
: : */
: : public String getType()
: : {
: : if (type == null)
: : type = "";
: : return type;
: : }
: :
: : /**
: : * @return String
: : */
: : public String getValue()
: : {
: : if (value == null)
: : value = "";
: : return value;
: : }
: :
: : /**
: : * @return String
: : */
: : public String getStatus()
: : {
: : if (status == null)
: : status = "";
: : return status;
: : }
: :
: : /**
: : * @param string void
: : */
: : public void setType(String string)
: : {
: :
: : type = string;
: : }
: :
: : /**
: : * @param string void
: : */
: : public void setValue(String string)
: : {
: : value = string;
: : }
: :
: : /* (non-Javadoc)
: : * @see org.vsac.forager4j.beans.Copyable#copy()
: : */
: : public Copyable copy()
: : {
: : return new BranchingRule(this);
: : }
: :
: : /**
: : * @return
: : */
: : public String getQuestionId()
: : {
: : return questionId;
: : }
: :
: : /**
: : * @return
: : */
: : public String getTargetPageId()
: : {
: : return targetPageId;
: : }
: :
: : /**
: : * @param string
: : */
: : public void setFormId(String string)
: : {
: : formId = string;
: : }
: :
: : /**
: : * @param string
: : */
: : public void setQuestionId(String string)
: : {
: : questionId = string;
: : }
: :
: : /**
: : * @param string
: : */
: : public void setTargetPageId(String string)
: : {
: : targetPageId = string;
: : }
: : public void setStatus(String string)
: : {
: : this.status = string;
: : }
: :
: :
: : /**
: : * @see java.lang.Object#toString()
: : */
: : public String toString() {
: : return new ToStringBuilder(this)
: : .append("id", this.getId())
: : .append("targetPageId", this.targetPageId)
: : .append("questionId", this.questionId)
: : .append("value", this.value)
: : .append("type", this.type)
: : .append("temporarlyIdentified", this.isTemporarlyIdentified())
: : .append("alias", this.getAlias())
: : .toString();
: : }
: :
: : /**
: : * @return
: : */
: : public String getAlias() {
: : return alias;
: : }
: :
: : /**
: : * @param string
: : */
: : public void setAlias(String string) {
: : alias = string;
: : }
: :
: : /**
: : * @return
: : */
: : public boolean isNewRule() {
: : return newRule;
: : }
: :
: : /**
: : * @param b
: : */
: : public void setNewRule(boolean b) {
: : newRule = b;
: : }
: :
: : /**
: : * @return
: : */
: : public String getId() {
: : return id;
: : }
: :
: : /**
: : * @param string
: : */
: : public void setId(String string) {
: : id = string;
: : }
: :
: : }
: :
: : Your help is appreciated. Thanks!
: :
: :
: :
: Change the equals() to take multiple objects as a parameter. Then loop through those objects using the code you already have. If one of those objects results in a false, then the total result should be false.
:


Hi,
Thanks! Below is the change I made- but I am a little confused between the getParametersValues and getParameterTypes...

public class BranchingRule extends AbstractIdentified
{
private String formId;
/** @dbmap.field name=PBPBTP */
private String type;
/** @dbmap.field name=PBPGID */
private String targetPageId;
/** @dbmap.field name=PBQUID */
private String questionId;
/** @dbmap.field name=PBPBVL */
private String value;
//bcl 11/29/05
private String status;
private String alias;
//gdj 8/2/06
private boolean newRule;
//gdj 8/3/06
private String id;
//


public BranchingRule()
{
super();
}

protected BranchingRule(BranchingRule from)
{
super((AbstractIdentified) from);
this.type = from.getType();
this.value = from.getValue();
this.targetPageId = from.getTargetPageId();
this.questionId = from.getQuestionId();
this.alias = from.getAlias();
this.id = from.getId();
}

/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
boolean getParameterValues (Object object)
{
if ((object == null) || (!object.getClass().equals(this.getClass())))
{
return false;
}
BranchingRule rhs = (BranchingRule) object;
return new EqualsBuilder()
.append(this.getFormId(), rhs.getFormId())
.append(this.getTargetPageId(), rhs.getTargetPageId())
.append(this.getQuestionId(), rhs.getQuestionId())
.append(this.getValue(), rhs.getValue())
.append(this.getType(), rhs.getType())
.append(this.getAlias(), rhs.getAlias())
.append(this.getId(), rhs.getId())
.isEquals();
}

/**
* @return
*/
public String getFormId()
{
if (formId == null)
formId = "";
return formId;
}

/**
* @return String
*/
public String getType()
{
if (type == null)
type = "";
return type;
}

/**
* @return String
*/
public String getValue()
{
if (value == null)
value = "";
return value;
}

/**
* @return String
*/
public String getStatus()
{
if (status == null)
status = "";
return status;
}

/**
* @param string void
*/
public void setType(String string)
{

type = string;
}

/**
* @param string void
*/
public void setValue(String string)
{
value = string;
}

/* (non-Javadoc)
* @see org.vsac.forager4j.beans.Copyable#copy()
*/
public Copyable copy()
{
return new BranchingRule(this);
}

/**
* @return
*/
public String getQuestionId()
{
return questionId;
}

/**
* @return
*/
public String getTargetPageId()
{
return targetPageId;
}

/**
* @param string
*/
public void setFormId(String string)
{
formId = string;
}

/**
* @param string
*/
public void setQuestionId(String string)
{
questionId = string;
}

/**
* @param string
*/
public void setTargetPageId(String string)
{
targetPageId = string;
}
public void setStatus(String string)
{
this.status = string;
}


/**
* @see java.lang.Object#toString()
*/
public String toString() {
return new ToStringBuilder(this)
.append("id", this.getId())
.append("targetPageId", this.targetPageId)
.append("questionId", this.questionId)
.append("value", this.value)
.append("type", this.type)
.append("temporarlyIdentified", this.isTemporarlyIdentified())
.append("alias", this.getAlias())
.toString();
}

/**
* @return
*/
public String getAlias() {
return alias;
}

/**
* @param string
*/
public void setAlias(String string) {
alias = string;
}

/**
* @return
*/
public boolean isNewRule() {
return newRule;
}

/**
* @param b
*/
public void setNewRule(boolean b) {
newRule = b;
}

/**
* @return
*/
public String getId() {
return id;
}

/**
* @param string
*/
public void setId(String string) {
id = string;
}

}
Report
Re: Branchng Help Posted by zibadian on 14 Sept 2006 at 7:07 AM
: : : Hi all,
: : : I am hoping someone here can help me figure this one out. I am building a web application that requires multiple branching- or control flow statements.This app takes a condition and then skips the selected page if those conditions are met. What I need now is to be able to take multiple conditions- from multiple answers- and target the same page.
: : :
: : :
: : : Your help is appreciated. Thanks!
: : :
: : :
: : :
: : Change the equals() to take multiple objects as a parameter. Then loop through those objects using the code you already have. If one of those objects results in a false, then the total result should be false.
: :
:
:
: Hi,
: Thanks! Below is the change I made- but I am a little confused between the getParametersValues and getParameterTypes...
:
getParametersValues() returns the values of the parameters (i.e. "help", 678, myExampleObject, 326578.321648, etc.), while getParameterTypes() returns the types (i.e. string, int, object, double, etc.)



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.