/** * Sets the prototype object that is cloned to create new objects. This * object is cloned to store the prototype. * * @param prototype The prototype object. */ public void setPrototype( final CreatedType prototype) { this.prototype = ObjectUtil.cloneSafe(prototype); }
@Override public DivergencesEvaluator<InputType, ValueType> clone() { @SuppressWarnings("unchecked") final DivergencesEvaluator<InputType, ValueType> clone = (DivergencesEvaluator<InputType, ValueType>) super.clone(); clone.divergenceFunction = ObjectUtil.cloneSmart(this.divergenceFunction); clone.values = ObjectUtil.cloneSmartElementsAsArrayList(this.values); return clone; }
@Override public boolean equals( final Object other) { return (this == other) || (other instanceof DefaultTextual && ObjectUtil.equalsSafe(this.text, ((DefaultTextual) other).text)); }
@Override public CompositeLocalGlobalTermWeighter clone() { final CompositeLocalGlobalTermWeighter clone = (CompositeLocalGlobalTermWeighter) super.clone(); clone.localWeighter = ObjectUtil.cloneSafe(this.localWeighter); clone.globalWeighter = ObjectUtil.cloneSmart(this.globalWeighter); clone.normalizer = ObjectUtil.cloneSafe(this.normalizer); return clone; }
@Override public int hashCode() { return ObjectUtil.hashCodeSafe(this.label); }
/** * Creates a new copy of a KernelContainer and the kernel inside. * * @param other The KernelContainer to copy. */ public DefaultKernelContainer( final DefaultKernelContainer<? super InputType> other) { this(ObjectUtil.cloneSmart(other.getKernel())); }
/** * Copy constructor * @param other * SMDM to copy */ public ScalarMixtureDensityModel( final ScalarMixtureDensityModel other ) { this( ObjectUtil.cloneSmartElementsAsArrayList(other.getDistributions()), ObjectUtil.deepCopy(other.getPriorWeights()) ); }
/** * Returns an ArrayList of field/value pairs * @param o * Object to get the field/value pairs * @return * ArrayList of field/value pairs. The value component of the DefaultPair will * be null if the field is protected by the security manager */ public static ArrayList<DefaultPair<Field,Object>> getAllFieldValues( final Object o ) { LinkedList<Field> fields = ObjectUtil.getAllFields( o.getClass() ); ArrayList<Object> values = ObjectUtil.getFieldValues( o, fields ); return DefaultPair.mergeCollections( fields, values ); }
@Override public String toString() { return ObjectUtil.toString(this); }
/** * Returns a list of all of the fields on the given class and any * super-class. It includes fields of all access modifiers. * * @param c * The class to get all the fields from. * @return The * list of fields on the given class or any of its super classes. */ public static LinkedList<Field> getAllFields( final Class<?> c) { // A null class has no fields. // Also, don't get fields from Object. if ( c == null || Object.class.equals( c ) ) { return new LinkedList<Field>(); } // Get the fields from the super class. final LinkedList<Field> fields = ObjectUtil.getAllFields(c.getSuperclass()); // Declared fields include both public and private members fields.addAll( Arrays.asList( c.getDeclaredFields() ) ); return fields; }
for( int i = 0; i < num; i++ ) buffer.append( "Index " + i + ":\n" + ObjectUtil.toString( Array.get(o,i) ) ); for( Object i : iterable ) buffer.append( "Index " + index + ":\n" + ObjectUtil.toString(i) ); index++; + ObjectUtil.inspectFieldValues( o );
@Override public byte[] getDefaultSeed() { return ObjectUtil.deepCopy(DEFAULT_SEED); }
/** * Gets a short version of the Class name, so that * gov.sandia.cognition.util.ObjectUtil$InternalClass will be returned as * "ObjectUtil$InternalClass", for example * @param o Object from which to pull the short Class name * @return * Short String representing the class name */ public static String getShortClassName( final Object o ) { return ObjectUtil.getShortClassName(o.getClass()); }
@Override public AbstractEnvelope clone() { AbstractEnvelope clone = (AbstractEnvelope) super.clone(); clone.lines = ObjectUtil.cloneSmartElementsAsArrayList(this.getLines()); return clone; }
ObjectUtil.getFieldValues( o, interestedFields ); for (int i = 0; i < numFields; i++)
@Override public int hashCode() { // Use the text as a hash code. return ObjectUtil.hashCodeSafe(this.text); }
@Override public DirectionalVectorToScalarFunction clone() { DirectionalVectorToScalarFunction clone = (DirectionalVectorToScalarFunction) super.clone(); clone.setVectorScalarFunction( ObjectUtil.cloneSmart( this.getVectorScalarFunction() ) ); clone.setVectorOffset( ObjectUtil.cloneSafe( this.getVectorOffset() ) ); clone.setDirection( ObjectUtil.cloneSafe( this.getDirection() ) ); clone.lastEvaluation = null; return clone; }
@Override public VectorFunctionToScalarFunction<InputType> clone() { @SuppressWarnings("unchecked") final VectorFunctionToScalarFunction<InputType> result = (VectorFunctionToScalarFunction<InputType>) super.clone(); result.vectorFunction = ObjectUtil.cloneSmart(this.vectorFunction); return result; }
/** * Copy constructor * @param other * SMDM to copy */ public ScalarMixtureDensityModel( final ScalarMixtureDensityModel other ) { this( ObjectUtil.cloneSmartElementsAsArrayList(other.getDistributions()), ObjectUtil.deepCopy(other.getPriorWeights()) ); }
/** * Returns an ArrayList of field/value pairs * @param o * Object to get the field/value pairs * @return * ArrayList of field/value pairs. The value component of the DefaultPair will * be null if the field is protected by the security manager */ public static ArrayList<DefaultPair<Field,Object>> getAllFieldValues( final Object o ) { LinkedList<Field> fields = ObjectUtil.getAllFields( o.getClass() ); ArrayList<Object> values = ObjectUtil.getFieldValues( o, fields ); return DefaultPair.mergeCollections( fields, values ); }