public void lower(ArrayCopySlowPathNode arraycopy, LoweringTool tool) { StructuredGraph graph = arraycopy.graph(); if (!graph.getGuardsStage().areFrameStatesAtDeopts()) { // Can't be lowered yet return; } SnippetInfo snippetInfo = arraycopy.getSnippet(); Arguments args = new Arguments(snippetInfo, graph.getGuardsStage(), tool.getLoweringStage()); args.add("nonNullSrc", arraycopy.getSource()); args.add("srcPos", arraycopy.getSourcePosition()); args.add("nonNullDest", arraycopy.getDestination()); args.add("destPos", arraycopy.getDestinationPosition()); if (snippetInfo == arraycopyUnrolledWorkSnippet) { args.addConst("length", ((Integer) arraycopy.getArgument()).intValue()); args.addConst("elementKind", arraycopy.getElementKind()); } else { args.add("length", arraycopy.getLength()); } if (snippetInfo == arraycopyPredictedObjectWorkSnippet) { HotSpotResolvedObjectType arrayKlass = (HotSpotResolvedObjectType) tool.getMetaAccess().lookupJavaType(Object[].class); ValueNode objectArrayKlass = ConstantNode.forConstant( KlassPointerStamp.klassNonNull(), arrayKlass.klass(), tool.getMetaAccess(), arraycopy.graph()); args.add("objectArrayKlass", objectArrayKlass); args.addConst("counter", arraycopyCallCounters.get(JavaKind.Object)); args.addConst("copiedCounter", arraycopyCallCopiedCounters.get(JavaKind.Object)); } instantiate(args, arraycopy); }
/** * Returns an exact copy of the game. This may be used for forward searches such as minimax. The * copying is relatively efficient. * * @return the game */ public Game copy() { Game copy = new Game(); copy.seed = seed; copy.rnd = new Random(seed); copy.laberintoActua = laberintoActua; copy.pills = (BitSet) pills.clone(); copy.powerPills = (BitSet) powerPills.clone(); copy.indiceDeLaberinto = indiceDeLaberinto; copy.cuentaElLvl = cuentaElLvl; copy.tiempoLvlActual = tiempoLvlActual; copy.tiempoTotal = tiempoTotal; copy.score = score; copy.fastamasComerMultiplicador = fastamasComerMultiplicador; copy.juegoTerminado = juegoTerminado; copy.timeOfLastGlobalReversal = timeOfLastGlobalReversal; copy.pacmanFueComido = pacmanFueComido; copy.pastillaFueComida = pastillaFueComida; copy.pildoraPoderFueComida = pildoraPoderFueComida; copy.pacman = pacman.copy(); copy.fantasmaComido = new EnumMap<GHOST, Boolean>(GHOST.class); copy.fantasmas = new EnumMap<GHOST, Ghost>(GHOST.class); for (GHOST ghostType : GHOST.values()) { copy.fantasmas.put(ghostType, fantasmas.get(ghostType).copy()); copy.fantasmaComido.put(ghostType, fantasmaComido.get(ghostType)); } return copy; }
private void targetStateChanged( final ConsumerTarget.State oldState, final ConsumerTarget.State newState) { if (oldState != newState) { if (newState == ConsumerTarget.State.CLOSED) { if (_targetClosed.compareAndSet(false, true)) { getEventLogger().message(getLogSubject(), SubscriptionMessages.CLOSE()); } } if (newState == ConsumerTarget.State.SUSPENDED) { _suspendedConsumerLoggingTicker.setStartTime(System.currentTimeMillis()); getSessionModel().addTicker(_suspendedConsumerLoggingTicker); } else { getSessionModel().removeTicker(_suspendedConsumerLoggingTicker); } } if (newState == ConsumerTarget.State.CLOSED && oldState != newState && !_closed.get()) { closeAsync(); } final StateChangeListener<? super QueueConsumerImpl, State> stateListener = getStateListener(); if (stateListener != null) { stateListener.stateChanged(this, STATE_MAP.get(oldState), STATE_MAP.get(newState)); } }
public void syncPanel() { panelPat.syncPanel(); regionAButton.setBorderPainted(dlg.panelMain.mark.getRegion() == Reg.A); regionBButton.setBorderPainted(dlg.panelMain.mark.getRegion() == Reg.B); regionCButton.setBorderPainted(dlg.panelMain.mark.getRegion() == Reg.C); elevBox.setText(dlg.panelMain.mark.getElevation()); heightBox.setText(dlg.panelMain.mark.getObjectHeight()); sourceBox.setText(dlg.panelMain.mark.getSource()); infoBox.setText(dlg.panelMain.mark.getInfo()); for (Sts sts : statuses.keySet()) { int item = statuses.get(sts); if (dlg.panelMain.mark.getStatus() == sts) statusBox.setSelectedIndex(item); } for (Cns cns : constructions.keySet()) { int item = constructions.get(cns); if (dlg.panelMain.mark.getConstr() == cns) constrBox.setSelectedIndex(item); } for (Con con : conspicuities.keySet()) { int item = conspicuities.get(con); if (dlg.panelMain.mark.getConsp() == con) conBox.setSelectedIndex(item); } for (Con con : reflectivities.keySet()) { int item = reflectivities.get(con); if (dlg.panelMain.mark.getRefl() == con) reflBox.setSelectedIndex(item); } }
/** * satisfy for continuous data types. * * @param theGeneticDataType * @return true if the value is in one of the inequalities passed by the spec */ public boolean satisfy(GeneticDataTypes theGeneticDataType, float value) throws IllegalArgumentException { if (theGeneticDataType.getTheDataTypeCategory().equals(DataTypeCategory.Discrete)) { throw new IllegalArgumentException( "satisfy for continuous data types only takes continuous GeneticDataTypes"); } ResultDataTypeSpec theResultDataTypeSpec = finalDataTypeSpecs.get(theGeneticDataType); if (null == theResultDataTypeSpec) { return false; } if (theResultDataTypeSpec.acceptAll) { return true; } if (theResultDataTypeSpec.combinedLesserContinuousDataTypeSpec != null && finalDataTypeSpecs .get(theGeneticDataType) .combinedLesserContinuousDataTypeSpec .satisfy(value)) { return true; } if (theResultDataTypeSpec.combinedGreaterContinuousDataTypeSpec != null && finalDataTypeSpecs .get(theGeneticDataType) .combinedGreaterContinuousDataTypeSpec .satisfy(value)) { return true; } return false; }
public void sendToAllClients(MSPacket packet, World world, int x, int y, int z, int maxDistance) { channels .get(Side.SERVER) .attr(FMLOutboundHandler.FML_MESSAGETARGET) .set(FMLOutboundHandler.OutboundTarget.ALL); channels.get(Side.SERVER).writeOutbound(packet); }
public static final void sendToAll(BasePacket packet) { channels .get(Side.SERVER) .attr(FMLOutboundHandler.FML_MESSAGETARGET) .set(FMLOutboundHandler.OutboundTarget.ALL); channels.get(Side.SERVER).writeOutbound(packet); }
public static final void sendToServer(BasePacket packet) { channels .get(Side.CLIENT) .attr(FMLOutboundHandler.FML_MESSAGETARGET) .set(FMLOutboundHandler.OutboundTarget.TOSERVER); channels.get(Side.CLIENT).writeOutbound(packet); }
public static boolean isValid(EnumMap<?, ?> expected, EnumMap<?, ?> map) { if (map == null) { return false; } Set<?> entries = expected.entrySet(); Iterator<?> entryIter = entries.iterator(); while (entryIter.hasNext()) { Entry<?, ?> entry = (Entry<?, ?>) entryIter.next(); Object value = map.get(entry.getKey()); if (value != entry.getValue()) { if (value == null || entry.getValue() == null) { return false; } if (!map.get(entry.getKey()).equals(entry.getValue())) { return false; } } } return true; }
/** * Another satisfy for continuous data types. Indicates whether a particular value is higher or * lower (as specified by theDirection) than the upper or lower threshold. * * <p> * * @param theGeneticDataType * @return true if the value is satisfied by the specified inequalities in the spec */ public boolean satisfy(GeneticDataTypes theGeneticDataType, float value, Direction theDirection) throws IllegalArgumentException { if (!theGeneticDataType.getTheDataTypeCategory().equals(DataTypeCategory.Continuous)) { throw new IllegalArgumentException( "satisfy for continuous data types only takes continuous GeneticDataTypes"); } ResultDataTypeSpec theResultDataTypeSpec = finalDataTypeSpecs.get(theGeneticDataType); if (null == theResultDataTypeSpec) { return false; } if (theResultDataTypeSpec.acceptAll) { return true; } switch (theDirection) { case higher: return (theResultDataTypeSpec.combinedGreaterContinuousDataTypeSpec != null && finalDataTypeSpecs .get(theGeneticDataType) .combinedGreaterContinuousDataTypeSpec .satisfy(value)); case lower: return (theResultDataTypeSpec.combinedLesserContinuousDataTypeSpec != null && finalDataTypeSpecs .get(theGeneticDataType) .combinedLesserContinuousDataTypeSpec .satisfy(value)); } // unreachable code; keep compiler happy // TODO: throw an exception return false; }
/** Returns the Information of a ParsedPage which are selected by the actual configuration */ public String getSelectedText(ParsedPage pp) { if (pp == null) return null; StringBuilder sb = new StringBuilder(); levelModifier = pp.getSection(0).getLevel() - 1; if (pageHandling == null) { if (firstParagraphHandling != null) { handleContent(pp.getFirstParagraph(), firstParagraphHandling, sb); deleteParagraph(pp.getFirstParagraphNr(), pp.getSections()); } for (Section s : pp.getSections()) handleSection(s, sb); } else { if (pageHandling.get(CIT.TEXT)) { sb.append(pp.getText()); } else { if (pageHandling.get(CIT.BOLD)) { handleSpans(pp.getFormatSpans(FormatType.BOLD), pp.getText(), sb); } if (pageHandling.get(CIT.ITALIC)) { handleSpans(pp.getFormatSpans(FormatType.ITALIC), pp.getText(), sb); } } if (pageHandling.get(CIT.LINK)) handleLinks(pp.getLinks(), !pageHandling.get(CIT.TEXT), sb); } return sb.toString().trim(); }
public void actionPerformed(java.awt.event.ActionEvent e) { if ((dlg.panelMain.mark.getObject() != Obj.MORFAC) || (dlg.panelMain.mark.getCategory() == Cat.MOR_BUOY)) { for (Shp shp : shapes.keySet()) { JRadioButton button = shapes.get(shp); if (button.isSelected()) { dlg.panelMain.mark.setShape(shp); if (SeaMark.EntMAP.get(dlg.panelMain.mark.getObject()) != Ent.MOORING) { dlg.panelMain.mark.setObject(objects.get(shp)); if (dlg.panelMain.mark.getObjColour(0) == Col.UNKCOL) { dlg.panelMain.mark.setObjPattern(Pat.NOPAT); dlg.panelMain.mark.setObjColour(Col.YELLOW); } if (button == cairnButton) { dlg.panelMain.mark.setObjPattern(Pat.NOPAT); dlg.panelMain.mark.setObjColour(Col.UNKCOL); } topmarkButton.setVisible(dlg.panelMain.mark.testValid()); } button.setBorderPainted(true); } else button.setBorderPainted(false); } dlg.panelMain.panelMore.syncPanel(); } }
@Override public void actionPerformed(ActionEvent e) { for (Shp shp : shapes.keySet()) { JRadioButton button = shapes.get(shp); if (button.isSelected()) { SmedAction.panelMain.mark.setShape(shp); SmedAction.panelMain.mark.setObject(objects.get(shp)); button.setBorderPainted(true); } else { button.setBorderPainted(false); } } if (SmedAction.panelMain.mark.testValid()) { SmedAction.panelMain.panelChan.topmarkButton.setVisible(true); SmedAction.panelMain.panelChan.lightButton.setVisible(true); if (SmedAction.panelMain.mark.getCategory() == Cat.LAM_PORT) { switch (SmedAction.panelMain.mark.getRegion()) { case A: SmedAction.panelMain.mark.setObjPattern(Pat.NOPAT); SmedAction.panelMain.mark.setObjColour(Col.RED); break; case B: SmedAction.panelMain.mark.setObjPattern(Pat.NOPAT); SmedAction.panelMain.mark.setObjColour(Col.GREEN); break; case C: SmedAction.panelMain.mark.setObjPattern(Pat.HSTRP); SmedAction.panelMain.mark.setObjColour(Col.RED); SmedAction.panelMain.mark.addObjColour(Col.WHITE); SmedAction.panelMain.mark.addObjColour(Col.RED); SmedAction.panelMain.mark.addObjColour(Col.WHITE); break; } } else { SmedAction.panelMain.mark.setObjPattern(Pat.HSTRP); switch (SmedAction.panelMain.mark.getRegion()) { case A: SmedAction.panelMain.mark.setObjColour(Col.RED); SmedAction.panelMain.mark.addObjColour(Col.GREEN); SmedAction.panelMain.mark.addObjColour(Col.RED); break; case B: SmedAction.panelMain.mark.setObjColour(Col.GREEN); SmedAction.panelMain.mark.addObjColour(Col.RED); SmedAction.panelMain.mark.addObjColour(Col.GREEN); break; case C: SmedAction.panelMain.mark.setObjColour(Col.RED); SmedAction.panelMain.mark.addObjColour(Col.GREEN); SmedAction.panelMain.mark.addObjColour(Col.RED); SmedAction.panelMain.mark.addObjColour(Col.GREEN); break; } } SmedAction.panelMain.panelMore.syncPanel(); } else { SmedAction.panelMain.panelChan.topmarkButton.setVisible(false); SmedAction.panelMain.panelChan.lightButton.setVisible(false); } }
private void printExecutionPhaseStatistics() { PhaseStatistics prepPhase = phaseStatistics.get(ProfilePhase.PREPARE); PhaseStatistics execPhase = phaseStatistics.get(ProfilePhase.EXECUTE); PhaseStatistics finishPhase = phaseStatistics.get(ProfilePhase.FINISH); if (!execPhase.wasExecuted()) { return; } lnPrint("=== EXECUTION PHASE INFORMATION ===\n"); long graphTime = execPhase.getTotalDurationNanos(ProfilerTask.ACTION_GRAPH); long execTime = execPhase.getPhaseDurationNanos() - graphTime; if (prepPhase.wasExecuted()) { lnPrintf( TWO_COLUMN_FORMAT, "Total preparation time", TimeUtilities.prettyTime(prepPhase.getPhaseDurationNanos())); } lnPrintf( TWO_COLUMN_FORMAT, "Total execution phase time", TimeUtilities.prettyTime(execPhase.getPhaseDurationNanos())); if (finishPhase.wasExecuted()) { lnPrintf( TWO_COLUMN_FORMAT, "Total time finalizing build", TimeUtilities.prettyTime(finishPhase.getPhaseDurationNanos())); } printLn(); lnPrintf( TWO_COLUMN_FORMAT, "Action dependency map creation", TimeUtilities.prettyTime(graphTime)); lnPrintf(TWO_COLUMN_FORMAT, "Actual execution time", TimeUtilities.prettyTime(execTime)); CriticalPathText criticalPaths = null; if (criticalPathStatistics.isPresent()) { criticalPaths = new CriticalPathText(out, criticalPathStatistics.get(), execTime); criticalPaths.printTimingBreakdown(); printLn(); } printTimingDistribution(execPhase); printLn(); if (criticalPathStatistics.isPresent()) { criticalPaths.printCriticalPaths(); printLn(); } if (missingActionsCount > 0) { lnPrint(missingActionsCount); print( " action(s) are present in the" + " action graph but missing instrumentation data. Most likely the profile file" + " has been created during a failed or aborted build."); printLn(); } printVfsStatistics(execPhase.getVfsStatistics()); }
public static final void sendToPlayer(BasePacket packet, EntityPlayer player) { channels .get(Side.SERVER) .attr(FMLOutboundHandler.FML_MESSAGETARGET) .set(FMLOutboundHandler.OutboundTarget.PLAYER); channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player); channels.get(Side.SERVER).writeOutbound(packet); }
public double getAvgLastProposeMessageReceivedDuration() { int count = counters.get(Counter.LAST_PROPOSE_MESSAGE_RECEIVED).get(); if (count > 0) { long dur = durations.get(Duration.LAST_PROPOSE_MESSAGE).get(); return convertNanosToMillis(dur) / count; } return 0D; }
public void addFinalSequenceNumberDuration(long duration) { if (!shouldCollectStats(duration)) { return; } counters.get(Counter.FINAL_MESSAGE_RECEIVED).incrementAndGet(); durations.get(Duration.FINAL_MESSAGE).addAndGet(duration); }
public void addDataMessageDuration(long duration) { if (!shouldCollectStats(duration)) { return; } counters.get(Counter.DATA_MESSAGE_RECEIVED).incrementAndGet(); durations.get(Duration.DATA_MESSAGE).addAndGet(duration); }
public double getAvgAnycastSentDuration() { int count = counters.get(Counter.ANYCAST_MESSAGE_SENT).get(); if (count > 0) { long dur = durations.get(Duration.ANYCAST_MESSAGE_SENT).get(); return convertNanosToMillis(dur) / count; } return 0D; }
public double getAvgFinalMessageReceivedDuration() { int count = counters.get(Counter.FINAL_MESSAGE_RECEIVED).get(); if (count > 0) { long dur = durations.get(Duration.FINAL_MESSAGE).get(); return convertNanosToMillis(dur) / count; } return 0D; }
public double getAvgNumberOfUnicastSentPerAnycast() { int multicast = counters.get(Counter.ANYCAST_MESSAGE_SENT).get(); if (multicast > 0) { int unicast = counters.get(Counter.UNICAST_MESSAGE_SENT).get(); return unicast * 1.0 / multicast; } return 0D; }
public synchronized void decreaseStock(Book book, int quantity, int jobSeqNum) throws InterruptedException { while (!inventory.containsKey(book) || inventory.get(book).intValue() < quantity) { wait(); } inventory.put(book, inventory.get(book) - quantity); printWork(false, jobSeqNum, book, inventory.get(book) + quantity, inventory.get(book)); }
public void sendToPlayer(EntityPlayer entityplayer, MSPacket packet) { channels .get(Side.SERVER) .attr(FMLOutboundHandler.FML_MESSAGETARGET) .set(FMLOutboundHandler.OutboundTarget.PLAYER); channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(entityplayer); channels.get(Side.SERVER).writeOutbound(packet); }
public void addAnycastSentDuration(long duration, int numberOfUnicasts) { if (!shouldCollectStats(duration)) { return; } counters.get(StatsCollector.Counter.UNICAST_MESSAGE_SENT).addAndGet(numberOfUnicasts); counters.get(Counter.ANYCAST_MESSAGE_SENT).incrementAndGet(); durations.get(Duration.ANYCAST_MESSAGE_SENT).addAndGet(duration); }
/** * If in lair (getLairTime(-)>0) or if not at junction. * * @param ghostType the ghost type * @return true, if successful */ public boolean doesGhostRequireAction(GHOST ghostType) { // inlcude neutral here for the unique case where the ghost just left the lair return ((isJunction(fantasmas.get(ghostType).currentNodeIndex) || (fantasmas.get(ghostType).lastMoveMade == MOVE.NEUTRAL) && fantasmas.get(ghostType).currentNodeIndex == laberintoActua.initialGhostNodeIndex) && (fantasmas.get(ghostType).edibleTime == 0 || fantasmas.get(ghostType).edibleTime % GHOST_SPEED_REDUCTION != 0)); }
private static void handleContent(Content c, EnumMap<CIT, Boolean> hp, StringBuilder sb) { if (hp != null) { if (hp.get(CIT.TEXT)) sb.append(c.getText() + " "); else { if (hp.get(CIT.BOLD)) handleSpans(c.getFormatSpans(FormatType.BOLD), c.getText(), sb); if (hp.get(CIT.ITALIC)) handleSpans(c.getFormatSpans(FormatType.ITALIC), c.getText(), sb); } if (hp.get(CIT.LINK)) handleLinks(c.getLinks(), !hp.get(CIT.TEXT), sb); } }
/** * Send to the server * * @param pkt */ public void sendToServer(FMLProxyPacket pkt) { channels .get(Side.CLIENT) .attr(FMLOutboundHandler.FML_MESSAGETARGET) .set(FMLOutboundHandler.OutboundTarget.TOSERVER); channels .get(Side.CLIENT) .writeAndFlush(pkt) .addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE); }
/** * Send to a specific player * * @param pkt * @param player */ public void sendTo(FMLProxyPacket pkt, EntityPlayerMP player) { channels .get(Side.SERVER) .attr(FMLOutboundHandler.FML_MESSAGETARGET) .set(FMLOutboundHandler.OutboundTarget.PLAYER); channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player); channels .get(Side.SERVER) .writeAndFlush(pkt) .addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE); }
/** * Send to all around a point * * @param pkt * @param point */ public void sendToAllAround(FMLProxyPacket pkt, NetworkRegistry.TargetPoint point) { channels .get(Side.SERVER) .attr(FMLOutboundHandler.FML_MESSAGETARGET) .set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT); channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(point); channels .get(Side.SERVER) .writeAndFlush(pkt) .addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE); }
/** * Send to all in a dimension * * @param pkt * @param dimensionId */ public void sendToDimension(FMLProxyPacket pkt, int dimensionId) { channels .get(Side.SERVER) .attr(FMLOutboundHandler.FML_MESSAGETARGET) .set(FMLOutboundHandler.OutboundTarget.DIMENSION); channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(dimensionId); channels .get(Side.SERVER) .writeAndFlush(pkt) .addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE); }