当前位置: 首页>>代码示例>>Java>>正文


Java FatalException类代码示例

本文整理汇总了Java中edu.uci.ics.jung.exceptions.FatalException的典型用法代码示例。如果您正苦于以下问题:Java FatalException类的具体用法?Java FatalException怎么用?Java FatalException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FatalException类属于edu.uci.ics.jung.exceptions包,在下文中一共展示了FatalException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testGraphMLWriter_fail_on_load_colour

import edu.uci.ics.jung.exceptions.FatalException; //导入依赖的package包/类
@Test
public final void testGraphMLWriter_fail_on_load_colour() throws IOException
{
	LearnerGraph gr = buildLearnerGraph(TestStateMerging.largeGraph1_invalid5, "testMerge_fail1",config,converter);
	StringWriter writer = new StringWriter();gr.storage.writeGraphML(writer);
	synchronized (AbstractLearnerGraph.syncObj) 
	{// ensure that the calls to Jung's vertex-creation routines do not occur on different threads.
    	
    	try
    	{
    		loadLearnerGraph(new StringReader(writer.toString().replace("COLOUR=\"red\"", "COLOUR=\"aa\"")));
    	}
    	catch(FatalException ex)
    	{
    		Assert.assertTrue(ex.getCause() instanceof IllegalUserDataException);
    	}
	}		
}
 
开发者ID:kirilluk,项目名称:statechum,代码行数:19,代码来源:TestTransform.java

示例2: testGraphMLWriter_fail_on_load_depth

import edu.uci.ics.jung.exceptions.FatalException; //导入依赖的package包/类
@Test
public final void testGraphMLWriter_fail_on_load_depth() throws IOException
{
	LearnerGraph gr = buildLearnerGraph(TestStateMerging.largeGraph1_invalid5, "testMerge_fail1",config,converter);
	StringWriter writer = new StringWriter();gr.storage.writeGraphML(writer);
	synchronized (AbstractLearnerGraph.syncObj) 
	{// ensure that the calls to Jung's vertex-creation routines do not occur on different threads.
    	
    	try
    	{
    		loadLearnerGraph(new StringReader(writer.toString().replace("COLOUR=\"red\"", "DEPTH=\"aa\"")));
    	}
    	catch(FatalException ex)
    	{
    		Assert.assertTrue(ex.getCause() instanceof IllegalUserDataException);
    	}
	}		
}
 
开发者ID:kirilluk,项目名称:statechum,代码行数:19,代码来源:TestTransform.java

示例3: importUserData

import edu.uci.ics.jung.exceptions.FatalException; //导入依赖的package包/类
/**
 * Uses the CopyAction to determine how each of the user datum elements in
 * udc should be carried over to the this UserDataContiner
 * 
 * @param udc
 *            The UserDataContainer whose user data is being imported
 */
public void importUserData(UserDataContainer udc) {
    for (Iterator keyIt = udc.getUserDatumKeyIterator(); keyIt.hasNext();) {
        Object key = keyIt.next();
        Object value = udc.getUserDatum(key);
        CopyAction action = udc.getUserDatumCopyAction(key);
        Object newValue = action.onCopy(value, udc, this);
        try {
            if (newValue != null) addUserDatum(key, newValue, action);

        } catch (IllegalArgumentException iae) {
            List userDataKeys = IteratorUtils.toList(udc
                    .getUserDatumKeyIterator());
            throw new FatalException("Copying <" + key + "> of "
                    + userDataKeys
                    + " into a container that started with some keys ",
                    iae);
        }
    }

}
 
开发者ID:markus1978,项目名称:clickwatch,代码行数:28,代码来源:DefaultUserData.java

示例4: onCopy

import edu.uci.ics.jung.exceptions.FatalException; //导入依赖的package包/类
public Object onCopy(Object value, UserDataContainer source, UserDataContainer target) {

				try {
					if (! (value instanceof Cloneable)) {
						throw new CloneNotSupportedException("Not cloneable interface: This used to just return a shared reference.");
					}

					Method cloneMethod =
						value.getClass().getMethod("clone", null);

					if (cloneMethod != null) {
						return cloneMethod.invoke(value, null);
					} else {
						throw new CloneNotSupportedException("No clone method implemented: This used to just return a shared reference.");
					}

				} catch (Exception e) {
					throw new FatalException("Cloning failure", e);
				}

			}
 
