Java Code Examples for org.apache.commons.lang.builder.EqualsBuilder#append()

The following examples show how to use org.apache.commons.lang.builder.EqualsBuilder#append() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Student.java    From olat with Apache License 2.0 7 votes vote down vote up
@Override
public boolean equals(final Object obj) {
    if (obj == this) {
        return true;
    }
    if (!(obj instanceof Student))
        return false;
    Student theOther = (Student) obj;
    EqualsBuilder builder = new EqualsBuilder();
    builder.append(this.id, theOther.id);
    builder.append(this.firstName, theOther.firstName);
    builder.append(this.lastName, theOther.lastName);
    builder.append(this.email, theOther.email);

    return builder.isEquals();
}
 
Example 2
Source File: NormalizedFieldAndValue.java    From datawave with Apache License 2.0 6 votes vote down vote up
public boolean equals(Object o) {
    boolean equal = super.equals(o);
    if (equal) {
        // if the base is equal and we are not grouped and the event field name is null,
        // then we are logically equal
        if ((!grouped) && (eventFieldName == null)) {
            return true;
        }
        if (o instanceof NormalizedFieldAndValue) {
            NormalizedFieldAndValue n = (NormalizedFieldAndValue) o;
            EqualsBuilder b = new EqualsBuilder();
            b.append(eventFieldName, n.eventFieldName);
            b.append(grouped, n.grouped);
            b.append(subGroup, n.subGroup);
            b.append(group, n.group);
            return b.isEquals();
        }
    }
    return false;
}
 
Example 3
Source File: OpenNotificationJellyBean.java    From HeadsUp with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public boolean hasIdenticalIds(@Nullable OpenNotification n) {
    if (n == null) {
        return false;
    }

    EqualsBuilder builder = new EqualsBuilder();

    RemoteViews cv = getNotification().contentView;
    RemoteViews cv2 = n.getNotification().contentView;
    if (cv != null && cv2 != null) {
        builder.append(cv.getLayoutId(), cv2.getLayoutId());
    }

    return builder
            .append(getNotification().ledARGB, n.getNotification().ledARGB)
            .append(getPackageName(), n.getPackageName())
            .append(titleText, n.titleText)
            .isEquals();

}
 
Example 4
Source File: OperationContext.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
public boolean equals(Object obj) {
   if (obj == null) {
      return false;
   } else if (!(obj instanceof OperationContext)) {
      return false;
   } else if (obj == this) {
      return true;
   } else {
      OperationContext other = (OperationContext)obj;
      EqualsBuilder builder = new EqualsBuilder();
      builder.append(this.operation, other.operation);
      builder.append(this.author, other.author);
      builder.append(this.proofs, other.proofs);
      builder.append(this.recordDate, other.recordDate);
      return builder.isEquals();
   }
}
 
Example 5
Source File: ForeignKey.java    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
public boolean equals(Object obj)
{
    if (obj instanceof ForeignKey)
    {
        ForeignKey otherFk = (ForeignKey)obj;

        // Note that this compares case sensitive
        // Note also that we can simply compare the references regardless of their order
        // (which is irrelevant for fks) because they are contained in a set
        EqualsBuilder builder = new EqualsBuilder();

        if ((_name != null) && (_name.length() > 0) && (otherFk._name != null) && (otherFk._name.length() > 0))
        {
            builder.append(_name, otherFk._name);
        }
        return builder.append(_foreignTableName, otherFk._foreignTableName)
                      .append(_references,       otherFk._references)
                      .isEquals();
    }
    else
    {
        return false;
    }
}
 
Example 6
Source File: ForeignKey.java    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
public boolean equals(Object obj)
{
    if (obj instanceof ForeignKey)
    {
        ForeignKey otherFk = (ForeignKey)obj;

        // Note that this compares case sensitive
        // Note also that we can simply compare the references regardless of their order
        // (which is irrelevant for fks) because they are contained in a set
        EqualsBuilder builder = new EqualsBuilder();

        if ((_name != null) && (_name.length() > 0) && (otherFk._name != null) && (otherFk._name.length() > 0))
        {
            builder.append(_name, otherFk._name);
        }
        return builder.append(_foreignTableName, otherFk._foreignTableName)
                      .append(_references,       otherFk._references)
                      .isEquals();
    }
    else
    {
        return false;
    }
}
 
