EmbASP-CSharp
InputProgram.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4 
5 namespace it.unical.mat.embasp.@base
6 {
7  public class InputProgram
8  {
9  protected internal string programs;
10  private IList<string> files_paths;
11  protected internal string separator;
12 
13  public InputProgram()
14  {
15  Init();
16  separator = " ";
17  }
18 
19  public InputProgram(object inputObj)
20  {
21  Init();
22  AddObjectInput(inputObj);
23  }
24 
25  public InputProgram(string initial_program)
26  {
27  Init();
28  programs = initial_program;
29  }
30 
31  public virtual void AddFilesPath(string file_path) => files_paths.Add(file_path);
32 
33  public virtual void AddObjectInput(object inputObj) => throw new System.NotSupportedException("functionality not implemented");
34 
35  public virtual void AddObjectsInput(ISet<object> inputObjs)
36  {
37  foreach (Object inputObj in inputObjs)
38  AddObjectInput(inputObj);
39  }
40 
41  public virtual void AddProgram(string new_instruction)
42  {
43  if (programs.Length == 0)
44  programs = new_instruction;
45  else
46  programs += separator + new_instruction;
47  }
48 
49  public virtual void ClearAll()
50  {
51  ClearFilesPaths();
52  ClearPrograms();
53  }
54 
55  public virtual void ClearFilesPaths() => files_paths.Clear();
56 
57  public virtual void ClearPrograms() => programs = "";
58 
59  public virtual IList<string> FilesPaths => files_paths;
60 
61  public virtual string Programs { get => programs; set => this.programs = value; }
62 
63  public virtual string Separator { get => separator; set => this.separator = value; }
64 
65  public virtual string StringOfFilesPaths
66  {
67  get
68  {
69  StringBuilder to_return = new StringBuilder();
70  foreach (String paths in files_paths)
71  if (paths.Length != 0)
72  to_return.Append(paths).Append(" ");
73  return to_return.ToString();
74  }
75  }
76 
77  private void Init()
78  {
79  programs = "";
80  files_paths = new List<string>();
81  }
82  }
83 }
base
Definition: Callback.cs:1
it.unical.mat.embasp
Definition: AnswerSet.cs:5
base.InputProgram
Definition: InputProgram.cs:7