开发者ID:markus1978,项目名称:clickwatch,代码行数:22,代码来源:UserDataContainer.java

示例5: createCollapsedVertex

import edu.uci.ics.jung.exceptions.FatalException; //导入依赖的package包/类
/**
 *  
 * It must be the case that all members of rootSet are in the same partition.
 * @see edu.uci.ics.jung.graph.algorithms.blockmodel.GraphCollapser#getCollapsedVertex(edu.uci.ics.jung.graph.Graph, java.util.Set)
 */
protected CollapsedVertex createCollapsedVertex(Graph g, Set rootSet) {
	BipartiteGraph.Choice choice = null;
	BipartiteGraph bpg = (BipartiteGraph) g;
	for (Iterator iter = rootSet.iterator(); iter.hasNext();) {
		BipartiteVertex v = (BipartiteVertex) iter.next();
		if (choice == null) {
			choice = bpg.getPartition(v);
		} else {
			if (choice != bpg.getPartition(v)) {
				throw new FatalException("All vertices must be in the same partition");
			}
		}
	}

	CollapsedBipartiteVertex cbv = new CollapsedBipartiteVertex(rootSet);
	bpg.addVertex(cbv, choice);
	return cbv;
}
 
开发者ID:markus1978,项目名称:clickwatch,代码行数:24,代码来源:BipartiteGraphCollapser.java

示例6: setLabel

import edu.uci.ics.jung.exceptions.FatalException; //导入依赖的package包/类
/**
 * Associates a Vertex with a Label, overrwriting any previous labels on
 * this vertex.
 * 
 * @param v
 *            a Vertex in the labeller's graph
 * @param l
 *            a Label to be associated with this vertex
 * @throws FatalException
 *             thrown if this vertex isn't in the Labeller's graph
 * @throws UniqueLabelException
 *             thrown if this label is already associated with some other
 *             vertex.
 */
public void setLabel(Vertex v, String l) throws UniqueLabelException {

	if (v.getGraph() == graph) {
		if (labelToVertex.containsKey(l)) {
			// we already have a vertex with this label
			throw new UniqueLabelException(l + " is already on vertex "
					+ labelToVertex.get(l));
		}
		// ok, we know we don't have this label anywhere yet
		if (vertexToLabel.containsKey(v)) {
			Object junk = vertexToLabel.get(v);
			labelToVertex.remove(junk);
		}
		vertexToLabel.put(v, l);
		labelToVertex.put(l, v);
	} else {
		// throw some sort of exception here
		throw new FatalException("This vertex is not a part of this graph");
	}

}
 
开发者ID:markus1978,项目名称:clickwatch,代码行数:36,代码来源:StringLabeller.java

示例7: getIndexer

import edu.uci.ics.jung.exceptions.FatalException; //导入依赖的package包/类
private static Indexer getIndexer(
	ArchetypeGraph g,
	Object key,
	boolean reIndex,
	boolean recreate,
	int offset) {
	Indexer id = (Indexer) g.getUserDatum(key);
	if (!recreate && id != null) {
		if (id.numNodes != g.getVertices().size()) {
			if (reIndex == false) {
				throw new FatalException("Graph changed since last index update");
			} else {
				id = null;
			}
		} else {
			return id;
		}
	}
	id = new Indexer(g);
	id.updateIndex(offset);
	g.setUserDatum(key, id, UserData.REMOVE);
	return id;
}
 
开发者ID:markus1978,项目名称:clickwatch,代码行数:24,代码来源:Indexer.java

示例8: removeNeighbor_internal

import edu.uci.ics.jung.exceptions.FatalException; //导入依赖的package包/类
/**
 * @see AbstractSparseVertex#removeNeighbor_internal(Edge, Vertex)
 */
protected void removeNeighbor_internal(Edge e, Vertex v)
{
    String error = "Internal error: " + 
        "edge " + e + " not incident to vertex ";
    if (getSuccsToOutEdges().containsKey(v) && v.isDest(e))
    { // e is an outgoing edge of this vertex -> v is a successor
        if (getSuccsToOutEdges().remove(v) == null)
            throw new FatalException(error + v);
    }
    else if (getPredsToInEdges().containsKey(v) && v.isSource(e))
    { // e is an incoming edge of this vertex -> v is a predecessor
        if (getPredsToInEdges().remove(v) == null)
            throw new FatalException(error + v);
    }
    else
        throw new FatalException(error + this);
}
 
