Selects an example. If there is an error instantiating the component, an error message will be displayed.

@param example the ExampleData of the example to select.
2889
public void selectExample(final ExampleData example) {
		try {
			StringBuilder exampleName = new StringBuilder();
			if (example.getExampleGroupName() != null && !example.getExampleGroupName().equals("")) {
				exampleName.append(example.getExampleGroupName()).append(" - ");
			}
			exampleName.append(example.getExampleName());
			selectExample(example.getExampleClass().newInstance(), exampleName.toString());
		} catch (Exception e) {
			WMessages.getInstance(this).error("Error selecting example \"" + example.
					getExampleName() + '"');
			selectExample(new ErrorComponent(e.getMessage(), e), "Error");
		}
	}
964969
public static void error(Object... message) {
        StringBuilder builder = new StringBuilder(APP_ERROR);
        for (Object object : message) {
            builder.append(object.toString());
        }
        errorStream.println(builder.toString());
    }
595981
def _has_example(self, label):
        """"""
        if label in self._raw_examples:
            return True
        else:
            for field in self.all_fields:
                dt, _ = unwrap_nullable(field.data_type)
                if not is_user_defined_type(dt) and not is_void_type(dt):
                    continue
                if label == field.name:
                    return True
            else:
                return False
659995
public void displaySelection(final String selection) {
		WComponent selectedComponent = UIRegistry.getInstance().getUI(selection);

		if (selectedComponent == null) {
			// Can't load selected component.
			WMessages.getInstance(this).error(
					"Unable to load example: " + selection + ", see log for details.");
			return;
		}

		displaySelection(selectedComponent);
	}
988324
@Override
    public void validate(String name, String value) throws ParameterException {
        if(!value.equals(ArbiterCliGenerator.REGRESSION) || value.equals(ArbiterCliGenerator.CLASSIFICIATION)) {
            throw new ParameterException("Problem type can only be " + ArbiterCliGenerator.REGRESSION + " or " + ArbiterCliGenerator.CLASSIFICIATION);

        }
    }
965478
@Override
	public <S extends T> Optional<S> findOne(final Example<S> example) {
		final ArangoCursor cursor = findAllInternal((Pageable) null, example, new HashMap());
		return cursor.hasNext() ? Optional.ofNullable((S) cursor.next()) : Optional.empty();
	}
1326587
function ValidationError (instance) {
  NeopreneError.call(this, "Validation failed");
  Error.captureStackTrace(this, arguments.callee);
  this.name = 'ValidationError';
  this.errors = instance.errors = {};
}
1103258
@Override
    public void setOutcome(int example, int label) {
        if (example > numExamples())
            throw new IllegalArgumentException("No example at " + example);
        if (label > numOutcomes() || label < 0)
            throw new IllegalArgumentException("Illegal label");

        INDArray outcome = FeatureUtil.toOutcomeVector(label, numOutcomes());
        getLabels().putRow(example, outcome);
    }
461841
public boolean displayError(Exception ex, Component panel)
    {
        if (panel != null)
        {   // Always
            BaseApplet baseApplet = null;
            if (panel instanceof BaseApplet)
                baseApplet = (BaseApplet)panel;
            else
            {
                while ((panel = panel.getParent()) != null)
                {
                    if (panel instanceof org.jbundle.thin.base.screen.JBasePanel)
                    {
                        baseApplet = ((org.jbundle.thin.base.screen.JBasePanel)panel).getBaseApplet();
                        break;
                    }
                }
            }
            if (baseApplet != null)
            {
                //baseApplet.setLastError(ex.getMessage());
                baseApplet.setStatusText(ex.getMessage(), Constants.WARNING);
                if (ex instanceof DBException)
                    return true;
            }
        }
        return false;
    }
633807
public function exampleSkipped(Example $example)
    {
        $this->skipped[] = $example;
        $event = new ExampleSkipEvent($example);
        $this->dispatcher->dispatch(Events::EXAMPLE_SKIP, $event);
    }
