EmbASP-CSharp
AnswerSet.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Collections.ObjectModel;
4 
6 {
7  public class AnswerSet
8  {
9  private readonly IList<string> value;
10  private readonly IDictionary<int, int> weight_map;
11  private ISet<object> atoms;
12 
13  public AnswerSet(IList<string> output)
14  {
15  value = output;
16  weight_map = new Dictionary<int, int>();
17  }
18 
19  public AnswerSet(IList<string> value, IDictionary<int, int> weightMap)
20  {
21  this.value = value;
22  weight_map = weightMap;
23  }
24 
25  public virtual IList<string> GetAnswerSet() => new ReadOnlyCollection<string>(value);
26 
27  public virtual IList<string> Value => value;
28 
29  public virtual ISet<object> Atoms
30  {
31  get
32  {
33  if (atoms == null)
34  {
35  atoms = new HashSet<object>();
36  ASPMapper mapper = ASPMapper.Instance;
37  foreach (String atom in value)
38  {
39  object obj = mapper.GetObject(atom);
40  if (obj != null)
41  atoms.Add(obj);
42  }
43  }
44  return atoms;
45  }
46  }
47 
48  public virtual IDictionary<int, int> LevelWeight => weight_map;
49 
50  public virtual IDictionary<int, int> Weights => new ReadOnlyDictionary<int, int>(weight_map);
51 
52  public override string ToString() => value.ToString();
53  }
54 }
it.unical.mat.embasp.languages.asp.ASPMapper
Definition: ASPMapper.cs:8
it.unical.mat.embasp.languages.asp
Definition: AnswerSet.cs:5
it.unical.mat.embasp.languages.asp.AnswerSet
Definition: AnswerSet.cs:7