public static boolean callEquals(Field thiz, Object a0) { return thiz.equals(a0); }
@Override public boolean accept(Field field) { return !field.equals(ignoredField); } }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; InstanceField that = (InstanceField) o; return field.equals(that.field) && instance.equals(that.instance); }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; InstanceField that = (InstanceField) o; if (!field.equals(that.field)) return false; if (!instance.equals(that.instance)) return false; return true; }
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final FieldDescriptor other = (FieldDescriptor) obj; if (this.field != other.field && (this.field == null || !this.field.equals(other.field))) { return false; } return true; }
private boolean anotherCandidateMatchesMockName(final Collection<Object> mocks, final Field candidateFieldToBeInjected, final List<Field> allRemainingCandidateFields) { String mockName = getMockName(mocks.iterator().next()).toString(); for (Field otherCandidateField : allRemainingCandidateFields) { if (!otherCandidateField.equals(candidateFieldToBeInjected) && otherCandidateField.getType().equals(candidateFieldToBeInjected.getType()) && otherCandidateField.getName().equals(mockName)) { return true; } } return false; } }
/** * Update the parameters from checkpoint to user-specified * * @param srcParms source: user-specified parameters * @param tgtParms target: parameters to be modified * @param doIt whether to overwrite target parameters (or just print the message) * @param quiet whether to suppress the notifications about parameter changes */ static void updateParametersDuringCheckpointRestart(hex.deepwater.DeepWaterParameters srcParms, hex.deepwater.DeepWaterParameters tgtParms/*actually used during training*/, boolean doIt, boolean quiet) { for (Field fTarget : tgtParms.getClass().getFields()) { if (ArrayUtils.contains(cp_modifiable, fTarget.getName())) { for (Field fSource : srcParms.getClass().getFields()) { if (fTarget.equals(fSource)) { try { if (fSource.get(srcParms) == null || fTarget.get(tgtParms) == null || !fTarget.get(tgtParms).toString().equals(fSource.get(srcParms).toString())) { // if either of the two parameters is null, skip the toString() if (fTarget.get(tgtParms) == null && fSource.get(srcParms) == null) continue; //if both parameters are null, we don't need to do anything if (!tgtParms._quiet_mode && !quiet) Log.info("Applying user-requested modification of '" + fTarget.getName() + "': " + fTarget.get(tgtParms) + " -> " + fSource.get(srcParms)); if (doIt) fTarget.set(tgtParms, fSource.get(srcParms)); } } catch (IllegalAccessException e) { e.printStackTrace(); } } } } } }
/** * Update the parameters from checkpoint to user-specified * * @param srcParms source: user-specified parameters * @param tgtParms target: parameters to be modified * @param doIt whether to overwrite target parameters (or just print the message) * @param quiet whether to suppress the notifications about parameter changes */ static void updateParametersDuringCheckpointRestart(DeepLearningParameters srcParms, DeepLearningParameters tgtParms/*actually used during training*/, boolean doIt, boolean quiet) { for (Field fTarget : tgtParms.getClass().getFields()) { if (ArrayUtils.contains(cp_modifiable, fTarget.getName())) { for (Field fSource : srcParms.getClass().getFields()) { if (fTarget.equals(fSource)) { try { if (fSource.get(srcParms) == null || fTarget.get(tgtParms) == null || !fTarget.get(tgtParms).toString().equals(fSource.get(srcParms).toString())) { // if either of the two parameters is null, skip the toString() if (fTarget.get(tgtParms) == null && fSource.get(srcParms) == null) continue; //if both parameters are null, we don't need to do anything if (!tgtParms._quiet_mode && !quiet) Log.info("Applying user-requested modification of '" + fTarget.getName() + "': " + fTarget.get(tgtParms) + " -> " + fSource.get(srcParms)); if (doIt) fTarget.set(tgtParms, fSource.get(srcParms)); } } catch (IllegalAccessException e) { e.printStackTrace(); } } } } } }
/** This method will take actual parameters and validate them with parameters of * requested checkpoint. In case of problem, it throws an API exception. * * @param checkpointParameters checkpoint parameters */ public void validateWithCheckpoint(SharedTreeParameters checkpointParameters) { for (Field fAfter : this.getClass().getFields()) { // only look at non-modifiable fields if (ArrayUtils.contains(getCheckpointNonModifiableFields(),fAfter.getName())) { for (Field fBefore : checkpointParameters.getClass().getFields()) { if (fBefore.equals(fAfter)) { try { if (!PojoUtils.equals(this, fAfter, checkpointParameters, checkpointParameters.getClass().getField(fAfter.getName()))) { throw new H2OIllegalArgumentException(fAfter.getName(), "TreeBuilder", "Field " + fAfter.getName() + " cannot be modified if checkpoint is specified!"); } } catch (NoSuchFieldException e) { throw new H2OIllegalArgumentException(fAfter.getName(), "TreeBuilder", "Field " + fAfter.getName() + " is not supported by checkpoint!"); } } } } } } }
if (ArrayUtils.contains(cp_not_modifiable, fBefore.getName())) { for (Field fAfter : newP.getClass().getFields()) { if (fBefore.equals(fAfter)) { try { if (fAfter.get(newP) == null || fBefore.get(oldP) == null || !fBefore.get(oldP).toString().equals(fAfter.get(newP).toString())) { // if either of the two parameters is null, skip the toString()
if (ArrayUtils.contains(cp_not_modifiable, fBefore.getName())) { for (Field fAfter : newP.getClass().getFields()) { if (fBefore.equals(fAfter)) { try { if (fAfter.get(newP) == null || fBefore.get(oldP) == null || !fBefore.get(oldP).toString().equals(fAfter.get(newP).toString())) { // if either of the two parameters is null, skip the toString()
@Override public boolean equals( Object obj ) { if ( this == obj ) { return true; } if ( obj == null ) { return false; } if ( getClass() != obj.getClass() ) { return false; } FieldGetter<?> other = (FieldGetter<?>) obj; if ( field == null ) { if ( other.field != null ) { return false; } } else { if ( !field.equals( other.field ) ) { return false; } } return true; }
if (!expert_mode && Utils.contains(expert_options, fA.getName())) continue; for (Field fB : B.getClass().getDeclaredFields()) { if (fA.equals(fB)) { try { if (fB.get(B) == null || fA.get(A) == null || !fA.get(A).toString().equals(fB.get(B).toString())) { // if either of the two parameters is null, skip the toString()
public int getIndex (Field field) { for (int i = 0, n = fields.length; i < n; i++) if (fields[i].equals(field)) return i; throw new IllegalArgumentException("Unable to find non-private field: " + field); }
@Override public boolean equals(Object other) { if (other == this) { return true; } if (other == null || !other.getClass().equals(getClass())) { return false; } FieldImpl otherField = (FieldImpl) other; return field.equals(otherField.field); }
private static int indexOfFields(@Nullable Field field, List<Field> fields) { if (field != null) { for (int i = 0; i < fields.size(); i++) { if (field.equals(fields.get(i))) { return i; } } } return MISS_FLAG; }
@Override public boolean equals(Object other) { if (other == this) { return true; } if (other == null || !other.getClass().equals(getClass())) { return false; } FieldImpl otherField = (FieldImpl) other; return field.equals(otherField.field); }
@Override public boolean equals(Object other) { if (other == this) { return true; } if (other == null || !other.getClass().equals(getClass())) { return false; } FieldImpl otherField = (FieldImpl) other; return field.equals(otherField.field); }
public static boolean matchInheritance(final Field subclassField, final Field superclassField) { if (Modifier.isStatic(superclassField.getModifiers()) || subclassField.equals(superclassField)) { return false; } final Package subclassPackage = superclassField.getDeclaringClass().getPackage(); final Package superclassPackage = superclassField.getDeclaringClass().getPackage(); final int superFieldModifiers = superclassField.getModifiers(); return isAccessable(subclassPackage, superclassPackage, superFieldModifiers); }