608664
public final ExampleData getSelectedExampleData() {
		Set<String> allSelectedItems = getSelectedRows();
		if (allSelectedItems == null || allSelectedItems.isEmpty()) {
			return null;
		}
		for (String selectedItem : allSelectedItems) {
			// Only interested in the first selected item as it is a single select list.
			List<Integer> rowIndex = TreeItemUtil.rowIndexStringToList(selectedItem);
			return getTreeModel().getExampleData(rowIndex);
		}
		return null;
	}
641211
def p_example(self, p):
        """"""
        if len(p) > 4:
            seen_fields = set()
            for example_field in p[6]:
                if example_field.name in seen_fields:
                    self.errors.append(
                        ("Example with label '%s' defines field '%s' more "
                        "than once." % (p[2], example_field.name),
                        p.lineno(1), self.path))
                seen_fields.add(example_field.name)
            p[0] = AstExample(
                self.path, p.lineno(1), p.lexpos(1), p[2], p[5],
                OrderedDict((f.name, f) for f in p[6]))
        else:
            p[0] = AstExample(
                self.path, p.lineno(1), p.lexpos(1), p[2], None, OrderedDict())
1339095
@Override
	public InstanceExample nextInstance() {
		InstanceExample prevInstance = this.lastInstanceRead;
		if (prevInstance != null) {
			this.numInstancesRead++;
		}
		try {
			String line;
			do {
				line = this.fileReader.readLine();
				if (line == null) {
					break;
				}
				line = line.trim();
			} while (line.isEmpty() || line.charAt(0) == '%'
					|| line.charAt(0) == '@');

			if (line != null) {
				StringTokenizer token = new StringTokenizer(line,
						splitCharOption.getValue());

				double[] value = new double[this.numAttributes];
				int i;
				for (i = 0; i < this.numTokens && token.hasMoreTokens(); i++) {
					value[i] = Double.valueOf(token.nextToken());
				}
				if (i < this.numTokens || token.hasMoreTokens()) {
					throw new RuntimeException(
							"Next Instance has an wrong cardinality!");
				}
				this.lastInstanceRead = new InstanceExample(new DenseInstance(1, value));
				this.lastInstanceRead.getData().setDataset(this.dataset);
				this.hitEndOfFile = false;
			} else {
				this.lastInstanceRead = null;
				this.hitEndOfFile = true;
			}
		} catch (IOException ioe) {
			throw new RuntimeException("Read next Instance failed.", ioe);
		}
		return prevInstance;
	}
1071238
def example_pending(example)
      if example_group.metadata[:feature] && example.metadata[:skipped]
        @skipped_examples << pending_examples.delete(example)
        @skipped_count += 1
        output.puts cyan("#{current_indentation}#{example.description}")
      else
        super
      end
    end
788560
@Override
    public void selectionChanged(IAction action, ISelection selection) {

        bugInstance = null;
        // TODO learn to deal with ALL elements
        IMarker markerFromSelection = MarkerUtil.getMarkerFromSingleSelection(selection);
        marker = markerFromSelection;

        if (marker == null) {
            // No marker selected.
            return;
        }
        if (DEBUG) {
            System.out.println("Found a marker!");
        }

        bugInstance = MarkerUtil.findBugInstanceForMarker(marker);
        if (bugInstance != null) {
            if (DEBUG) {
                System.out.println("Found BugInstance for SpotBugs warning marker!");
            }
        }
    }
1177609
public static String getExample(TypeDeclaration type) {
		if (type == null || type.example() == null) {
			return null;
		} else {
			return type.example().value();
		}
	}
1374848
public static boolean updateComponentError(AbstractComponent component, ErrorMessage error) {

        if (component.getComponentError() != error) {
            component.setComponentError(error);
            return true;
        }
        return false;
    }