// Fields // Results // Business constructor public CloudCentralThought( Cloud cloud , IEnumerable <CloudCentralThought> prior , Thought value ) { InitializeResults(); _cloud = new PredecessorObj <Cloud>(this, RoleCloud, cloud); _prior = new PredecessorList <CloudCentralThought>(this, RolePrior, prior); _value = new PredecessorObj <Thought>(this, RoleValue, value); }
// Results // Business constructor public ThoughtText( Thought thought , IEnumerable <ThoughtText> prior , string value ) { InitializeResults(); _thought = new PredecessorObj <Thought>(this, RoleThought, thought); _prior = new PredecessorList <ThoughtText>(this, RolePrior, prior); _value = value; }
public CorrespondenceFact CreateFact(FactMemento memento) { Thought newFact = new Thought(memento); // Create a memory stream from the memento data. using (MemoryStream data = new MemoryStream(memento.Data)) { using (BinaryReader output = new BinaryReader(data)) { newFact._unique = (Guid)_fieldSerializerByType[typeof(Guid)].ReadData(output); } } return(newFact); }
public Link LinkTo(Thought otherThought) { return Community.AddFact(new Link(new List<Thought> { this, otherThought })); }
private static void Fan(Thought thought, Dictionary<Thought, Point> centerByThought, Point origin, double startRadians, double sweepRadians, int depth) { List<Thought> neighbors = thought.Neighbors .Distinct() .Where(n => !centerByThought.ContainsKey(n)) .ToList(); int step = 0; double arc = sweepRadians / (double)neighbors.Count; foreach (Thought neighbor in neighbors) { double theta = arc * ((double)step + 0.5) + startRadians; Point center = new Point( -HorizontalRadius * Math.Sin(theta) + origin.X, VerticalRadius * Math.Cos(theta) + origin.Y); centerByThought.Add(neighbor, center); ++step; } if (depth <= 3) { step = 0; foreach (Thought neighbor in neighbors) { Fan(neighbor, centerByThought, centerByThought[neighbor], arc * (double)step + startRadians, arc, depth + 1); ++step; } } }
private void GetLinks(Thought thought, List<Link> links, int depth) { List<Link> neighbors = thought.Links .Distinct() .Where(l => !links.Contains(l)) .ToList(); foreach (Link link in neighbors) links.Add(link); if (depth <= 3) { foreach (Link link in neighbors) { Thought neighbor = link.Thoughts.FirstOrDefault(t => t != thought); if (neighbor != null) GetLinks(neighbor, links, depth + 1); } } }
private void CreateThoughtViewModels(Thought thought, List<ThoughtViewModelActual> viewModels, int depth) { List<Thought> neighbors = thought.Neighbors .Distinct() .Where(n => !viewModels.Any(vm => vm.Thought == n)) .ToList(); foreach (Thought neighbor in neighbors) { viewModels.Add(new ThoughtViewModelActual(neighbor, this)); } if (depth <= 3) { foreach (Thought neighbor in neighbors) { CreateThoughtViewModels(neighbor, viewModels, depth + 1); } } }
private float GetY(Thought thought) { _depCenterByThought.OnGet(); Point center = new Point(); _centerByThought.TryGetValue(thought, out center); return (float)center.Y; }
public Point GetCenterByThought(Thought thought) { _depCenterByThought.OnGet(); InertialProperty x; InertialProperty y; if (_inertialXByThought.TryGetValue(thought, out x) && _inertialYByThought.TryGetValue(thought, out y)) return new Point(x.Value, y.Value); else return new Point(0.0, 0.0); }
public void WriteFactData(CorrespondenceFact obj, BinaryWriter output) { Thought fact = (Thought)obj; _fieldSerializerByType[typeof(Guid)].WriteData(output, fact._unique); }
public Link LinkTo(Thought otherThought) { return(Community.AddFact(new Link(new List <Thought> { this, otherThought }))); }
public ThoughtViewModelActual(Thought thought, IThoughtContainer container) { _thought = thought; _container = container; }
// Results // Business constructor public ThoughtText( Thought thought ,IEnumerable<ThoughtText> prior ,string value ) { InitializeResults(); _thought = new PredecessorObj<Thought>(this, RoleThought, thought); _prior = new PredecessorList<ThoughtText>(this, RolePrior, prior); _value = value; }
public CorrespondenceFact CreateFact(FactMemento memento) { Thought newFact = new Thought(memento); // Create a memory stream from the memento data. using (MemoryStream data = new MemoryStream(memento.Data)) { using (BinaryReader output = new BinaryReader(data)) { newFact._unique = (Guid)_fieldSerializerByType[typeof(Guid)].ReadData(output); } } return newFact; }
// Fields // Results // Business constructor public CloudCentralThought( Cloud cloud ,IEnumerable<CloudCentralThought> prior ,Thought value ) { InitializeResults(); _cloud = new PredecessorObj<Cloud>(this, RoleCloud, cloud); _prior = new PredecessorList<CloudCentralThought>(this, RolePrior, prior); _value = new PredecessorObj<Thought>(this, RoleValue, value); }