package infosapient.hdg;
/*
* Copyright (c) 2001, Workplace Performance Tools, All Rights Reserved.
*
* LICENSE TO USE THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE 0.5
* ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES
* RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
* The license may be viewed at:
* http://www.opensource.org/licenses/cpl.html
*/
import infosapient.system.FzySet;
import java.rmi.server.ObjID;
/**
*<DT>
* FzyHdgABOVE sets the membership of all domain values below the complete
* membership point to be zero. All membership values above the complete
* membership point are assigned <B><FONT FACE="Courier New,Courier">1.0 -
* m[i].</FONT></B>This has the effect of ramping gradually, so that 100%
* Membership == high domain value.</DT>
*
* @author: Michael McConnell
* @version $Revision: 1.1.1.1 $
*/
public class FzyHdgABOVE extends FzyHedge {
static final long serialVersionUID= -7638534659234997078L;
public FzyHdgABOVE() {myID = new ObjID();}
/**
* Apply the surface modifier <code>m[i] = 0.0</code> for all domain values below/before
* <code>m[i] == set.maxHeight()</code> and <code> m[i] = 1.0 - m[i]</code>
* for all values after/above.
* @param FzySet -- the set to have the hedge applied to it.
* @return FzySet -- the modified fuzzy set.
*/
public FzySet apply(FzySet aSet) {
VECMAX = aSet.getMemberArray().length;
results = new double[VECMAX];
m = aSet.getMemberArray();
double maxHeight = aSet.getMaxHeight();
for(int inx = 0 ; inx < VECMAX; inx++){
if( m[inx] >= maxHeight ) {
for(int jnx = 0;jnx < VECMAX; jnx++) {
if(jnx <= inx) {
results[jnx] = 0.0;
} else {
results[jnx] = 1.0d - m[jnx];
}
}
break;
}
}
aSet.setMembershipArray(results);
return aSet;
}
public String getName() {
return "above";
}
}