All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.google.common.graph.MutableValueGraph Maven / Gradle / Ivy

Go to download

This artifact provides a single jar that contains all classes required to use remote EJB and JMS, including all dependencies. It is intended for use by those not using maven, maven users should just import the EJB and JMS BOM's instead (shaded JAR's cause lots of problems with maven, as it is very easy to inadvertently end up with different versions on classes on the class path).

There is a newer version: 34.0.0.Final
Show newest version
/*
 * Copyright (C) 2016 The Guava Authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.common.graph;

import com.google.common.annotations.Beta;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import javax.annotation.CheckForNull;

/**
 * A subinterface of {@link ValueGraph} which adds mutation methods. When mutation is not required,
 * users should prefer the {@link ValueGraph} interface.
 *
 * @author James Sexton
 * @param  Node parameter type
 * @param  Value parameter type
 * @since 20.0
 */
@Beta
@ElementTypesAreNonnullByDefault
public interface MutableValueGraph extends ValueGraph {

  /**
   * Adds {@code node} if it is not already present.
   *
   * 

Nodes must be unique, just as {@code Map} keys must be. They must also be non-null. * * @return {@code true} if the graph was modified as a result of this call */ @CanIgnoreReturnValue boolean addNode(N node); /** * Adds an edge connecting {@code nodeU} to {@code nodeV} if one is not already present, and sets * a value for that edge to {@code value} (overwriting the existing value, if any). * *

If the graph is directed, the resultant edge will be directed; otherwise, it will be * undirected. * *

Values do not have to be unique. However, values must be non-null. * *

If {@code nodeU} and {@code nodeV} are not already present in this graph, this method will * silently {@link #addNode(Object) add} {@code nodeU} and {@code nodeV} to the graph. * * @return the value previously associated with the edge connecting {@code nodeU} to {@code * nodeV}, or null if there was no such edge. * @throws IllegalArgumentException if the introduction of the edge would violate {@link * #allowsSelfLoops()} */ @CanIgnoreReturnValue @CheckForNull V putEdgeValue(N nodeU, N nodeV, V value); /** * Adds an edge connecting {@code endpoints} if one is not already present, and sets a value for * that edge to {@code value} (overwriting the existing value, if any). * *

If the graph is directed, the resultant edge will be directed; otherwise, it will be * undirected. * *

If this graph is directed, {@code endpoints} must be ordered. * *

Values do not have to be unique. However, values must be non-null. * *

If either or both endpoints are not already present in this graph, this method will silently * {@link #addNode(Object) add} each missing endpoint to the graph. * * @return the value previously associated with the edge connecting {@code nodeU} to {@code * nodeV}, or null if there was no such edge. * @throws IllegalArgumentException if the introduction of the edge would violate {@link * #allowsSelfLoops()} * @throws IllegalArgumentException if the endpoints are unordered and the graph is directed * @since 27.1 */ @CanIgnoreReturnValue @CheckForNull V putEdgeValue(EndpointPair endpoints, V value); /** * Removes {@code node} if it is present; all edges incident to {@code node} will also be removed. * * @return {@code true} if the graph was modified as a result of this call */ @CanIgnoreReturnValue boolean removeNode(N node); /** * Removes the edge connecting {@code nodeU} to {@code nodeV}, if it is present. * * @return the value previously associated with the edge connecting {@code nodeU} to {@code * nodeV}, or null if there was no such edge. */ @CanIgnoreReturnValue @CheckForNull V removeEdge(N nodeU, N nodeV); /** * Removes the edge connecting {@code endpoints}, if it is present. * *

If this graph is directed, {@code endpoints} must be ordered. * * @return the value previously associated with the edge connecting {@code endpoints}, or null if * there was no such edge. * @since 27.1 */ @CanIgnoreReturnValue @CheckForNull V removeEdge(EndpointPair endpoints); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy