static boolean seq_valid(int[] seq)
    {
    	int j;
    	boolean positive = false;
    	boolean pred_not = false;
    	boolean operand = false;
    	for(j=0;j<SEQ_MAX;++j)
    	{
    		switch ((seq)[j])
    		{
    			case CODE_NONE :
    				break;
    			case CODE_OR :
    				if (!operand || !positive)
    					return false;
    				pred_not = false;
    				positive = false;
    				operand = false;
    				break;
    			case CODE_NOT :
    				if (pred_not)
    					return false;
    				pred_not = !pred_not;
    				operand = false;
    				break;
    			default:
    				if (!pred_not)
    					positive = true;
    				pred_not = false;
    				operand = true;
    				break;
    		}
    	}
    	return positive && operand;
    }