private void run(Variable[] variables, List<VariableValue> values) throws Exception { if (variables.length > 0) { Variable variable = variables[0]; Variable[] rest = rest(variables); for (VariableValue value : variable.getValues()) { List<VariableValue> values2 = new ArrayList<VariableValue>(values); values2.add(value); run(rest, values2); } } else { SimpleScenarioStats stats0 = stats.next(values); for (MulticastParams p : params) { for (VariableValue value : values) { value.setup(p); } MulticastSet set = new MulticastSet(stats0, factory, p); stats0.setup(p); set.run(); for (VariableValue value : values) { value.teardown(p); } } System.out.print("#"); System.out.flush(); } }
public void setAvailable(boolean a) { _value.setVisible(a); for (Component c : sliders) { c.setVisible(a); } for (Component c : reps) { c.setVisible(a); } super.setAvailable(a); }
public void setAvailable(boolean a) { _value.setVisible(a); for (ComboCheckBox c : comboCBs) { c.setVisible(a); } for (VarComboBox c : comboVars) { c.setVisible(a); } for (ComboRadioButtons c : comboRBs) { c.setVisible(a); } super.setAvailable(a); }
// handle incoming parameter notification public void propertyChange(java.beans.PropertyChangeEvent e) { if (log.isDebugEnabled()) { log.debug("property changed event - name: " + e.getPropertyName()); } // notification from CV; check for Value being changed if (e.getPropertyName().equals("Busy") && ((Boolean) e.getNewValue()).equals(Boolean.FALSE)) { // busy transitions drive the state switch (_progState) { case IDLE: // no, just a CV update if (log.isDebugEnabled()) { log.error("Busy goes false with state IDLE"); } return; case WRITING_PI4R: // have written the PI, now write SI if needed case WRITING_PI4C: case WRITING_PI4W: if (log.isDebugEnabled()) { log.debug("Busy goes false with state WRITING_PI"); } // check for success if ((retries < RETRY_MAX) && ((_cvMap.get(programmingLow ? getCvName() : mSecondCVname)).getState() != CvValue.STORED)) { // need to retry on error; leave progState as it was log.debug("retry"); retries++; (_cvMap.get(programmingLow ? getCvName() : mSecondCVname)).writePI(_status); return; } // success, move on to next retries = 0; if (_progState == WRITING_PI4R) { _progState = WRITING_SI4R; } else if (_progState == WRITING_PI4C) { _progState = WRITING_SI4C; } else { _progState = WRITING_SI4W; } (_cvMap.get(programmingLow ? getCvName() : mSecondCVname)).writeSI(_status); return; case WRITING_SI4R: case WRITING_SI4C: case WRITING_SI4W: // have written SI if needed, now read or write CV if (log.isDebugEnabled()) { log.debug("Busy goes false with state WRITING_SI"); } // check for success if ((retries < RETRY_MAX) && ((_cvMap.get(programmingLow ? getCvName() : mSecondCVname)).getState() != CvValue.STORED)) { // need to retry on error; leave progState as it was log.debug("retry"); retries++; (_cvMap.get(programmingLow ? getCvName() : mSecondCVname)).writeSI(_status); return; } // success, move on to next retries = 0; if (_progState == WRITING_SI4R) { _progState = READING_CV; (_cvMap.get(programmingLow ? getCvName() : mSecondCVname)).readIcV(_status); } else if (_progState == WRITING_SI4C) { _progState = COMPARE_CV; (_cvMap.get(programmingLow ? getCvName() : mSecondCVname)).confirmIcV(_status); } else { _progState = WRITING_CV; (_cvMap.get(programmingLow ? getCvName() : mSecondCVname)).writeIcV(_status); } return; case READING_CV: // now done with the read request if (log.isDebugEnabled()) { log.debug("Finished reading the Indexed CV"); } // check for success if ((retries < RETRY_MAX) && ((_cvMap.get(programmingLow ? getCvName() : mSecondCVname)).getState() != CvValue.READ)) { // need to retry on error; leave progState as it was log.debug("retry"); retries++; (_cvMap.get(programmingLow ? getCvName() : mSecondCVname)).readIcV(_status); return; } // success, move on to next retries = 0; _progState = IDLE; if (doHigh) { doHigh = false; programmingLow = false; doRead(); } else if (doLow) { doLow = false; programmingLow = true; doRead(); } else { programmingLow = true; setBusy(false); } return; case COMPARE_CV: // now done with the read request if (log.isDebugEnabled()) { log.debug("Finished reading the Indexed CV for compare"); } // check for success SAME or DIFF? if ((retries < RETRY_MAX) && ((_cvMap.get(programmingLow ? getCvName() : mSecondCVname)).getState() != CvValue.SAME) && ((_cvMap.get(programmingLow ? getCvName() : mSecondCVname)).getState() != CvValue.DIFF)) { // need to retry on error; leave progState as it was log.debug("retry"); retries++; (_cvMap.get(programmingLow ? getCvName() : mSecondCVname)).confirmIcV(_status); } return; case WRITING_CV: // now done with the write request if (log.isDebugEnabled()) { log.debug("Finished writing the Indexed CV"); } // check for success if ((retries < RETRY_MAX) && ((_cvMap.get(programmingLow ? getCvName() : mSecondCVname)).getState() != CvValue.STORED)) { // need to retry on error; leave progState as it was log.debug("retry"); retries++; (_cvMap.get(programmingLow ? getCvName() : mSecondCVname)).writeIcV(_status); return; } // success, move on to next retries = 0; _progState = IDLE; if (doHigh) { doHigh = false; programmingLow = false; doWrite(); } else if (doLow) { doLow = false; programmingLow = true; doWrite(); } else { super.setState(STORED); setBusy(false); } return; default: // unexpected! log.error("Unexpected state found: " + _progState); _progState = IDLE; return; } } else if (e.getPropertyName().equals("State")) { CvValue cvLow = _cvMap.get(getCvName()); CvValue cvHigh = _cvMap.get(mSecondCVname); if (log.isDebugEnabled()) { log.debug(" found cvLow=" + cvLow + " cvHigh=" + cvHigh); } if (log.isDebugEnabled()) { log.debug("CV State changed to " + cvLow.getState()); } if (cvHigh.getState() == VariableValue.UNKNOWN) { if (cvLow.getState() == VariableValue.EDITED) { setState(VariableValue.EDITED); } else { setState(VariableValue.UNKNOWN); } } else { setState(cvLow.getState()); } } else if (e.getPropertyName().equals("Value")) { // update value of Variable CvValue cv0 = _cvMap.get(getCvName()); CvValue cv1 = _cvMap.get(mSecondCVname); if (log.isDebugEnabled()) { log.debug(" found cv0=" + cv0 + " cv1=" + cv1); } int newVal = ((cv0.getValue() & lowerbitmask) >> lowerbitoffset) + (((cv1.getValue() & upperbitmask) * 256) >> upperbitoffset); if (log.isDebugEnabled()) { log.debug( "CV " + getCvName() + "," + getSecondCvNum() + " set value to " + newVal + " based on cv0=" + cv0.getValue() + " cv1=" + cv1.getValue()); } setValue(newVal); // check for duplicate done inside setVal if (log.isDebugEnabled()) { log.debug( "CV " + getCvName() + "," + getSecondCvNum() + " in property change after setValue call, cv0=" + cv0.getValue() + " cv1=" + cv1.getValue()); } // state change due to CV state change, so propagate that if (cv1.getState() == VariableValue.UNKNOWN) { if (cv0.getState() == VariableValue.EDITED) { setState(VariableValue.EDITED); } else { setState(VariableValue.UNKNOWN); } } else { setState(cv0.getState()); } } }
public void setToolTipText(String t) { super.setToolTipText(t); // do default stuff _value.setToolTipText(t); // set our value }
void checkReadOnlyValue(VariableValue var, String comment, String val) { Assert.assertEquals(comment, val, var.getCommonRep().toString()); }
void setValue(VariableValue var, String val) { ((JTextField) var.getCommonRep()).setText(val); ((JTextField) var.getCommonRep()).postActionEvent(); }
@Override public Collection<LineExtensionInfo> getLineExtensions( @NotNull Project project, @NotNull VirtualFile file, int lineNumber) { if (!Registry.is("ide.debugger.inline")) { return null; } final Map<Pair<VirtualFile, Integer>, Set<XValueNodeImpl>> map = project.getUserData(XVariablesView.DEBUG_VARIABLES); final Map<VirtualFile, Long> timestamps = project.getUserData(XVariablesView.DEBUG_VARIABLES_TIMESTAMPS); final Document doc = FileDocumentManager.getInstance().getDocument(file); if (map == null || timestamps == null || doc == null) { return null; } Map<Variable, VariableValue> oldValues = project.getUserData(CACHE); if (oldValues == null) { oldValues = new HashMap<Variable, VariableValue>(); project.putUserData(CACHE, oldValues); } final Long timestamp = timestamps.get(file); if (timestamp == null || timestamp < doc.getModificationStamp()) { return null; } Set<XValueNodeImpl> values = map.get(Pair.create(file, lineNumber)); if (values != null && !values.isEmpty()) { ArrayList<LineExtensionInfo> result = new ArrayList<LineExtensionInfo>(); for (XValueNodeImpl value : values) { SimpleColoredText text = new SimpleColoredText(); XValueTextRendererImpl renderer = new XValueTextRendererImpl(text); final XValuePresentation presentation = value.getValuePresentation(); if (presentation == null) continue; try { if (presentation instanceof XValueCompactPresentation) { ((XValueCompactPresentation) presentation).renderValue(renderer, value); } else { presentation.renderValue(renderer); } } catch (Exception e) { continue; } final Color color = getForeground(); final String name = value.getName(); result.add(new LineExtensionInfo(" " + name + ": ", color, null, null, Font.PLAIN)); Variable var = new Variable(name, lineNumber); VariableValue variableValue = oldValues.get(var); if (variableValue == null) { variableValue = new VariableValue(text.toString(), null, value.hashCode()); oldValues.put(var, variableValue); } if (variableValue.valueNodeHashCode != value.hashCode()) { variableValue.old = variableValue.actual; variableValue.actual = text.toString(); variableValue.valueNodeHashCode = value.hashCode(); } if (!variableValue.isChanged()) { for (String s : text.getTexts()) { result.add(new LineExtensionInfo(s, color, null, null, Font.PLAIN)); } } else { variableValue.produceChangedParts(result); } } return result; } return null; }