Pages

Monday, December 28, 2009

Remove Names of hidden elements from a list of names of design elements

/**
* Method to remove the strings from a string ArrayList <String>) which corresponds
* to the name of an hidden element
* @param designElementNames - an ArrayList with String Objects
* @return ArrayList
* @author karthikeyan_a
* @since 30-April-2009
*/

public ArrayList filterHiddenElements(ArrayList designElementNames) {
//if the input param in null then return null
if (designElementNames==null)return null;
//initialize the return value
ArrayList filteredDsgnElements=new ArrayList();
String dsgnName=null;
Object[] buffer=designElementNames.toArray();
int countItr=0;
/**
* loop through all the string objects in the input vector and remove the string objects
* that correspond to the name of an hidden design element
*/
for(countItr=0;countItr<buffer.length;countItr++) {
dsgnName=buffer[countItr].toString().trim();
if ( !( (dsgnName.indexOf("(")==0) && (dsgnName.indexOf(")")==(dsgnName.length()-1)) ) ) {
filteredDsgnElements.add(dsgnName);
}
}
//recycle objects
dsgnName=null;
designElementNames=null;

return filteredDsgnElements;
} //end of function::filterHiddenElements

No comments:

Post a Comment