Java Code Examples for java.util.EnumMap#keySet()
The following examples show how to use
java.util.EnumMap#keySet() .
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: DomDeck.java From DominionSim with MIT License | 6 votes |
public DomCardName getMostLikelyCardOnTop() { if (getDeckAndDiscardSize()==0) return null; if (drawDeck.isEmpty()){ drawDeck.addAll(discardPile); discardPile.clear(); } if (owner.getKnownTopCards()>0) return drawDeck.get(0).getName(); shuffle(); DomCardName theMostLikelyCard=null; EnumMap<DomCardName, Integer> theCounts = new EnumMap<DomCardName, Integer>(DomCardName.class); for (DomCard card : drawDeck){ if (theCounts.get(card.getName())==null){ theCounts.put(card.getName(),1); } else { theCounts.put(card.getName(),theCounts.get(card.getName())+1); } } for (DomCardName cardName : theCounts.keySet()){ if (theMostLikelyCard==null || theCounts.get(cardName)>theCounts.get(theMostLikelyCard)) theMostLikelyCard=cardName; } return theMostLikelyCard; }
Example 2
Source File: VmwareStorageSubsystemCommandHandler.java From cloudstack with Apache License 2.0 | 6 votes |
public boolean reconfigureStorageProcessor(EnumMap<VmwareStorageProcessorConfigurableFields,Object> params) { VmwareStorageProcessor processor = (VmwareStorageProcessor) this.processor; for (VmwareStorageProcessorConfigurableFields key : params.keySet()){ switch (key){ case NFS_VERSION: Integer nfsVersion = (Integer) params.get(key); processor.setNfsVersion(nfsVersion); this._nfsVersion = nfsVersion; break; case FULL_CLONE_FLAG: boolean fullClone = (boolean) params.get(key); processor.setFullCloneFlag(fullClone); break; default: s_logger.error("Unknown reconfigurable field " + key.getName() + " for VmwareStorageProcessor"); return false; } } return true; }
Example 3
Source File: Ephemeris.java From Astrosoft with GNU General Public License v2.0 | 6 votes |
@Override public String toString() { StringBuilder sb = new StringBuilder(); /*for (Planet p : Planet.planetsAsc()) { sb.append(p + "\t"); } sb.append("\n");*/ for(EnumMap<Planet, EphData> planetEphData : ephemeris){ for(Planet p : planetEphData.keySet()){ sb.append(planetEphData.get(p) + "\t"); } sb.append("\n"); } return sb.toString(); }
Example 4
Source File: WorkStatus.java From ipst with Mozilla Public License 2.0 | 5 votes |
public WorkStatus(Integer stateId, EnumMap<OnlineTaskType, OnlineTaskStatus> st, String time) { this.stateId = stateId; this.timeHorizon = time; this.status = new HashMap<String, String>(); for (OnlineTaskType k : st.keySet()) { status.put(k.toString(), st.get(k).toString()); } }
Example 5
Source File: WorkStatus.java From ipst with Mozilla Public License 2.0 | 5 votes |
public WorkStatus(Integer stateId, EnumMap<OnlineTaskType, OnlineTaskStatus> st, String time, String detail) { this.stateId = stateId; this.timeHorizon = time; this.status = new HashMap<String, String>(); for (OnlineTaskType k : st.keySet()) { status.put(k.toString(), st.get(k).toString()); } this.detail = detail; }
Example 6
Source File: JavaEnumExamples.java From journaldev with MIT License | 5 votes |
private static void usingEnumMap() { EnumMap<ThreadStates, String> enumMap = new EnumMap<ThreadStates,String>(ThreadStates.class); enumMap.put(ThreadStates.START, "Thread is started"); enumMap.put(ThreadStates.RUNNING, "Thread is running"); enumMap.put(ThreadStates.WAITING, "Thread is waiting"); enumMap.put(ThreadStates.DEAD, "Thread is dead"); Set<ThreadStates> keySet = enumMap.keySet(); for(ThreadStates key : keySet){ System.out.println("key="+key.toString()+":: value="+enumMap.get(key)); } }
Example 7
Source File: DomDeck.java From DominionSim with MIT License | 5 votes |
public DomCardName getMostLikelyCrappyCardForDoctor() { if (getDeckAndDiscardSize()==0) return null; if (drawDeck.isEmpty()){ drawDeck.addAll(discardPile); discardPile.clear(); shuffle(); } DomCardName theMostLikelyCard=null; EnumMap<DomCardName, Integer> theCounts = new EnumMap<DomCardName, Integer>(DomCardName.class); int theMultiplier = 1; for (DomCard card : drawDeck){ if (card.getTrashPriority()<=DomCardName.Copper.getTrashPriority(owner)) { if (card.getName() == DomCardName.Curse) { theMultiplier = 5; } if (card.hasCardType(DomCardType.Victory)) { theMultiplier = 3; } if (theCounts.get(card.getName()) == null) { theCounts.put(card.getName(), theMultiplier); } else { theCounts.put(card.getName(), theCounts.get(card.getName()) + theMultiplier); } } } for (DomCardName cardName : theCounts.keySet()){ if (theMostLikelyCard==null || theCounts.get(cardName)>theCounts.get(theMostLikelyCard)) theMostLikelyCard=cardName; } if (theMostLikelyCard==null) return DomCardName.Copper; return theMostLikelyCard; }
Example 8
Source File: SelectiveAccessHandler.java From dkpro-jwpl with Apache License 2.0 | 5 votes |
/** * Converts a CITMap into a human readable String */ public static String CITInfo( EnumMap<CIT, Boolean> hp ){ StringBuilder result = new StringBuilder(); result.append( "["); if( hp!= null ){ for( CIT key: hp.keySet()) result.append( key.toString()+":"+hp.get(key)+", "); result.delete( result.length()-2, result.length() ); } result.append( "]" ); return result.toString(); }
Example 9
Source File: SelectiveAccessHandler.java From dkpro-jwpl with Apache License 2.0 | 5 votes |
/** * Converts a SITMap into a human readable String */ public static String SITInfo( EnumMap<SIT, EnumMap<CIT, Boolean>> shp ){ StringBuilder result = new StringBuilder(); for( SIT key: shp.keySet() ){ result.append("\t"+key.toString()+":"+CITInfo( shp.get(key))+"\n"); } return result.toString(); }
Example 10
Source File: SelectiveAccessHandler.java From dkpro-jwpl with Apache License 2.0 | 5 votes |
private static String XMLCIT( EnumMap<CIT, Boolean> em ){ StringBuilder result = new StringBuilder(); result.append( "<cit" ); if( em != null ) for( CIT key: em.keySet() ) result.append( " "+ key.toString()+"=\""+em.get(key)+"\"" ); result.append( "/>" ); return result.toString(); }
Example 11
Source File: SelectiveAccessHandler.java From dkpro-jwpl with Apache License 2.0 | 5 votes |
private static String XMLSIT( EnumMap<SIT, EnumMap<CIT, Boolean>> sem ){ StringBuilder result = new StringBuilder(); for( SIT key: sem.keySet() ){ result.append( "<"+key.toString()+">"); result.append( XMLCIT( sem.get( key ) ) ); result.append( "</"+key.toString()+">\n"); } return result.toString(); }
Example 12
Source File: WorkStatus.java From ipst with Mozilla Public License 2.0 | 4 votes |
public void setStatus(EnumMap<OnlineTaskType, OnlineTaskStatus> st) { this.status = new HashMap<String, String>(); for (OnlineTaskType k : st.keySet()) { status.put(k.toString(), st.get(k).toString()); } }
Example 13
Source File: TestWrongMapIterator.java From huntbugs with Apache License 2.0 | 4 votes |
@AssertNoWarning("*") public void testEnumMap(EnumMap<TimeUnit, String> m) { for(TimeUnit key : m.keySet()) { System.out.println(m.get(key)); } }
Example 14
Source File: Bug1422.java From spotbugs with GNU Lesser General Public License v2.1 | 4 votes |
@NoWarning("WMI_WRONG_MAP_ITERATOR") public void iterateEnumMap(EnumMap<TimeUnit, String> map) { for(TimeUnit u : map.keySet()) { System.out.println(u+": "+map.get(u)); } }
Example 15
Source File: HoroscopeExporter.java From Astrosoft with GNU General Public License v2.0 | 3 votes |
public void export(AshtaVargaChartData ashtavargaChart) { try { xmlWriter.add(xmlef.createStartElement(XmlConsts.ASHTVARGA_CHART_TAG, null,null)); xmlWriter.add(xmlef.createAttribute(XmlConsts.Name, ashtavargaChart.getChartName())); EnumMap<Rasi, Integer> varga = ashtavargaChart.getVarga(); for(Rasi rasi : varga.keySet()){ xmlWriter.add(xmlef.createStartElement(XmlConsts.ASHTVARGA_HOUSE_TAG, null,null)); xmlWriter.add(xmlef.createAttribute(XmlConsts.Number, String.valueOf(rasi.ordinal()+1))); xmlWriter.add(xmlef.createCharacters(varga.get(rasi).toString())); xmlWriter.add(xmlef.createEndElement(XmlConsts.ASHTVARGA_HOUSE_TAG, null)); } xmlWriter.add(xmlef.createEndElement(XmlConsts.ASHTVARGA_CHART_TAG, null)); }catch(Exception e){ log.log(Level.SEVERE, "Exception in writing chart xml ", e); } }