boolean lock(String variable, Transaction t, boolean read){
    	if(read){
    		if(readLockTable.containsKey(variable)){
    			if(!readLockTable.get(variable).contains(t))
    				readLockTable.get(variable).add(t);
    		}
    		else{
    			List<Transaction> lst=new ArrayList<Transaction>();
    			lst.add(t);
    			readLockTable.put(variable, lst);
    		}
    		return true;
    	}
    	else{
    	
         	if(!variable.contains(variable))
         		throw new IllegalStateException("Does not contain that variable");
         
         	//updating readLockTable
         	if(readLockTable.containsKey(variable)){
         		if(readLockTable.get(variable).contains(t)){
         			readLockTable.get(variable).remove(t);
         		}
         		else{
         			throw new IllegalStateException("LOCK MANAGER IS MALFUNCTIONING!");
         		}
         	}
         	
         	if(lockTable.containsKey(variable)){
    			if(lockTable.get(variable).equals(t))
    				return true;
         		return false;
         	}
         	else{
         		lockTable.put(variable,t);
         		return true;
         	}
    	}
    }