/// <summary> /// Returns a condition (function) that is true iff the shape's purpose is the purpose specified in the argument. /// </summary> public static Func <Shape, bool> WithPurpose(ShapePurpose purpose) { return(shape => { var agendaShape = Decode(shape); if (agendaShape == null) { return false; } return agendaShape.ShapePurpose == purpose; }); }
public static List <Shape> GetAllShapesWithPurpose(Shape beamShape, ShapePurpose purpose) { return(beamShape.GroupItems.Cast <Shape>().Where(AgendaShape.WithPurpose(purpose)).ToList()); }
public static Shape GetShapeWithPurpose(Shape beamShape, ShapePurpose purpose) { return(beamShape.GroupItems.Cast <Shape>().FirstOrDefault(AgendaShape.WithPurpose(purpose))); }
/// <summary> /// Universal Encode function used for all Agenda Shapes. /// Packs a set of agenda shape properties to a shape name. Paired with the Decode function. /// </summary> public static string Encode(ShapePurpose shapePurpose, AgendaSection section) { string[] parameters = { Prefix, shapePurpose.ToString(), section.Encode() }; return(string.Join(Delim[0], parameters)); }
private AgendaShape(ShapePurpose shapePurpose, AgendaSection section) { ShapePurpose = shapePurpose; Section = section; }
/// <summary> /// Stores metadata in the shape by setting its name. /// </summary> public static void SetShapeName(Shape shape, ShapePurpose shapePurpose, AgendaSection section) { shape.Name = Encode(shapePurpose, section); }
/// <summary> /// Returns a condition (function) that is true iff the shape's purpose is the purpose specified in the argument. /// </summary> public static Func<Shape, bool> WithPurpose(ShapePurpose purpose) { return shape => { var agendaShape = Decode(shape); if (agendaShape == null) return false; return agendaShape.ShapePurpose == purpose; }; }
/// <summary> /// Universal Encode function used for all Agenda Shapes. /// Packs a set of agenda shape properties to a shape name. Paired with the Decode function. /// </summary> public static string Encode(ShapePurpose shapePurpose, AgendaSection section) { string[] parameters = { Prefix, shapePurpose.ToString(), section.Encode() }; return string.Join(Delim[0], parameters); }
private AgendaShape(ShapePurpose shapePurpose, AgendaSection section) { ShapePurpose = shapePurpose; Section = section; }
/// <summary> /// Stores metadata in the shape by setting its name. /// </summary> public static void SetShapeName(Shape shape, ShapePurpose shapePurpose, AgendaSection section) { shape.Name = Encode(shapePurpose, section); }
public static List<Shape> GetAllShapesWithPurpose(Shape beamShape, ShapePurpose purpose) { return beamShape.GroupItems.Cast<Shape>().Where(AgendaShape.WithPurpose(purpose)).ToList(); }
public static Shape GetShapeWithPurpose(Shape beamShape, ShapePurpose purpose) { return beamShape.GroupItems.Cast<Shape>().FirstOrDefault(AgendaShape.WithPurpose(purpose)); }