List of usage examples for java.util NoSuchElementException NoSuchElementException
public NoSuchElementException(String s)
From source file:com.github.helenusdriver.commons.collections.graph.ConcurrentHashDirectedGraph.java
/** * {@inheritDoc}//w w w. j a va2s. c o m * * @author paouelle * * @see com.github.helenusdriver.commons.collections.DirectedGraph#removeEdge(java.lang.Object, java.lang.Object) */ @Override public boolean removeEdge(T start, T dest) { final HashNode sn = graph.get(start); if (sn == null) { throw new NoSuchElementException("unknown starting node"); } return sn.removeEdge(dest); }
From source file:com.github.helenusdriver.commons.collections.graph.ConcurrentHashDirectedGraph.java
/** * {@inheritDoc}//w w w . j a v a2 s . co m * * @author paouelle * * @see com.github.helenusdriver.commons.collections.DirectedGraph#edgeExists(java.lang.Object, java.lang.Object) */ @Override public boolean edgeExists(T start, T dest) { final HashNode sn = graph.get(start); if (sn == null) { throw new NoSuchElementException("unknown starting node"); } return sn.edgeExists(dest); }
From source file:de.uniba.wiai.kinf.pw.projects.lillytab.reasoner.tbox.AssertedRBox.java
@Override public Set<R> getInverseRoles(R role) { final Set<R> invRoles = (Set<R>) _inverseRoles.get(role); if (invRoles == null) { throw new NoSuchElementException("Unknown role: " + role); } else {// ww w . j a v a 2 s .co m return Collections.unmodifiableSet(invRoles); } }
From source file:com.github.helenusdriver.commons.collections.graph.ConcurrentHashDirectedGraph.java
/** * {@inheritDoc}//from w w w . jav a 2 s . c om * * @author paouelle * * @see com.github.helenusdriver.commons.collections.DirectedGraph#edgesFrom(java.lang.Object) */ @Override public Stream<T> edgesFrom(T node) { final HashNode n = graph.get(node); if (n == null) { throw new NoSuchElementException("unknown node"); } return n.edges().map(e -> e.getValue()); }
From source file:de.uniba.wiai.kinf.pw.projects.lillytab.reasoner.tbox.AssertedRBox.java
@Override public Set<R> getSuperRoles(R role) { final Set<R> superRoles = (Set<R>) _superRoles.get(role); if (superRoles == null) { throw new NoSuchElementException("Unknown role:" + role); }//from ww w . jav a 2 s .co m assert superRoles != null; return Collections.unmodifiableSet(superRoles); }
From source file:com.github.helenusdriver.commons.collections.graph.ConcurrentHashDirectedGraph.java
/** * {@inheritDoc}//from ww w . j a v a 2 s . c o m * * @author paouelle * * @see com.github.helenusdriver.commons.collections.DirectedGraph#getEdgesFrom(java.lang.Object) */ @Override public Set<T> getEdgesFrom(T node) { final HashNode n = graph.get(node); if (n == null) { throw new NoSuchElementException("unknown node"); } return Collections .unmodifiableSet(n.getEdges().stream().map(e -> e.getValue()).collect(Collectors.toSet())); }
From source file:com.shinymayhem.radiopresets.FragmentStations.java
public void editSelected() { if (LOCAL_LOGV) log("Editing selected station", "d"); int position = getSelectedPosition(); if (position == -1) //should never happen {/*from w w w. j a va 2 s . com*/ throw new NoSuchElementException("Selected element not found."); } edit(position); }
From source file:de.uniba.wiai.kinf.pw.projects.lillytab.reasoner.tbox.AssertedRBox.java
@Override public Set<R> getSubRoles(R role) { final Set<R> subRoles = (Set<R>) _subRoles.get(role); if (subRoles == null) { throw new NoSuchElementException("Unknown role:" + role); }//from w w w . j a va 2 s . c o m assert subRoles != null; return Collections.unmodifiableSet(subRoles); }
From source file:com.moilioncircle.redis.replicator.rdb.DefaultRdbVisitor.java
@Override public Event applyModule(RedisInputStream in, DB db, int version) throws IOException { //|6|6|6|6|6|6|6|6|6|10| BaseRdbParser parser = new BaseRdbParser(in); KeyStringValueModule o6 = new KeyStringValueModule(); String key = parser.rdbLoadEncodedStringObject().string; char[] c = new char[9]; long moduleid = parser.rdbLoadLen().len; for (int i = 0; i < c.length; i++) { c[i] = MODULE_SET[(int) (moduleid >>> (10 + (c.length - 1 - i) * 6) & 63)]; }/*from w ww . j av a 2 s .c om*/ String moduleName = new String(c); int moduleVersion = (int) (moduleid & 1023); ModuleParser<? extends Module> moduleParser = lookupModuleParser(moduleName, moduleVersion); if (moduleParser == null) throw new NoSuchElementException("module[" + moduleName + "," + moduleVersion + "] not exist."); o6.setValueRdbType(RDB_TYPE_MODULE); o6.setValue(moduleParser.parse(in)); o6.setDb(db); o6.setKey(key); return o6; }
From source file:de.fosd.jdime.matcher.cost_model.CostModelMatcher.java
/** * Finds the (first) <code>CMMatching</code> in <code>matchings</code> containing the given * <code>artifact</code>.//from w w w . java 2s . c o m * * @param artifact * the <code>Artifact</code> for which the containing <code>CMMatching</code> is to be returned * @param matchings * the current matchings * @param parameters * the <code>CMParameters</code> to use * @return the <code>CMMatching</code> containing the <code>artifact</code> * @throws NoSuchElementException * if no <code>CMMatching</code> containing <code>artifact</code> can be found in * <code>matchings</code> */ private CMMatching<T> matching(T artifact, CMMatchings<T> matchings, CMParameters<T> parameters) { return parameters.exactContainsCache.computeIfAbsent(artifact, a -> matchings.stream().filter(m -> m.contains(a)).findFirst().orElseThrow( () -> new NoSuchElementException("No matching containing " + artifact + " found."))); }