aboutsummaryrefslogtreecommitdiffstats
path: root/Solvers/SMT-Solver/hu.bme.mit.inf.dslreasoner.smt.reasoner/src/hu/bme/mit/inf/dslreasoner/smt/reasoner/TypeDescriptor.xtend
blob: 1aa5cf040d668ae4e6d2a9f5a6747f355b7214e9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package hu.bme.mit.inf.dslreasoner.smt.reasoner

import hu.bme.mit.inf.dslreasoner.smtLanguage.SMTBoolTypeReference
import hu.bme.mit.inf.dslreasoner.smtLanguage.SMTComplexTypeReference
import hu.bme.mit.inf.dslreasoner.smtLanguage.SMTIntTypeReference
import hu.bme.mit.inf.dslreasoner.smtLanguage.SMTRealTypeReference
import hu.bme.mit.inf.dslreasoner.smtLanguage.SMTType
import java.util.List
import org.eclipse.xtend.lib.annotations.Accessors
import org.eclipse.xtend.lib.annotations.Data

@Data
class Descriptor<T> {
	List<TypeDescriptor> parameterTypes
	T relation
}

@Data
class TypeDescriptor {
	val boolean logic
	val boolean numeric
	val SMTType complexType
	
	@Accessors(PUBLIC_GETTER)
	static val LogicTypeDescriptor_Instance = new TypeDescriptor(true,false,null)
	@Accessors(PUBLIC_GETTER)
	static val NumericTypeDescriptor_Instance = new TypeDescriptor(false,true,null)
	
	private new(boolean logic, boolean numeric,	SMTType complexType) {
		this.logic = logic
		this.numeric = numeric
		this.complexType = complexType
	}
	public new(SMTType complexType) {
		this.logic = false
		this.numeric = false
		this.complexType = complexType
	}
	
	def static dispatch createFromTypeReference(SMTBoolTypeReference ref) { return TypeDescriptor::LogicTypeDescriptor_Instance}
	def static dispatch createFromTypeReference(SMTIntTypeReference ref) { return TypeDescriptor::NumericTypeDescriptor_Instance}
	def static dispatch createFromTypeReference(SMTRealTypeReference ref) { return TypeDescriptor::NumericTypeDescriptor_Instance}
	def static dispatch createFromTypeReference(SMTComplexTypeReference ref) { return new TypeDescriptor(false,false,ref.referred)}
}