开发者ID:markus1978,项目名称:clickwatch,代码行数:21,代码来源:SimpleDirectedSparseVertex.java

示例9: newInstance

import edu.uci.ics.jung.exceptions.FatalException; //导入依赖的package包/类
/**
     * Creates a new empty graph of the same type as this graph, by cloning this
     * graph and then clearing the extraneous fields.
     * 
     * @see edu.uci.ics.jung.graph.ArchetypeGraph#newInstance()
     */
    public ArchetypeGraph newInstance() {
        try {
            AbstractArchetypeGraph aag = (AbstractArchetypeGraph) this.clone();
            aag.initialize();
//            addAllCopyable(aag.system_edge_requirements, system_edge_requirements);
//            addAllCopyable(aag.system_vertex_requirements, system_vertex_requirements);
//            addAllCopyable(aag.user_edge_requirements, user_edge_requirements);
//            addAllCopyable(aag.user_vertex_requirements, user_vertex_requirements);
//            aag.user_edge_requirements.addAll(getEdgeConstraints());
//            aag.user_vertex_requirements.addAll(getVertexConstraints());
            addAllNotInitializers(aag.getEdgeConstraints(),
                    getEdgeConstraints());
            addAllNotInitializers(aag.getVertexConstraints(),
                    getVertexConstraints());
            return aag;
        } catch (CloneNotSupportedException e) {
            throw new FatalException("Failed attempt to clone graph", e);
        }
    }
 
开发者ID:markus1978,项目名称:clickwatch,代码行数:26,代码来源:AbstractArchetypeGraph.java

示例10: copy

import edu.uci.ics.jung.exceptions.FatalException; //导入依赖的package包/类
/**
 * Specialized copy function for copy FROM BipartiteGraph TO BipartiteGraph
 */
public ArchetypeVertex copy(ArchetypeGraph newGraph) {
	if (!(newGraph instanceof BipartiteGraph
		&& this.getGraph() instanceof BipartiteGraph)) {
		return super.copy(newGraph);
	}
	BipartiteGraph bpg = (BipartiteGraph) newGraph;

	if (newGraph == this.getGraph())
		throw new IllegalArgumentException(
			"Source and destination graphs " + "must be different");

	try {
		BipartiteVertex v = (BipartiteVertex) clone();
		v.initialize();
		v.importUserData(this);
		BipartiteGraph thisGraph = (BipartiteGraph) this.getGraph();
		bpg.addVertex(v, thisGraph.getPartition(this));
		return v;
	} catch (CloneNotSupportedException cne) {
		throw new FatalException("Can't copy vertex ", cne);
	}
}
 
开发者ID:markus1978,项目名称:clickwatch,代码行数:26,代码来源:BipartiteVertex.java

示例11: copy

import edu.uci.ics.jung.exceptions.FatalException; //导入依赖的package包/类
/**
 * @see edu.uci.ics.jung.graph.ArchetypeVertex#copy(edu.uci.ics.jung.graph.ArchetypeGraph)
 */
public ArchetypeVertex copy(ArchetypeGraph g)
{
    if (g == this.getGraph())
        throw new IllegalArgumentException("Source and destination graphs "
                + "must be different");

    try
    {
        AbstractArchetypeVertex v = (AbstractArchetypeVertex) clone();
        v.initialize();
        v.importUserData(this);
        return v;
    }
    catch (CloneNotSupportedException cne)
    {
        throw new FatalException("Failure in cloning " + this, cne);
    }
}
 
开发者ID:markus1978,项目名称:clickwatch,代码行数:22,代码来源:AbstractArchetypeVertex.java

示例12: removeNeighbor_internal

import edu.uci.ics.jung.exceptions.FatalException; //导入依赖的package包/类
/**
 * @see AbstractSparseVertex#removeNeighbor_internal(Edge, Vertex)
 */
