Code -
The Implementation
Below is the code that was generated from extracting the heuristics from the Field case
and mapping them to an interactive visualizer.
private function calculateScore():void {
var Factor1:int = 0;
var Factor1_Weight:Number = 0.35;
var SubFactor1_Use:int = 0;
var SubFactor1_Purpose:int = 0;
var SubFactor1_Transform:int = 0;
var Factor2:int = 0;
var Factor2_Weight:Number = 0.15;
var Factor3:int = 0;
var Factor3_Weight:Number = 0.15;
var SubFactor3_Taken:int = 0;
var SubFactor3_Quality:int = 0;
var SubFactor3_Ratio:int = 0;
var Factor4:int = 0;
var Factor4_Weight:Number = 0.35;
var SubFactor4_Original:int = 0;
var SubFactor4_Derivative:int = 0;
var Factor5:int = 0;
var Factor5_Weight:Number = 0.1;
var myScore:Number = 0;
//---------------------------------------------------------
// Factor 1 - Purpose and Character of Use
//----------------------------------------------------------
// Factor 1 - Use
SubFactor1_Use = sdrPurpose.value;
// Factor 1 - Purpose
if (cbCriticism.selected) {SubFactor1_Purpose +=1};
if (cbComment.selected) {SubFactor1_Purpose +=1};
if (cbReporting.selected) {SubFactor1_Purpose +=1};
if (cbTeaching.selected) {SubFactor1_Purpose +=1};
if (cbScholarship.selected) {SubFactor1_Purpose +=1};
if (cbResearch.selected) {SubFactor1_Purpose +=1};
if (cbParody.selected) {SubFactor1_Purpose +=1};
if (cbOther.selected) {SubFactor1_Purpose +=1};
if (SubFactor1_Purpose > 0) {
SubFactor1_Purpose = 72 + ((SubFactor1_Purpose - 1) * 4);
}
// Factors 1 - Transformation
SubFactor1_Transform = sdrTransform.value;
// Normalize Factor1
if (SubFactor1_Transform > 50) {
SubFactor1_Use += 1;
SubFactor1_Use *= 2;
if (SubFactor1_Use > 100) {
SubFactor1_Use = 100;
}
}
Factor1 = (SubFactor1_Use + SubFactor1_Purpose + SubFactor1_Transform) / 3;
//----------------------------------------------------------
// Factor 2 - Nature of Copyrighted Works (Worthiness)
//----------------------------------------------------------
Factor2 = sdrProtectable.value;
//----------------------------------------------------------
// Factor 3 - Amount and Substantiality of Use
//----------------------------------------------------------
SubFactor3_Taken = sdrTaken.value;
SubFactor3_Quality = sdrQuality.value;
SubFactor3_Ratio = sdrRatio.value;
// Normalize Factor3
if (SubFactor1_Transform > 50) {
SubFactor3_Taken += 1;
SubFactor3_Ratio += 1;
SubFactor3_Taken *= 2;
SubFactor3_Ratio *= 2;
if (SubFactor3_Taken > 100) {
SubFactor3_Taken = 100;
}
if (SubFactor3_Ratio > 100) {
SubFactor3_Ratio = 100;
}
}
Factor3 = (SubFactor3_Taken + SubFactor3_Quality + SubFactor3_Ratio) / 3;
//----------------------------------------------------------
// Factor 4 - The Effect of the Use upon the Potential Market for or Value of the Copyrighted Work
//----------------------------------------------------------
SubFactor4_Original = sdrOriginal.value;
SubFactor4_Derivative = sdrDerivative.value;
// Normalize Factor4
Factor4 = (SubFactor4_Original + SubFactor4_Derivative) / 2;
//----------------------------------------------------------
// Factor 5 - Bonus Points for Good Faith
//----------------------------------------------------------
Factor5 = sdrBonus.value;
// run the Transformation transformation
if (SubFactor1_Transform > 50) {
if (SubFactor1_Transform > 90) {
SubFactor1_Transform = 90;
}
Factor1_Weight += (SubFactor1_Transform - 50) / 100;
Factor2_Weight -= ((SubFactor1_Transform - 50) / 100) / 3;
Factor3_Weight -= ((SubFactor1_Transform - 50) / 100) / 3;
Factor4_Weight -= ((SubFactor1_Transform - 50) / 100) / 3;
}
//----------------------------------------------------------
// Total Score
//----------------------------------------------------------
myScore = (Factor1 * Factor1_Weight) +
(Factor2 * Factor2_Weight) +
(Factor3 * Factor3_Weight) +
(Factor4 * Factor4_Weight) +
(Factor5 * Factor5_Weight);
myScore = Math.round(myScore);