![JAR search and dependency download from the Maven repository](/logo.png)
org.ggp.base.util.assignments.MultipleAssignmentStrategy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of alloy-ggp-base Show documentation
Show all versions of alloy-ggp-base Show documentation
A modified version of the GGP-Base library for Alloy.
The newest version!
package org.ggp.base.util.assignments;
import java.util.Collection;
import java.util.List;
import org.ggp.base.util.Immutables;
import org.ggp.base.util.gdl.grammar.GdlConstant;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
public class MultipleAssignmentStrategy implements AssignmentStrategy {
private final ImmutableList definedIndices;
private final ImmutableList> partialAssignments;
public MultipleAssignmentStrategy(ImmutableList definedIndices,
ImmutableList> partialAssignments) {
this.definedIndices = definedIndices;
this.partialAssignments = partialAssignments;
}
public static AssignmentStrategy create(List definedIndices,
Collection> partialAssignments) {
return new MultipleAssignmentStrategy(ImmutableList.copyOf(definedIndices),
partialAssignments.stream()
.map(ImmutableList::copyOf)
.collect(Immutables.collectList()));
}
@Override
public List getDependentIndices() {
return ImmutableList.of();
}
@Override
public List getDefinedIndices() {
return definedIndices;
}
@Override
public List extends List> getPartialAssignments(
List inputs) {
Preconditions.checkArgument(inputs.isEmpty());
return partialAssignments;
}
@Override
public int getRejectedIndex(List inputs) {
//TODO: Huh? Different meaning
//But why is this getting called?
return AssignmentStrategy.NO_INDEX_REJECTED;
}
@Override
public String toString() {
return "MultipleAssignmentStrategy [definedIndices=" + definedIndices
+ ", partialAssignments=" + partialAssignments + "]";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy