From e11bce7ad3e803e80883499fec0ad6e4540ffe43 Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Tue, 30 Jun 2020 18:03:48 +0200 Subject: Add modified VIATRA-DSE version --- .../viatra/dse/statecoding/StatecodingNode.java | 100 +++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 Solvers/VIATRA-Solver/org.eclipse.viatra.dse/src/org/eclipse/viatra/dse/statecoding/StatecodingNode.java (limited to 'Solvers/VIATRA-Solver/org.eclipse.viatra.dse/src/org/eclipse/viatra/dse/statecoding/StatecodingNode.java') diff --git a/Solvers/VIATRA-Solver/org.eclipse.viatra.dse/src/org/eclipse/viatra/dse/statecoding/StatecodingNode.java b/Solvers/VIATRA-Solver/org.eclipse.viatra.dse/src/org/eclipse/viatra/dse/statecoding/StatecodingNode.java new file mode 100644 index 00000000..91fc28cf --- /dev/null +++ b/Solvers/VIATRA-Solver/org.eclipse.viatra.dse/src/org/eclipse/viatra/dse/statecoding/StatecodingNode.java @@ -0,0 +1,100 @@ +/******************************************************************************* + * Copyright (c) 2010-2015, Andras Szabolcs Nagy and Daniel Varro + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-v20.html. + * + * SPDX-License-Identifier: EPL-2.0 + *******************************************************************************/ +package org.eclipse.viatra.dse.statecoding; + +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; +import java.util.Set; +import java.util.TreeSet; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EReference; + +public class StatecodingNode { + + private StatecodingDependencyGraph graph; + + private final EClass clazz; + private Set attributes = new TreeSet(Comparator.comparing(EAttribute::getName)); + private List dependencies = new ArrayList(); + private boolean stateCodeIsId = false; + private StatecodingNodeType statecodingNodeType = StatecodingNodeType.CREATE_AND_DELETE; + + public StatecodingNode(EClass clazz) { + this.clazz = clazz; + } + + public StatecodingNode withAttribute(EAttribute attribute) { + attributes.add(attribute); + return this; + } + + public StatecodingNode withType(StatecodingNodeType type) { + statecodingNodeType = type; + return this; + } + + public StatecodingNode withUniqueness() { + stateCodeIsId = true; + return this; + } + + public StatecodingNode withDependency(EReference reference, StatecodingNode node) { + dependencies.add(new StatecodingDependency(reference, node)); + return this; + } + + public StatecodingNode withInverseDependency(EReference reference, StatecodingNode node) { + dependencies.add(new StatecodingDependency(reference, node, false, StatecodingDependencyType.INVERSE)); + return this; + } + + public void addDependency(StatecodingDependency statecodingDependency) { + dependencies.add(statecodingDependency); + } + + public EClass getClazz() { + return clazz; + } + + public boolean isStateCodeIsId() { + return stateCodeIsId; + } + + public void setStateCodeIsId(boolean stateCodeIsId) { + this.stateCodeIsId = stateCodeIsId; + } + + public StatecodingNodeType getStatecodingNodeType() { + return statecodingNodeType; + } + + public void setStatecodingNodeType(StatecodingNodeType statecodingNodeType) { + this.statecodingNodeType = statecodingNodeType; + } + + public Set getAttributes() { + return attributes; + } + + public List getStatecodingDependencies() { + return dependencies; + } + + public StatecodingDependencyGraph getGraph() { + return graph; + } + + public void setGraph(StatecodingDependencyGraph graph) { + this.graph = graph; + } + +} -- cgit v1.2.3-54-g00ecf