Example 7
Source File: TherapeuticLinkRequestType.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
public boolean equals(Object obj) {
   if (obj == null) {
      return false;
   } else if (!(obj instanceof TherapeuticLinkRequestType)) {
      return false;
   } else if (obj == this) {
      return true;
   } else {
      TherapeuticLinkRequestType other = (TherapeuticLinkRequestType)obj;
      EqualsBuilder builder = new EqualsBuilder();
      builder.append(this.link, other.link);
      builder.append(this.proofs, other.proofs);
      builder.append(this.author, other.author);
      builder.append(this.requestDate, other.requestDate);
      builder.append(this.externalId, other.externalId);
      return builder.isEquals();
   }
}
 
Example 8
Source File: ProfileEntry.java    From spacewalk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
public boolean equals(Object other) {

    if (other instanceof ProfileEntry) {
        ProfileEntry otherPack = (ProfileEntry) other;

        EqualsBuilder builder = new EqualsBuilder();
        builder.append(this.name, otherPack.getName())
               .append(this.evr, otherPack.getEvr());

        if (arch != null) {
            builder.append(this.arch, otherPack.getArch());
        }
        return builder.isEquals();
    }
    return false;
}
 
Example 9
Source File: BatchScannerSession.java    From datawave with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(Object obj) {
    if (obj instanceof BatchScannerSession) {
        EqualsBuilder builder = new EqualsBuilder();
        builder.append(localTableName, ((BatchScannerSession) obj).localTableName);
        builder.append(localAuths, ((BatchScannerSession) obj).localAuths);
        return builder.isEquals();
    }
    
    return false;
}
 
Example 10
Source File: QueryImpl.java    From datawave with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(Object o) {
    if (null == o)
        return false;
    if (!(o instanceof QueryImpl))
        return false;
    if (this == o)
        return true;
    QueryImpl other = (QueryImpl) o;
    EqualsBuilder eb = new EqualsBuilder();
    eb.append(this.getQueryLogicName(), other.getQueryLogicName());
    eb.append(this.getId(), other.getId());
    eb.append(this.getQueryName(), other.getQueryName());
    eb.append(this.getUserDN(), other.getUserDN());
    eb.append(this.getOwner(), other.getOwner());
    eb.append(this.getQuery(), other.getQuery());
    eb.append(this.getQueryAuthorizations(), other.getQueryAuthorizations());
    eb.append(this.getExpirationDate(), other.getExpirationDate());
    eb.append(this.getPagesize(), other.getPagesize());
    eb.append(this.getPageTimeout(), other.getPageTimeout());
    eb.append(this.isMaxResultsOverridden(), other.isMaxResultsOverridden());
    if (this.isMaxResultsOverridden()) {
        eb.append(this.getMaxResultsOverride(), other.getMaxResultsOverride());
    }
    eb.append(this.getColumnVisibility(), other.getColumnVisibility());
    eb.append(this.getBeginDate(), other.getBeginDate());
    eb.append(this.getEndDate(), other.getEndDate());
    eb.append(this.getDnList(), other.getDnList());
    eb.append(this.getParameters(), other.getParameters());
    return eb.isEquals();
}
 
Example 11
Source File: Text.java    From olat with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(final Object obj) {
    if (obj == this) {
        return true;
    }
    if (!(obj instanceof Text))
        return false;
    Text theOther = (Text) obj;
    EqualsBuilder builder = new EqualsBuilder();
    builder.append(this.getCourseId(), theOther.getCourseId());
    builder.append(this.getType(), theOther.getType());
    builder.append(this.getLineSeq(), theOther.getLineSeq());
    builder.append(this.getLine(), theOther.getLine());
    return builder.isEquals();
}
 
Example 12
Source File: BagBranch.java    From vladmihalcea.wordpress.com with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }
    if (!(obj instanceof BagBranch)) {
        return false;
    }
    BagBranch that = (BagBranch) obj;
    EqualsBuilder eb = new EqualsBuilder();
    eb.append(index, that.index);
    return eb.isEquals();
}
 
Example 13
Source File: Version.java    From vladmihalcea.wordpress.com with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }
    if (!(obj instanceof Version)) {
        return false;
    }
    Version that = (Version) obj;
    EqualsBuilder eb = new EqualsBuilder();
    eb.append(type, that.getType());
    eb.append(image, that.getImage());
    return eb.isEquals();
}
 
Example 14
Source File: Proof.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
public boolean equals(Object obj) {
   if (obj == null) {
      return false;
   } else if (!(obj instanceof Proof)) {
      return false;
   } else if (obj == this) {
      return true;
   } else {
      Proof other = (Proof)obj;
      EqualsBuilder builder = new EqualsBuilder();
      builder.append(this.binaryProof, this.binaryProof);
      builder.append(this.type, other.type);
      return builder.isEquals();
   }
}
 
Example 15
Source File: RanNnep.java    From KEEL with GNU General Public License v3.0 5 votes vote down vote up
/**
    * <p>
    * Compares if two random generators are equal
    * </p>
    * @param other object to compare with.
    * @return true if the generators are equals
    */
public boolean equals(Object other)
{
	if (other instanceof RanNnep) {
		RanNnep o = (RanNnep) other;
		EqualsBuilder eb = new EqualsBuilder();
		eb.append(this.a, o.a);
		eb.append(this.b, o.b);
		return eb.isEquals();
	}
	else {
		return false;
	}
}
 
Example 16
Source File: BasicCredentialMetaData.java    From cas4.0.x-server-wechat with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(final Object other) {
    if (!(other instanceof BasicCredentialMetaData)) {
        return false;
    }
    final BasicCredentialMetaData md = (BasicCredentialMetaData) other;
    final EqualsBuilder builder = new EqualsBuilder();
    builder.append(this.id, md.id);
    builder.append(this.credentialClass, md.credentialClass);
    return builder.isEquals();
}
 
Example 17
Source File: BaseNormalizedContent.java    From datawave with Apache License 2.0 5 votes vote down vote up
public boolean equals(Object o) {
    if (o instanceof BaseNormalizedContent) {
        BaseNormalizedContent n = (BaseNormalizedContent) o;
        EqualsBuilder b = new EqualsBuilder();
        b.append(_fieldName, n._fieldName);
        b.append(_indexedFieldValue, n._indexedFieldValue);
        b.append(_eventFieldValue, n._eventFieldValue);
        b.append(_markings, n._markings);
        b.append(error, n.error);
        return b.isEquals();
    }
    return false;
}
 
Example 18
Source File: ChartCacheKey.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(Object object) {
	if ((object == null) || !(object instanceof ChartCacheKey)) {
		return false;
	}
	
	ChartCacheKey otherCacheKey = (ChartCacheKey) object;
	
	EqualsBuilder builder = new EqualsBuilder();
	builder.append(parameterValuesAsString, otherCacheKey.parameterValuesAsString);
	builder.append(chartType, otherCacheKey.chartType);
	return builder.isEquals();
}
 
Example 19
Source File: DatabaseTableConfigLoaderTest.java    From ormlite-core with ISC License 4 votes vote down vote up
private boolean isConfigEquals(DatabaseTableConfig<?> config1, DatabaseTableConfig<?> config2) {
	EqualsBuilder eb = new EqualsBuilder();
	eb.append(config1.getDataClass(), config2.getDataClass());
	eb.append(config1.getTableName(), config2.getTableName());
	return eb.isEquals();
}
 
Example 20
Source File: NeuralNetAlgorithm.java    From KEEL with GNU General Public License v3.0 4 votes vote down vote up
/**
 * <p>
 * Compare this algorithm to another
 * </p>
        * @param other Object to compare with.
 * @return a boolean indicating if the algorithms are equal
 */
@Override
public boolean equals(Object other)
{
	if (other instanceof NeuralNetAlgorithm) {
		NeuralNetAlgorithm cother = (NeuralNetAlgorithm) other;
		EqualsBuilder eb = new EqualsBuilder();
		
		// Random generators factory
		eb.append(randGenFactory, cother.randGenFactory);
		// Individual species
		eb.append(species, cother.species);
		// Individuals evaluator
		eb.append(evaluator, cother.evaluator);
		// Individuals provider
		eb.append(provider, cother.provider);
		// Population size
		eb.append(populationSize, cother.populationSize);
		// Max of generations
		eb.append(maxOfGenerations, cother.maxOfGenerations);			
		// Individual mutator1
		eb.append(mutator1, cother.mutator1);			
		// Individual mutator2
		eb.append(mutator2, cother.mutator2);
		// Ratio "elements created"/"elements remaining"			
		eb.append(cratio, cother.cratio);
		// Percentage of parents mutated with second mutator			
		eb.append(percentageSecondMutator, cother.percentageSecondMutator);
		// Number of parents mutated with second mutator			
		eb.append(nofselSecondMutator, cother.nofselSecondMutator);			
		// Maximum number of generations allowed without improving
		// the fitness mean of best individuals			
		eb.append(mogmean, cother.mogmean);			
		// Maximum number of generations allowed without improving
		// the best fitness			
		eb.append(mogbest, cother.mogbest);			
		// Difference between two fitness that we consider
	    // enoung to say that the fitness has improved			
		eb.append(fitDif, cother.fitDif);
		// Return test result
		return eb.isEquals();
	}
	else {
		return false;
	}
}