List of usage examples for java.util Collections fill
public static <T> void fill(List<? super T> list, T obj)
From source file:edu.oregonstate.eecs.mcplan.sim.OptionRunner.java
public OptionRunner(final SimultaneousMoveSimulator<S, A> sim, final ArrayList<Policy<S, Option<S, A>>> policies, final int T) { sim_ = sim;//from www . j a v a2 s . c o m policies_ = policies; T_ = T; active_ = new ArrayList<Option<S, A>>(sim_.nagents()); Collections.fill(active_, null); }
From source file:org.um.feri.ears.problems.constrained.TLBOBenchmarkFunction5.java
public TLBOBenchmarkFunction5() { super(3, 0);/*from w w w . ja va2 s . c o m*/ minimum = false; upperLimit = new ArrayList<Double>(Collections.nCopies(numberOfDimensions, 0.0)); lowerLimit = new ArrayList<Double>(Collections.nCopies(numberOfDimensions, 0.0)); Collections.fill(lowerLimit, 0.0); Collections.fill(upperLimit, 10.0); //System.out.println(Arrays.toString(interval)+"\n"+Arrays.toString(intervalL)); name = "TLBOBenchmarkFunction5 (TP11)"; }
From source file:org.um.feri.ears.problems.unconstrained.ProblemRosenbrock.java
public ProblemRosenbrock(int d, double j) { super(d, 0);/*from w w w .j a v a2 s.c om*/ upperLimit = new ArrayList<Double>(d); lowerLimit = new ArrayList<Double>(d); Collections.fill(lowerLimit, -j); Collections.fill(upperLimit, 2 * j); name = "Rosenbrock"; }
From source file:org.um.feri.ears.problems.constrained.TLBOBenchmarkFunction3.java
public TLBOBenchmarkFunction3() { super(7, 4);/*from w ww.ja v a2 s. co m*/ minimum = true; upperLimit = new ArrayList<Double>(Collections.nCopies(numberOfDimensions, 0.0)); lowerLimit = new ArrayList<Double>(Collections.nCopies(numberOfDimensions, 0.0)); Collections.fill(lowerLimit, -10.0); Collections.fill(upperLimit, 20.0); max_constraints = new Double[numberOfConstraints]; min_constraints = new Double[numberOfConstraints]; count_constraints = new Double[numberOfConstraints]; sum_constraints = new Double[numberOfConstraints]; normalization_constraints_factor = new Double[numberOfConstraints]; //System.out.println(Arrays.toString(interval)+"\n"+Arrays.toString(intervalL)); name = "TLBOBenchmarkFunction3 cec-g09"; }
From source file:org.um.feri.ears.problems.constrained.TLBOBenchmarkFunction2.java
public TLBOBenchmarkFunction2() { super(10, 1); minimum = false;//from ww w .j a v a 2 s .c o m upperLimit = new ArrayList<Double>(Collections.nCopies(numberOfDimensions, 0.0)); lowerLimit = new ArrayList<Double>(Collections.nCopies(numberOfDimensions, 0.0)); Collections.fill(lowerLimit, 0.0); Collections.fill(upperLimit, 1.0); max_constraints = new Double[numberOfConstraints]; min_constraints = new Double[numberOfConstraints]; count_constraints = new Double[numberOfConstraints]; sum_constraints = new Double[numberOfConstraints]; normalization_constraints_factor = new Double[numberOfConstraints]; // System.out.println(Arrays.toString(interval)+"\n"+Arrays.toString(intervalL)); name = "TLBOBenchmarkFunction2 cec-g03"; }
From source file:org.mercycorps.translationcards.activity.TranslationsActivity.java
@Override public void inflateView() { MainApplication application = (MainApplication) getApplication(); decoratedMediaManager = application.getDecoratedMediaManager(); dbManager = application.getDbManager(); deck = (Deck) getIntent().getSerializableExtra(INTENT_KEY_DECK); dictionaries = dbManager.getAllDictionariesForDeck(deck.getDbId()); currentDictionaryIndex = getIntent().getIntExtra(INTENT_KEY_CURRENT_DICTIONARY_INDEX, 0); setContentView(R.layout.activity_translations); translationCardStates = new ArrayList<>( Arrays.asList(new Boolean[dictionaries[currentDictionaryIndex].getTranslationCount()])); Collections.fill(translationCardStates, Boolean.FALSE); hideTranslationsWithoutAudioToggle = false; initTabs();//from w ww .j a v a 2 s . co m initList(); setDictionary(currentDictionaryIndex); ActionBar actionBar = getSupportActionBar(); actionBar.setTitle(deck.getLabel()); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setElevation(0); }
From source file:org.squale.squalecommon.datatransfertobject.result.ResultsDTO.java
/** * Permet de concatener une collection de resultsDTO * /*from w ww . j a v a2 s. com*/ * @param pResultsSrc ResultsDTO qui ajoute ses donnes au pResultsDest * @return ResultsDTO unique */ public ResultsDTO add(ResultsDTO pResultsSrc) { // Chargement des cls de chacune des Maps Map resultSrcMap = pResultsSrc.getResultMap(); Iterator result1Iterator = mResultMap.keySet().iterator(); Object currentKey = null; /* * Parcours des cles du premier ResultsDTO et concatenation de la liste (valeur) du deuxieme ResultsDTO * correspondant a la cle courante */ while (result1Iterator.hasNext()) { currentKey = result1Iterator.next(); if (resultSrcMap.get(currentKey) != null) { ((List) mResultMap.get(currentKey)).addAll((List) resultSrcMap.get(currentKey)); } } /* * Verification que tous les element du 2eme ResultsDTO sont presents dans le premier */ // TODO chemin non teste if (!mResultMap.keySet().containsAll(resultSrcMap.keySet())) { Iterator result2Iterator = resultSrcMap.keySet().iterator(); currentKey = null; // Ajout de la premiere liste while (result2Iterator.hasNext()) { currentKey = result2Iterator.next(); /* * SI la cl n'existe pas dans le premier ResultsDTO ALORS on ajoute une liste avec des nulls de la * taille des listes du premier ResultsDTO PUIS on concatene la liste de deuxieme ResultsDTO */ if (mResultMap.get(currentKey) == null) { List result1ListTemp = new ArrayList(((List) mResultMap.get(null)).size()); Collections.fill(result1ListTemp, null); result1ListTemp.addAll((List) resultSrcMap.get(currentKey)); } } } return this; }
From source file:org.mercycorps.translationcards.activity.TranslationsActivity.java
private void setSwitchClickListener() { SwitchCompat noAudioSwitch = (SwitchCompat) findViewById(R.id.no_audio_toggle); noAudioSwitch.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override//from w ww.ja v a2s . co m public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { hideTranslationsWithoutAudioToggle = isChecked; Collections.fill(translationCardStates, Boolean.FALSE); setDictionary(currentDictionaryIndex); } }); }
From source file:edu.oregonstate.eecs.mcplan.Controller.java
public Controller(final UndoSimulator<S, A> sim, final ActionGenerator<S, Option<S, A>> actions, final ArrayList<Policy<S, Option<S, A>>> rollout_policies, final int T, final double c, final MctsVisitor<S, A> visitor) { sim_ = sim;//from w ww. ja va2 s. c om actions_ = actions; rollout_policies_ = rollout_policies; assert (sim.getNumAgents() == 2); assert (rollout_policies.size() == 2); T_ = T; c_ = c; visitor_ = visitor; active_ = new ArrayList<Option<S, A>>(sim_.getNumAgents()); Collections.fill(active_, null); }
From source file:org.ejbca.core.model.ra.raadmin.EndEntityProfile.java
private void init(final boolean emptyprofile) { if (log.isDebugEnabled()) { log.debug("The highest number in dataConstants is: " + dataConstantsMaxValue); }//from ww w .j a va 2s. co m // Common initialization of profile final List<Integer> numberoffields = new ArrayList<Integer>(dataConstantsMaxValue); Collections.fill(numberoffields, Integer.valueOf(0)); data.put(NUMBERARRAY, numberoffields); data.put(SUBJECTDNFIELDORDER, new ArrayList<Integer>()); data.put(SUBJECTALTNAMEFIELDORDER, new ArrayList<Integer>()); data.put(SUBJECTDIRATTRFIELDORDER, new ArrayList<Integer>()); if (emptyprofile) { for (final String key : dataConstantsUsedInEmpty) { addFieldWithDefaults(key, "", Boolean.FALSE, Boolean.TRUE, Boolean.TRUE); } // Add another DC-field since (if used) more than one is always used addFieldWithDefaults(DnComponents.DOMAINCOMPONENT, "", Boolean.FALSE, Boolean.TRUE, Boolean.TRUE); // Set required fields setRequired(USERNAME, 0, true); setRequired(PASSWORD, 0, true); setRequired(DnComponents.COMMONNAME, 0, true); setRequired(DEFAULTCERTPROFILE, 0, true); setRequired(AVAILCERTPROFILES, 0, true); setRequired(DEFKEYSTORE, 0, true); setRequired(AVAILKEYSTORE, 0, true); setRequired(DEFAULTCA, 0, true); setRequired(AVAILCAS, 0, true); setRequired(ISSUANCEREVOCATIONREASON, 0, false); setRequired(STARTTIME, 0, false); setRequired(ENDTIME, 0, false); setRequired(ALLOWEDREQUESTS, 0, false); setRequired(CARDNUMBER, 0, false); setRequired(MAXFAILEDLOGINS, 0, false); setRequired(NAMECONSTRAINTS_EXCLUDED, 0, false); setRequired(NAMECONSTRAINTS_PERMITTED, 0, false); setValue(DEFAULTCERTPROFILE, 0, CONST_DEFAULTCERTPROFILE); setValue(AVAILCERTPROFILES, 0, CONST_AVAILCERTPROFILES1); setValue(DEFKEYSTORE, 0, CONST_DEFKEYSTORE); setValue(AVAILKEYSTORE, 0, CONST_AVAILKEYSTORE); setValue(AVAILCAS, 0, CONST_AVAILCAS); setValue(ISSUANCEREVOCATIONREASON, 0, CONST_ISSUANCEREVOCATIONREASON); // Do not use hard token issuers by default. setUse(AVAILTOKENISSUER, 0, false); setUse(STARTTIME, 0, false); setUse(ENDTIME, 0, false); setUse(ALLOWEDREQUESTS, 0, false); setUse(CARDNUMBER, 0, false); setUse(ISSUANCEREVOCATIONREASON, 0, false); setUse(MAXFAILEDLOGINS, 0, false); setValue(MAXFAILEDLOGINS, 0, Integer.toString(ExtendedInformation.DEFAULT_MAXLOGINATTEMPTS)); setUse(MINPWDSTRENGTH, 0, false); setUse(NAMECONSTRAINTS_PERMITTED, 0, false); setUse(NAMECONSTRAINTS_EXCLUDED, 0, false); } else { // initialize profile data addFieldWithDefaults(USERNAME, "", Boolean.TRUE, Boolean.TRUE, Boolean.TRUE); addFieldWithDefaults(PASSWORD, "", Boolean.TRUE, Boolean.TRUE, Boolean.TRUE); addField(AUTOGENPASSWORDTYPE); addFieldWithDefaults(AUTOGENPASSWORDLENGTH, "8", Boolean.FALSE, Boolean.TRUE, Boolean.TRUE); addFieldWithDefaults(DnComponents.COMMONNAME, "", Boolean.TRUE, Boolean.TRUE, Boolean.TRUE); addField(EMAIL); addFieldWithDefaults(DEFAULTCERTPROFILE, CONST_DEFAULTCERTPROFILE, Boolean.TRUE, Boolean.TRUE, Boolean.TRUE); addFieldWithDefaults(AVAILCERTPROFILES, CONST_AVAILCERTPROFILES2, Boolean.TRUE, Boolean.TRUE, Boolean.TRUE); addFieldWithDefaults(DEFKEYSTORE, CONST_DEFKEYSTORE, Boolean.TRUE, Boolean.TRUE, Boolean.TRUE); addFieldWithDefaults(AVAILKEYSTORE, CONST_AVAILKEYSTORE, Boolean.TRUE, Boolean.TRUE, Boolean.TRUE); addField(DEFAULTTOKENISSUER); // Do not use hard token issuers by default. addFieldWithDefaults(AVAILTOKENISSUER, "", Boolean.TRUE, Boolean.FALSE, Boolean.TRUE); addFieldWithDefaults(AVAILCAS, "", Boolean.TRUE, Boolean.TRUE, Boolean.TRUE); addFieldWithDefaults(DEFAULTCA, "", Boolean.TRUE, Boolean.TRUE, Boolean.TRUE); addFieldWithDefaults(STARTTIME, "", Boolean.FALSE, Boolean.FALSE, Boolean.TRUE); addFieldWithDefaults(ENDTIME, "", Boolean.FALSE, Boolean.FALSE, Boolean.TRUE); addFieldWithDefaults(ALLOWEDREQUESTS, "", Boolean.FALSE, Boolean.FALSE, Boolean.TRUE); addFieldWithDefaults(CARDNUMBER, "", Boolean.FALSE, Boolean.FALSE, Boolean.TRUE); addFieldWithDefaults(ISSUANCEREVOCATIONREASON, CONST_ISSUANCEREVOCATIONREASON, Boolean.FALSE, Boolean.FALSE, Boolean.TRUE); addFieldWithDefaults(MAXFAILEDLOGINS, Integer.toString(ExtendedInformation.DEFAULT_MAXLOGINATTEMPTS), Boolean.FALSE, Boolean.FALSE, Boolean.TRUE); addFieldWithDefaults(NAMECONSTRAINTS_PERMITTED, "", Boolean.FALSE, Boolean.FALSE, Boolean.TRUE); addFieldWithDefaults(NAMECONSTRAINTS_EXCLUDED, "", Boolean.FALSE, Boolean.FALSE, Boolean.TRUE); } }