예제 #1
0
		// construction
		public Node(Representation parent, bool isInput, int groupNum, Datatype datatype) // PASS IN X AND Y OF REPRESENTATION
		{
			m_parent = parent;
			m_isInput = isInput;
			m_groupNum = groupNum;
			m_datatype = datatype;

			m_graphic = GraphicFactory.createNodeGraphic(this);
		}
예제 #2
0
 public static Datatype defineDatatype(String name, Type type, int rank)
 {
     Datatype r = new Datatype();
     r.m_type = type;
     r.m_name = name;
     r.m_rank = rank;
     appendType(r);
     return r;
 }
예제 #3
0
        public static Datatype aggregateTypes(String name, Datatype[] agg)
        {
            Datatype r = new Datatype();
            r.m_type = Type.Aggregate;
            r.m_name = name;
            r.m_rank = 0;
            Console.Out.WriteLine(agg.Length);
			for (int i = 0; i < agg.Length; i++) { r.m_rank += agg[i].m_rank; }
            r.m_bundle = agg;
            if (!appendType(r))
            {
             //   throw new UnauthorizedAccessException(); //Probably not the right exception to use...
            }
            return r;
        }
예제 #4
0
		// construction
        public Representation(Datatype[] inputs, Datatype[] outputs)
        {
            Master.log("----Creating representation----");
            m_id = Master.getNextRepID();
            Master.log("ID: " + m_id, Colors.GreenYellow);
          
            this.m_inputs = inputs;
            this.m_outputs = outputs;
          
			m_graphic = GraphicFactory.createRepresentationGraphic(this, inputs.Length, outputs.Length);

			// create nodes
			for (int i = 0; i < m_inputs.Length; i++) { m_nodes.Add(new Node(this, true, i, m_inputs[i])); }
			for (int i = 0; i < m_outputs.Length; i++) { m_nodes.Add(new Node(this, false, i, m_outputs[i])); }
        }
예제 #5
0
        private static Boolean appendType(Datatype dt)
        {
            if (Directory == null)
            {
                Directory = new Datatype[] { dt };
                return true;
            }
            
            if (Directory.Contains(dt))
                return false;

            Datatype[] n = new Datatype[Directory.Length + 1];
            for (int i = 0; i < Directory.Length; i++)
                n[i] = Directory[i];
            n[Directory.Length] = dt;
            Directory = n;
            return true;
        }
예제 #6
0
 public Boolean fits(Datatype compare)
 {
     return compare.m_rank == m_rank && compare.m_type == m_type;
 }
예제 #7
0
 public Boolean equals(Datatype compare) //Datatype names SHOULD be unique!
 {
     return compare.m_name.Equals(m_name) && fits(compare);
 }
예제 #8
0
 public static Datatype aggregateTypes(String name, Datatype a, Datatype b, Datatype c)
 {
     return aggregateTypes(name, new Datatype[] { a, b, c });
 }
예제 #9
0
		// create representation (eventually this should be based SOLELY on an imported algorithm, not created manually)
		/*private void addRep(int inputs, int outputs)
		{
			Representation r = new Representation(inputs, outputs);
			m_representations.Add(r.getID(), r);
		}*/

        private void addRep(Datatype[] inputs, Datatype[] outputs)
        {
            Representation r = new Representation(inputs, outputs);
            m_representations.Add(r.getID(), r);
        }