An alternative to UBB.threads
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
FLocal/FLocal.Common/actions/TwoWayReferenceFieldValue.cs

35 lines
904 B

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace FLocal.Common.actions {
class TwoWayReferenceFieldValue : ReferenceFieldValue {
public delegate string Calculator(string old, string reference);
public static Calculator GREATEST = (old, reference) => {
if(old == null || old == "") {
return reference;
}
return Math.Max(int.Parse(old), int.Parse(reference)).ToString();
};
private Calculator calculator;
public TwoWayReferenceFieldValue(AbstractChange referenced, Calculator calculator)
: base(referenced) {
this.calculator = calculator;
}
public override string getStringRepresentation() {
throw new NotSupportedException();
}
public override string getStringRepresentation(string oldInfo) {
return this.calculator(oldInfo, base.getStringRepresentation());
}
}
}