Commit 0d58668
Changed files (21)
build
product
utility
build/build.csproj
@@ -68,7 +68,9 @@
<ItemGroup>
<None Include="config\AssemblyInfo.cs.template" />
<None Include="local.properties.xml.template" />
- <None Include="project.build" />
+ <None Include="project.build">
+ <SubType>Designer</SubType>
+ </None>
</ItemGroup>
<ItemGroup>
<Content Include="local.properties.xml" />
product/utility/Builder.cs
@@ -1,7 +1,7 @@
-namespace gorilla.commons.utility
-{
- public interface Builder<T>
- {
- T build();
- }
+namespace gorilla.commons.utility
+{
+ public interface Builder<out T>
+ {
+ T build();
+ }
}
\ No newline at end of file
product/utility/Callback.cs
@@ -1,10 +1,10 @@
-namespace gorilla.commons.utility
-{
- public interface Callback : Command
- {
- }
-
- public interface Callback<T> : ParameterizedCommand<T>
- {
- }
+namespace gorilla.commons.utility
+{
+ public interface Callback : Command
+ {
+ }
+
+ public interface Callback<in T> : ParameterizedCommand<T>
+ {
+ }
}
\ No newline at end of file
product/utility/CallbackCommand.cs
@@ -1,6 +1,6 @@
-namespace gorilla.commons.utility
-{
- public interface CallbackCommand<T> : ParameterizedCommand<Callback<T>>
- {
- }
+namespace gorilla.commons.utility
+{
+ public interface CallbackCommand<out T> : ParameterizedCommand<Callback<T>>
+ {
+ }
}
\ No newline at end of file
product/utility/ChainedMapper.cs
@@ -1,19 +1,19 @@
-namespace gorilla.commons.utility
-{
- public class ChainedMapper<Left, Middle, Right> : Mapper<Left, Right>
- {
- readonly Mapper<Left, Middle> left;
- readonly Mapper<Middle, Right> right;
-
- public ChainedMapper(Mapper<Left, Middle> left, Mapper<Middle, Right> right)
- {
- this.left = left;
- this.right = right;
- }
-
- public Right map_from(Left item)
- {
- return right.map_from(left.map_from(item));
- }
- }
+namespace gorilla.commons.utility
+{
+ public class ChainedMapper<Left, Middle, Right> : Mapper<Left, Right>
+ {
+ readonly Mapper<Left, Middle> left;
+ readonly Mapper<Middle, Right> right;
+
+ public ChainedMapper(Mapper<Left, Middle> left, Mapper<Middle, Right> right)
+ {
+ this.left = left;
+ this.right = right;
+ }
+
+ public Right map_from(Left item)
+ {
+ return right.map_from(left.map_from(item));
+ }
+ }
}
\ No newline at end of file
product/utility/Configuration.cs
@@ -1,7 +1,7 @@
-namespace gorilla.commons.utility
-{
- public interface Configuration<T>
- {
- void configure(T item);
- }
+namespace gorilla.commons.utility
+{
+ public interface Configuration<in T>
+ {
+ void configure(T item);
+ }
}
\ No newline at end of file
product/utility/Factory.cs
@@ -1,7 +1,7 @@
-namespace gorilla.commons.utility
-{
- public interface Factory<T>
- {
- T create();
- }
+namespace gorilla.commons.utility
+{
+ public interface Factory<out T>
+ {
+ T create();
+ }
}
\ No newline at end of file
product/utility/FactoryDelegate.cs
@@ -1,6 +1,6 @@
-namespace gorilla.commons.utility
-{
- public delegate Out FactoryDelegate<In, Out>(In input);
-
- public delegate Out FactoryDelegate<Out>();
+namespace gorilla.commons.utility
+{
+ public delegate Out FactoryDelegate<in In, out Out>(In input);
+
+ public delegate Out FactoryDelegate<out Out>();
}
\ No newline at end of file
product/utility/Id.cs
@@ -1,46 +1,46 @@
-using System;
-
-namespace gorilla.commons.utility
-{
- [Serializable]
- public class Id<T>
- {
- static public readonly Id<T> Default = new Id<T>(default(T));
- readonly T id;
-
- public Id(T id)
- {
- this.id = id;
- }
-
- static public implicit operator Id<T>(T id)
- {
- return new Id<T>(id);
- }
-
- static public implicit operator T(Id<T> id)
- {
- return id.id;
- }
-
- public bool Equals(Id<T> other)
- {
- if (ReferenceEquals(null, other)) return false;
- if (ReferenceEquals(this, other)) return true;
- return Equals(other.id, id);
- }
-
- public override bool Equals(object obj)
- {
- if (ReferenceEquals(null, obj)) return false;
- if (ReferenceEquals(this, obj)) return true;
- if (obj.GetType() != typeof (Id<T>)) return false;
- return Equals((Id<T>) obj);
- }
-
- public override int GetHashCode()
- {
- return id.GetHashCode();
- }
- }
+using System;
+
+namespace gorilla.commons.utility
+{
+ [Serializable]
+ public class Id<T>
+ {
+ static public readonly Id<T> Default = new Id<T>(default(T));
+ readonly T id;
+
+ public Id(T id)
+ {
+ this.id = id;
+ }
+
+ static public implicit operator Id<T>(T id)
+ {
+ return new Id<T>(id);
+ }
+
+ static public implicit operator T(Id<T> id)
+ {
+ return id.id;
+ }
+
+ public bool Equals(Id<T> other)
+ {
+ if (ReferenceEquals(null, other)) return false;
+ if (ReferenceEquals(this, other)) return true;
+ return Equals(other.id, id);
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj)) return false;
+ if (ReferenceEquals(this, obj)) return true;
+ if (obj.GetType() != typeof (Id<T>)) return false;
+ return Equals((Id<T>) obj);
+ }
+
+ public override int GetHashCode()
+ {
+ return id.GetHashCode();
+ }
+ }
}
\ No newline at end of file
product/utility/Import.cs
@@ -1,7 +1,7 @@
-namespace gorilla.commons.utility
-{
- public interface Import<T>
- {
- void import(T item);
- }
+namespace gorilla.commons.utility
+{
+ public interface Import<in T>
+ {
+ void import(T item);
+ }
}
\ No newline at end of file
product/utility/Mapper.cs
@@ -1,7 +1,7 @@
-namespace gorilla.commons.utility
-{
- public interface Mapper<Input, Output>
- {
- Output map_from(Input item);
- }
+namespace gorilla.commons.utility
+{
+ public interface Mapper<in Input, out Output>
+ {
+ Output map_from(Input item);
+ }
}
\ No newline at end of file
product/utility/ParameterizedCommand.cs
@@ -1,7 +1,7 @@
-namespace gorilla.commons.utility
-{
- public interface ParameterizedCommand<T>
- {
- void run(T item);
- }
+namespace gorilla.commons.utility
+{
+ public interface ParameterizedCommand<in T>
+ {
+ void run(T item);
+ }
}
\ No newline at end of file
product/utility/Parser.cs
@@ -1,7 +1,7 @@
-namespace gorilla.commons.utility
-{
- public interface Parser<T>
- {
- T parse();
- }
+namespace gorilla.commons.utility
+{
+ public interface Parser<out T>
+ {
+ T parse();
+ }
}
\ No newline at end of file
product/utility/Query.cs
@@ -1,12 +1,12 @@
-namespace gorilla.commons.utility
-{
- public interface Query<TOutput>
- {
- TOutput fetch();
- }
-
- public interface Query<TInput, TOutput>
- {
- TOutput fetch(TInput item);
- }
+namespace gorilla.commons.utility
+{
+ public interface Query<out TOutput>
+ {
+ TOutput fetch();
+ }
+
+ public interface Query<in TInput, out TOutput>
+ {
+ TOutput fetch(TInput item);
+ }
}
\ No newline at end of file
product/utility/Registry.cs
@@ -1,9 +1,9 @@
-using System.Collections.Generic;
-
-namespace gorilla.commons.utility
-{
- public interface Registry<T> : IEnumerable<T>
- {
- IEnumerable<T> all();
- }
+using System.Collections.Generic;
+
+namespace gorilla.commons.utility
+{
+ public interface Registry<out T> : IEnumerable<T>
+ {
+ IEnumerable<T> all();
+ }
}
\ No newline at end of file
product/utility/Specification.cs
@@ -1,7 +1,7 @@
-namespace gorilla.commons.utility
-{
- public interface Specification<T>
- {
- bool is_satisfied_by(T item);
- }
+namespace gorilla.commons.utility
+{
+ public interface Specification<in T>
+ {
+ bool is_satisfied_by(T item);
+ }
}
\ No newline at end of file
product/utility/SpecificationExtensions.cs
@@ -1,40 +1,41 @@
-using System;
-using System.Collections.Generic;
-
-namespace gorilla.commons.utility
-{
- static public class SpecificationExtensions
- {
- static public IEnumerable<T> that_satisfy<T>(this IEnumerable<T> items_to_peek_in_to,
- Predicate<T> criteria_to_satisfy)
- {
- foreach (var item in items_to_peek_in_to ?? new List<T>())
- if (item.satisfies(criteria_to_satisfy)) yield return item;
- }
-
- static public bool satisfies<T>(this T item_to_interrogate, Predicate<T> criteria_to_satisfy)
- {
- return criteria_to_satisfy(item_to_interrogate);
- }
-
- static public bool satisfies<T>(this T item_to_validate, Specification<T> criteria_to_satisfy)
- {
- return item_to_validate.satisfies(criteria_to_satisfy.is_satisfied_by);
- }
-
- static public Specification<T> and<T>(this Specification<T> left, Specification<T> right)
- {
- return new PredicateSpecification<T>(x => left.is_satisfied_by(x) && right.is_satisfied_by(x));
- }
-
- static public Specification<T> or<T>(this Specification<T> left, Specification<T> right)
- {
- return new PredicateSpecification<T>(x => left.is_satisfied_by(x) || right.is_satisfied_by(x));
- }
-
- static public Specification<T> not<T>(this Specification<T> original)
- {
- return new PredicateSpecification<T>(x => !original.is_satisfied_by(x));
- }
- }
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace gorilla.commons.utility
+{
+ static public class SpecificationExtensions
+ {
+ static public IEnumerable<T> that_satisfy<T>(this IEnumerable<T> items_to_peek_in_to,
+ Predicate<T> criteria_to_satisfy)
+ {
+ foreach (var item in items_to_peek_in_to ?? Enumerable.Empty<T>())
+ if (item.satisfies(criteria_to_satisfy)) yield return item;
+ }
+
+ static public bool satisfies<T>(this T item_to_interrogate, Predicate<T> criteria_to_satisfy)
+ {
+ return criteria_to_satisfy(item_to_interrogate);
+ }
+
+ static public bool satisfies<T>(this T item_to_validate, Specification<T> criteria_to_satisfy)
+ {
+ return item_to_validate.satisfies(criteria_to_satisfy.is_satisfied_by);
+ }
+
+ static public Specification<T> and<T>(this Specification<T> left, Specification<T> right)
+ {
+ return new PredicateSpecification<T>(x => left.is_satisfied_by(x) && right.is_satisfied_by(x));
+ }
+
+ static public Specification<T> or<T>(this Specification<T> left, Specification<T> right)
+ {
+ return new PredicateSpecification<T>(x => left.is_satisfied_by(x) || right.is_satisfied_by(x));
+ }
+
+ static public Specification<T> not<T>(this Specification<T> original)
+ {
+ return new PredicateSpecification<T>(x => !original.is_satisfied_by(x));
+ }
+ }
}
\ No newline at end of file
product/utility/SubjectOf.cs
@@ -1,7 +1,7 @@
-namespace gorilla.commons.utility
-{
- public interface SubjectOf<State> where State : utility.State
- {
- void change_state_to(State new_state);
- }
+namespace gorilla.commons.utility
+{
+ public interface SubjectOf<in State> where State : utility.State
+ {
+ void change_state_to(State new_state);
+ }
}
\ No newline at end of file
product/utility/ValueReturningVisitor.cs
@@ -1,8 +1,8 @@
-namespace gorilla.commons.utility
-{
- public interface ValueReturningVisitor<Value, T> : Visitor<T>
- {
- Value value { get; }
- void reset();
- }
+namespace gorilla.commons.utility
+{
+ public interface ValueReturningVisitor<out Value, in T> : Visitor<T>
+ {
+ Value value { get; }
+ void reset();
+ }
}
\ No newline at end of file
product/utility/Visitable.cs
@@ -1,7 +1,7 @@
-namespace gorilla.commons.utility
-{
- public interface Visitable<T>
- {
- void accept(Visitor<T> visitor);
- }
+namespace gorilla.commons.utility
+{
+ public interface Visitable<out T>
+ {
+ void accept(Visitor<T> visitor);
+ }
}
\ No newline at end of file
product/utility/Visitor.cs
@@ -1,7 +1,7 @@
-namespace gorilla.commons.utility
-{
- public interface Visitor<T>
- {
- void visit(T item_to_visit);
- }
+namespace gorilla.commons.utility
+{
+ public interface Visitor<in T>
+ {
+ void visit(T item_to_visit);
+ }
}
\ No newline at end of file