PQL Properties

From FSL
Jump to: navigation, search

Back to JavaMOPCFG

Contents

HashMap

 query main ()
 uses
   object java.util.Hashmap h;
   object java.lang.Object k;
   object java.lang.Object v;
 matches {
   h.put(k,v);
   h.remove(k);
   h.containsKey(k);
 }

HasNext

 query main ()
 uses
   object java.util.Iterator it;
 matches {
   ~it.hasNext();
   it.next();
 }

SafeIterator

 query main ()
 uses
   object java.util.Collection ds;
   object java.util.Iterator e;
 matches {
   e = ds.iterator(ds);
   { ds.add*(...) | ds.remove*(...); }
   e.next();
 }

SafeFileInputStream

 query main()
 uses object java.io.FileInputStream in;
 within _ . _ ();
 matches {
   in = new java.io.FileInputStream();
   ~in.close();
 }

SafeFileWriter

 query main()
 uses 
   object java.io.FileWriter ret;
   object java.io.FileWriter f;
 matches {
   ret := S(f);  
 }
 
 query S(object java.io.FileWriter f)
 returns
   object java.io.FileWriter ret;
 matches {
   f = new java.io.FileWriter(_);
   ret := SafeWrite(f); 
   ret.close(_);
   ret.write(_);
 } 
 
 query SafeWrite(object java.io.FileWriter f)
 returns 
   object java.io.FileWriter ret;
 uses
   object java.io.FileWriter temp;
 matches {
   ret := f 
   | { temp := S(f); 
     ret := SafeWrite(temp);}
   | { f.write(_);
     ret := SafeWrite(f);}
 }
Personal tools
Namespaces

Variants
Actions
Navigation