Hi Mark,
Thank you very much for your reply..
getCriteriaMap. My code to create a HashMap of the criteria string is only 10 lines of code. I am confused as to what you are actually doing in this method?
In one aspect it looks like it is trying to not only make the HashMap, but also check to see if it is a match to a record, then putting it somewhere.
Thanks for your patience of reading my post and your reply.....
In method getCriterMap(String criteria,Field fieldInfo)
StringTokenzier splits the criteria twice to get fieldName[i] and dataValue[i]..
eg:
criteria = "Carrier='PromptAir',Origin airport='DAL ',Destination airport='FRA'"
fieldName[0]=Carrier dataValue[0]='PromptAir'
fieldName[1]=Origin airport dataValue[1]='DAL'
fieldName[2]=Destination airport dataValue[2]='FRA'
My HasMap is not storing fieldName[i] & dataValue[i].. Instead of that it is storing
fieldIndex[i] & dataValue[i]..
Above code gets fieldIndex by using private method getKeyIndex()..
In fieldInfo... Header contains.
fieldInfo[0]=FlightNumber
fieldInfo[1]=Origin airport
fieldInfo[2]=Destination airport
fieldInfo[3]=Carrier
fieldINfo[4]=Price..
....
...
fieldInfo[8]=Available seats...
MEthod getKeyIndex(FieldName[i],FieldInfo)..
returns corresponding index..
i.e If fieldName is "Carrier" it returns "3"
If fieldName is "Origin airport" it returns "1"
If fieldName is "Destination airport" it returns "2"
So I am storing {(3,'PromptAir'),(1,'DAL'),(2,'FRA')} in to the HashMap...
public boolean isRecordMatch(DataInfo record,Map map){
}
This method Takes Datainfo record and HashMap(fieldIndex,dataValues).. It can search fastly by using fieldIndex..
eg;
In record it search whether 3 index Value is 'PromptAir' or not. If it matches then search for origin airport is 'DAL or not.It is matches then search for Destination airport is 'FRA' or not. If all these three matches then it return true otherwise false..
Please give your feedback on this..
[ June 24, 2002: Message edited by: Suresh Babu Seeram
[ June 24, 2002: Message edited by: Suresh Babu Seeram ]