mirror of
https://github.com/eliasstepanik/OSCADSharpDotnet7.git
synced 2026-01-28 05:18:28 +00:00
Made a number of fields ReadOnly that are never mutated
This commit is contained in:
parent
fd12071509
commit
cf7eaa9000
@ -31,7 +31,7 @@ namespace OSCADSharp.DataBinding
|
|||||||
this.bindings.Synonym("innervalue", propertyName);
|
this.bindings.Synonym("innervalue", propertyName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private string boundProperty = null;
|
private readonly string boundProperty = null;
|
||||||
|
|
||||||
internal bool IsBound { get; set; } = false;
|
internal bool IsBound { get; set; } = false;
|
||||||
public void Bind(string property, Variable variable)
|
public void Bind(string property, Variable variable)
|
||||||
|
|||||||
@ -11,7 +11,7 @@ namespace OSCADSharp.DataBinding
|
|||||||
{
|
{
|
||||||
#region Fields
|
#region Fields
|
||||||
private Dictionary<string, Binding> bindings = new Dictionary<string, Binding>();
|
private Dictionary<string, Binding> bindings = new Dictionary<string, Binding>();
|
||||||
private Dictionary<string, string> propertyNametoOpenSCADFieldMappings = new Dictionary<string, string>();
|
private readonly Dictionary<string, string> propertyNametoOpenSCADFieldMappings = new Dictionary<string, string>();
|
||||||
private Dictionary<string, string> synonyms = new Dictionary<string, string>();
|
private Dictionary<string, string> synonyms = new Dictionary<string, string>();
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,7 @@ namespace OSCADSharp.DataBinding
|
|||||||
/// top of OpenSCAD scripts
|
/// top of OpenSCAD scripts
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Variables Global { get; set; } = new Variables();
|
public static Variables Global { get; set; } = new Variables();
|
||||||
private ConcurrentDictionary<string, Variable> variables = new ConcurrentDictionary<string, Variable>();
|
private readonly ConcurrentDictionary<string, Variable> variables = new ConcurrentDictionary<string, Variable>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a variable to the collection
|
/// Adds a variable to the collection
|
||||||
|
|||||||
@ -31,7 +31,7 @@ namespace OSCADSharp.IO
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private class OpenSCADPathFinder
|
private class OpenSCADPathFinder
|
||||||
{
|
{
|
||||||
private string[] possibleFilePaths = new string[]
|
private readonly string[] possibleFilePaths = new string[]
|
||||||
{
|
{
|
||||||
@"C:\Program Files (x86)\OpenSCAD\openscad.exe",
|
@"C:\Program Files (x86)\OpenSCAD\openscad.exe",
|
||||||
@"C:\Program Files\OpenSCAD\openscad.exe"
|
@"C:\Program Files\OpenSCAD\openscad.exe"
|
||||||
|
|||||||
@ -15,7 +15,7 @@ namespace OSCADSharp
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// An object that's mirrored on a plane
|
/// An object that's mirrored on a plane
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal class MirroredObject : SingleStatementObject
|
private class MirroredObject : SingleStatementObject
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The normal vector of a plane intersecting the origin of the object,
|
/// The normal vector of a plane intersecting the origin of the object,
|
||||||
@ -133,7 +133,7 @@ namespace OSCADSharp
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates an object that's the convex hull of child objects
|
/// Creates an object that's the convex hull of child objects
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal class HulledObject : MultiStatementObject
|
private class HulledObject : MultiStatementObject
|
||||||
{
|
{
|
||||||
internal HulledObject(IEnumerable<OSCADObject> children) : base("hull()", children)
|
internal HulledObject(IEnumerable<OSCADObject> children) : base("hull()", children)
|
||||||
{
|
{
|
||||||
@ -145,7 +145,7 @@ namespace OSCADSharp
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates an object that's the minkowski sum of child objects
|
/// Creates an object that's the minkowski sum of child objects
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal class MinkowskiedObject : MultiStatementObject
|
private class MinkowskiedObject : MultiStatementObject
|
||||||
{
|
{
|
||||||
|
|
||||||
internal MinkowskiedObject(IEnumerable<OSCADObject> children) : base("minkowski()", children)
|
internal MinkowskiedObject(IEnumerable<OSCADObject> children) : base("minkowski()", children)
|
||||||
|
|||||||
@ -18,7 +18,7 @@ namespace OSCADSharp
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal class MultiStatementObject : OSCADObject
|
internal class MultiStatementObject : OSCADObject
|
||||||
{
|
{
|
||||||
private string outerStatement;
|
private readonly string outerStatement;
|
||||||
|
|
||||||
internal MultiStatementObject(string outerStatement, IEnumerable<OSCADObject> children)
|
internal MultiStatementObject(string outerStatement, IEnumerable<OSCADObject> children)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -20,7 +20,7 @@ namespace OSCADSharp
|
|||||||
public abstract partial class OSCADObject : IBindable
|
public abstract partial class OSCADObject : IBindable
|
||||||
{
|
{
|
||||||
#region Attributes
|
#region Attributes
|
||||||
private int id = Ids.Get();
|
private readonly int id = Ids.Get();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The unique Id of the object
|
/// The unique Id of the object
|
||||||
|
|||||||
@ -14,7 +14,7 @@ namespace OSCADSharp.Spatial
|
|||||||
internal class Matrix
|
internal class Matrix
|
||||||
{
|
{
|
||||||
#region Fields/Properties
|
#region Fields/Properties
|
||||||
private double[] values;
|
private readonly double[] values;
|
||||||
|
|
||||||
internal int ColumnCount { get; private set; }
|
internal int ColumnCount { get; private set; }
|
||||||
internal int RowCount { get; private set; }
|
internal int RowCount { get; private set; }
|
||||||
|
|||||||
@ -12,7 +12,7 @@ namespace OSCADSharp.Utility
|
|||||||
internal static class Ids
|
internal static class Ids
|
||||||
{
|
{
|
||||||
private static int globalId = 0;
|
private static int globalId = 0;
|
||||||
private static object idLockObject = new object();
|
private readonly static object idLockObject = new object();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a unique auto-incrementing integer id
|
/// Gets a unique auto-incrementing integer id
|
||||||
|
|||||||
@ -13,9 +13,9 @@ namespace OSCADSharp.Utility
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal class SingleBlockFormatter
|
internal class SingleBlockFormatter
|
||||||
{
|
{
|
||||||
private string outerCode;
|
private readonly string outerCode;
|
||||||
private string innerCode;
|
private readonly string innerCode;
|
||||||
private string indentationAmount = " ";
|
private readonly string indentationAmount = " ";
|
||||||
|
|
||||||
internal SingleBlockFormatter(string outerCode, string innerCode)
|
internal SingleBlockFormatter(string outerCode, string innerCode)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -14,7 +14,7 @@ namespace OSCADSharp.Utility
|
|||||||
internal class StatementBuilder
|
internal class StatementBuilder
|
||||||
{
|
{
|
||||||
private StringBuilder SB { get; set; } = new StringBuilder();
|
private StringBuilder SB { get; set; } = new StringBuilder();
|
||||||
private Bindings bindings = null;
|
private readonly Bindings bindings = null;
|
||||||
|
|
||||||
internal StatementBuilder(Bindings bindings)
|
internal StatementBuilder(Bindings bindings)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user