protected void removeNeighbor_internal(Edge e, Vertex v)
{
    // if v doesn't point to e, and it's not a self-loop
    // that's been removed in a previous call to removeNeighbor...
    Map nte = getNeighborsToEdges();
    Set edges = (Set)nte.get(v);
    if (edges != null)
    {
        boolean removed = edges.remove(e);
        if (edges.isEmpty())
            nte.remove(v);
        if (!removed && this != v)
            throw new FatalException("Internal error in data structure" +
                "for vertex " + this);
    }
    else if (this != v)
        throw new FatalException("Internal error in data structure" +
            "for vertex " + this);

    // if it *is* a self-loop, we're already done
}
 
开发者ID:markus1978,项目名称:clickwatch,代码行数:25,代码来源:UndirectedSparseVertex.java

示例13: removeNeighbor_internal

import edu.uci.ics.jung.exceptions.FatalException; //导入依赖的package包/类
/**
 * Removes the neighbor from this vertex's internal map.
 * 
 * @see AbstractSparseVertex#removeNeighbor_internal(Edge, Vertex)
 */
protected void removeNeighbor_internal(Edge connectingEdge, Vertex neighbor)
{
    // does connectingEdge connect us to neighbor?
    if (connectingEdge == getNeighborsToEdges().get(neighbor))
    {
        getNeighborsToEdges().remove(neighbor);
    }
    else
    {
        // self-loop; already removed this node 
        // in a previous call to removeNeighbor_internal()
        if (this == neighbor)
            return;

        throw new FatalException("Internal error: " + "edge "
                + connectingEdge + " not incident to vertex " + neighbor);
    }
}
 
开发者ID:markus1978,项目名称:clickwatch,代码行数:24,代码来源:SimpleUndirectedSparseVertex.java

示例14: filter

import edu.uci.ics.jung.exceptions.FatalException; //导入依赖的package包/类
/**
 * Returns an <tt>UnassembledGraph</tt> with the subset
 * of edges that pass <tt>acceptEdge</tt>. This method
 * is used only if this class implements <tt>EfficientFilter</tt>,
 * and, in fact, it contains a runtime check to ensure that the
 * subclass has been labelled correctly.
 * @param ug	An <tt>UnassembledGraph</tt> containing a subset of
 * vertices and edges from an original graph.
 * @return	An UnassembledGraph containing the subset of <tt>ug</tt>
 * that pass the filter.
 * 
 * @see EfficientFilter#filter(UnassembledGraph)
 */
public UnassembledGraph filter(UnassembledGraph ug) {

	if (! (this instanceof EfficientFilter)) 
		throw new FatalException("Do not call non-efficient filters with UnassembledGraphs.");

	Set vertices = null;
	Set edges = null;

	vertices = ug.getUntouchedVertices();
	edges = ug.getUntouchedEdges();
	if (vertices == null) {
		vertices = ug.getOriginalGraph().getVertices();
	}
	if (edges == null) {
		edges = ug.getOriginalGraph().getEdges();
	}
	Set newEdges = chooseGoodEdges( edges );
	return new UnassembledGraph(this, vertices, newEdges, ug);
}
 
开发者ID:markus1978,项目名称:clickwatch,代码行数:33,代码来源:GeneralEdgeAcceptFilter.java

示例15: attachLabel

import edu.uci.ics.jung.exceptions.FatalException; //导入依赖的package包/类
/**
     * Labels <code>v</code> with <code>string</code>, according to the 
     * labeling mechanism specified by <code>unique_labels</code>.
     * Removes quotation marks from the string if present.
     */
    private void attachLabel(Vertex v, String string) throws IOException
    {
        if (string == null || string.length() == 0)
            return;
        String label = string.trim();
//        String label = trimQuotes(string).trim();
//        if (label.length() == 0)
//            return;
        if (unique_labels)
        {
            try
            {
                StringLabeller sl = StringLabeller.getLabeller((Graph)v.getGraph(), LABEL);
                sl.setLabel(v, label);
            }
            catch (StringLabeller.UniqueLabelException slule)
            {
                throw new FatalException("Non-unique label found: " + slule);
            }
        }
        else
        {
            v.addUserDatum(LABEL, label, UserData.SHARED);
        }
    }
 
开发者ID:markus1978,项目名称:clickwatch,代码行数:31,代码来源:PajekNetReader.java


注:本文中的edu.uci.ics.jung.exceptions.FatalException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。