mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-27 17:42:33 -06:00
72 lines
3.1 KiB
Java
72 lines
3.1 KiB
Java
package com.google.common.graph;
|
|
|
|
import com.google.common.base.Optional;
|
|
import com.google.common.base.Preconditions;
|
|
import com.google.common.graph.ElementOrder;
|
|
import com.google.common.graph.ImmutableValueGraph;
|
|
|
|
@ElementTypesAreNonnullByDefault
|
|
/* loaded from: classes3.dex */
|
|
public final class ValueGraphBuilder<N, V> extends AbstractGraphBuilder<N> {
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
private <N1 extends N, V1 extends V> ValueGraphBuilder<N1, V1> cast() {
|
|
return this;
|
|
}
|
|
|
|
private ValueGraphBuilder(boolean z) {
|
|
super(z);
|
|
}
|
|
|
|
public static ValueGraphBuilder<Object, Object> directed() {
|
|
return new ValueGraphBuilder<>(true);
|
|
}
|
|
|
|
public static ValueGraphBuilder<Object, Object> undirected() {
|
|
return new ValueGraphBuilder<>(false);
|
|
}
|
|
|
|
public static <N, V> ValueGraphBuilder<N, V> from(ValueGraph<N, V> valueGraph) {
|
|
return new ValueGraphBuilder(valueGraph.isDirected()).allowsSelfLoops(valueGraph.allowsSelfLoops()).nodeOrder(valueGraph.nodeOrder()).incidentEdgeOrder(valueGraph.incidentEdgeOrder());
|
|
}
|
|
|
|
public <N1 extends N, V1 extends V> ImmutableValueGraph.Builder<N1, V1> immutable() {
|
|
return new ImmutableValueGraph.Builder<>(cast());
|
|
}
|
|
|
|
public ValueGraphBuilder<N, V> allowsSelfLoops(boolean z) {
|
|
this.allowsSelfLoops = z;
|
|
return this;
|
|
}
|
|
|
|
public ValueGraphBuilder<N, V> expectedNodeCount(int i) {
|
|
this.expectedNodeCount = Optional.of(Integer.valueOf(Graphs.checkNonNegative(i)));
|
|
return this;
|
|
}
|
|
|
|
public <N1 extends N> ValueGraphBuilder<N1, V> nodeOrder(ElementOrder<N1> elementOrder) {
|
|
ValueGraphBuilder<N1, V> valueGraphBuilder = (ValueGraphBuilder<N1, V>) cast();
|
|
valueGraphBuilder.nodeOrder = (ElementOrder) Preconditions.checkNotNull(elementOrder);
|
|
return valueGraphBuilder;
|
|
}
|
|
|
|
public <N1 extends N> ValueGraphBuilder<N1, V> incidentEdgeOrder(ElementOrder<N1> elementOrder) {
|
|
Preconditions.checkArgument(elementOrder.type() == ElementOrder.Type.UNORDERED || elementOrder.type() == ElementOrder.Type.STABLE, "The given elementOrder (%s) is unsupported. incidentEdgeOrder() only supports ElementOrder.unordered() and ElementOrder.stable().", elementOrder);
|
|
ValueGraphBuilder<N1, V> valueGraphBuilder = (ValueGraphBuilder<N1, V>) cast();
|
|
valueGraphBuilder.incidentEdgeOrder = (ElementOrder) Preconditions.checkNotNull(elementOrder);
|
|
return valueGraphBuilder;
|
|
}
|
|
|
|
public <N1 extends N, V1 extends V> MutableValueGraph<N1, V1> build() {
|
|
return new StandardMutableValueGraph(this);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public ValueGraphBuilder<N, V> copy() {
|
|
ValueGraphBuilder<N, V> valueGraphBuilder = new ValueGraphBuilder<>(this.directed);
|
|
valueGraphBuilder.allowsSelfLoops = this.allowsSelfLoops;
|
|
valueGraphBuilder.nodeOrder = this.nodeOrder;
|
|
valueGraphBuilder.expectedNodeCount = this.expectedNodeCount;
|
|
valueGraphBuilder.incidentEdgeOrder = this.incidentEdgeOrder;
|
|
return valueGraphBuilder;
|
|
}
|
|
}
|