List of usage examples for java.util EnumSet clone
@SuppressWarnings("unchecked") public EnumSet<E> clone()
From source file:Numbers.java
public static void main(String[] args) { EnumSet<Numbers> set1 = EnumSet.allOf(Numbers.class); System.out.println("Set1:" + set1); EnumSet<Numbers> set2 = set1.clone(); System.out.println("Set2:" + set2); }
From source file:org.grouplens.grapht.solver.BindRuleImpl.java
/** * Create a bind rule that matches a desire when the desired type equals * <tt>depType</tt> and the desire's qualifier matches <tt>qualifier</tt> * .//from www. j av a 2s .c om * * @param depType The dependency type this bind rule matches * @param satisfaction The Satisfaction used by applied desires * @param policy The CachePolicy for nodes created by this bind rule * @param qualifier The Qualifier the bind rule applies to * @param flags The flags to apply to this bind rule and its results. * @throws NullPointerException if arguments are null */ public BindRuleImpl(@Nonnull Class<?> depType, @Nonnull Satisfaction satisfaction, @Nonnull CachePolicy policy, @Nonnull QualifierMatcher qualifier, EnumSet<BindingFlag> flags) { Preconditions.notNull("dependency type", depType); Preconditions.notNull("satisfaction", satisfaction); Preconditions.notNull("policy", policy); Preconditions.notNull("qualifier matcher", qualifier); this.qualifier = qualifier; this.satisfaction = satisfaction; this.implType = satisfaction.getErasedType(); this.policy = policy; this.depType = Types.box(depType); this.flags = flags.clone(); // verify that the satisfaction produces proper types Preconditions.isAssignable(this.depType, this.implType); }
From source file:org.grouplens.grapht.solver.BindRuleImpl.java
/** * As the other constructor, but this is used for type to type bindings * where the implementation type is not yet instantiable, so there is no * satisfaction for the applied desires. * /*from w w w . j a va2s . c om*/ * @param depType The dependency type this bind rule matches * @param implType The implementation type that is bound * @param policy The CachePolicy for nodes created by this bind rule * @param qualifier The Qualifier the bind rule applies to * @param flags The flags to apply to this bind rule and its results. * @throws NullPointerException if arguments are null */ public BindRuleImpl(@Nonnull Class<?> depType, @Nonnull Class<?> implType, @Nonnull CachePolicy policy, @Nonnull QualifierMatcher qualifier, EnumSet<BindingFlag> flags) { Preconditions.notNull("dependency type", depType); Preconditions.notNull("implementation type", implType); Preconditions.notNull("policy", policy); Preconditions.notNull("qualifier matcher", qualifier); this.qualifier = qualifier; this.satisfaction = null; this.implType = Types.box(implType); this.policy = policy; this.depType = Types.box(depType); this.flags = flags.clone(); // verify that implType extends depType Preconditions.isAssignable(this.depType, this.implType); }
From source file:org.pshdl.model.simulation.codegenerator.JavaCodeGenerator.java
protected CharSequence arrayInit(final VariableInformation varInfo, final BigInteger zero, final EnumSet<CommonCodeGenerator.Attributes> attributes) { final EnumSet<CommonCodeGenerator.Attributes> attrClone = attributes.clone(); attrClone.add(CommonCodeGenerator.Attributes.baseType); StringConcatenation _builder = new StringConcatenation(); _builder.append("new "); CharSequence _fieldType = this.fieldType(varInfo, attrClone); _builder.append(_fieldType, ""); _builder.append("["); int _arraySize = this.getArraySize(varInfo); _builder.append(_arraySize, ""); _builder.append("]"); return _builder; }